Skip to content

Commit a04887a

Browse files
authored
Merge pull request #1011 from PBH-BTN/master
v7.4.4
2 parents c362445 + 0cbea79 commit a04887a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1369
-1250
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.bat text eol=crlf

.github/dependabot.yml

-11
This file was deleted.

.github/workflows/build_jni.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build C++ JNI Library
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
runs-on: windows-latest
9+
strategy:
10+
matrix:
11+
arch:
12+
- x64
13+
- amd64_arm64
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-java@v4
17+
with:
18+
distribution: 'oracle'
19+
java-version: '21'
20+
- uses: TheMrMilchmann/setup-msvc-dev@v3
21+
with:
22+
arch: ${{ matrix.arch }}
23+
- name: Build JNI Library
24+
run: |
25+
cd cpp-src
26+
cl /LD /I"$env:JAVA_HOME\include" /I"$env:JAVA_HOME\include\win32" ghost-common-jni.cpp /link /out:ghost-common-jni_vc2015_${{ matrix.arch == 'x64' && 'amd64' || 'aarch64'}}.dll
27+
- name: Upload artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: jni-${{ matrix.arch == 'x64' && 'amd64' || 'aarch64'}}
31+
path: cpp-src/*.dll

.github/workflows/build_maven.yml

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,24 @@ on:
88
jobs:
99
WebUI:
1010
uses: ./.github/workflows/build_fe.yml
11+
JNI:
12+
uses: ./.github/workflows/build_jni.yml
1113
Maven:
12-
needs: WebUI
14+
needs: [WebUI,JNI]
1315
runs-on: ubuntu-latest
1416
steps:
1517
- uses: actions/checkout@v4
1618
- uses: actions/download-artifact@v4
19+
name: Download WebUI Files
1720
with:
1821
name: webui-dist
1922
path: src/main/resources/static
20-
- name: Display structure of WebUI dist
21-
run: ls src/main/resources/static
23+
- uses: actions/download-artifact@v4
24+
name: Download JNI Library
25+
with:
26+
pattern: jni-*
27+
merge-multiple: true
28+
path: src/main/resources/native/windows
2229
- uses: actions/setup-java@v4
2330
with:
2431
distribution: "temurin"

.github/workflows/jvm-ci.yml

+46-37
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,34 @@ on:
1313
workflow_dispatch:
1414
jobs:
1515
Build_Executable:
16+
name: Build JAR Files
1617
uses: ./.github/workflows/build_maven.yml
1718
secrets: inherit
1819
Build_Installers:
20+
name: Generate Installers
1921
needs: Build_Executable
2022
uses: ./.github/workflows/build_installers.yml
2123
secrets: inherit
2224
Build_Portable:
25+
name: Generate Portable Version
2326
needs: Build_Executable
2427
uses: ./.github/workflows/build_portable.yml
2528
Build_SPK:
29+
name: Generate Synology Package
2630
needs: Build_Executable
2731
uses: ./.github/workflows/build_spk.yml
2832
with:
2933
image: ghostchu/peerbanhelper-snapshot:sha-$(git rev-parse --short ${{ github.sha }})
3034
Build_DEB:
35+
name: Generate Debian Package
3136
needs: Build_Executable
3237
uses: ./.github/workflows/build_deb.yml
3338
Build_PKG:
39+
name: Generate FreeBSD Package
3440
needs: Build_Executable
3541
uses: ./.github/workflows/build_pkg.yml
3642
Create_Torrent:
43+
name: Create Torrent
3744
needs: [ Build_Executable, Build_Installers, Build_SPK, Build_DEB, Build_PKG, Build_Portable ]
3845
runs-on: ubuntu-latest
3946
steps:
@@ -101,6 +108,7 @@ jobs:
101108
-o peerbanhelper.torrent \
102109
"PeerBanHelper_Installers_${{ steps.set_version.outputs.version }}.tar.gz"
103110
Build_Docker:
111+
name: Build and Push Docker Images
104112
needs: Build_Executable
105113
runs-on: ubuntu-latest
106114
steps:
@@ -120,7 +128,7 @@ jobs:
120128
password: ${{ secrets.DOCKER_TOKEN }}
121129
- name: Extract metadata (tags, labels) for Docker
122130
id: meta
123-
uses: docker/metadata-action@v5.6.1
131+
uses: docker/metadata-action@v5.7.0
124132
with:
125133
images: ghostchu/peerbanhelper-snapshot
126134
tags: |
@@ -133,7 +141,7 @@ jobs:
133141
type=raw,ci
134142
type=sha
135143
- name: Build and push Docker image
136-
uses: docker/build-push-action@v6.13.0
144+
uses: docker/build-push-action@v6.15.0
137145
with:
138146
context: .
139147
file: ./Dockerfile
@@ -145,38 +153,39 @@ jobs:
145153
labels: ${{ steps.meta.outputs.labels }}-jvm-universal
146154
cache-from: type=gha
147155
cache-to: type=gha,mode=min
148-
# Build_Docker_Standalone:
149-
# runs-on: ubuntu-latest
150-
# steps:
151-
# - uses: actions/checkout@v4
152-
# - name: Set Up QEMU
153-
# uses: docker/setup-qemu-action@v3
154-
# - name: Set Up Buildx
155-
# uses: docker/setup-buildx-action@v3
156-
# - name: Extract metadata (tags, labels) for Docker
157-
# id: meta
158-
# uses: docker/[email protected]
159-
# with:
160-
# images: ghostchu/peerbanhelper-snapshot
161-
# tags: |
162-
# type=ref,event=branch
163-
# type=ref,event=tag
164-
# type=ref,event=pr
165-
# type=semver,pattern={{version}}
166-
# type=semver,pattern={{major}}.{{minor}}
167-
# type=raw,ci-jvm-universal
168-
# type=raw,ci
169-
# type=sha
170-
# - name: Build and push Docker image
171-
# uses: docker/[email protected]
172-
# with:
173-
# context: .
174-
# file: ./Dockerfile
175-
# push: false
176-
# platforms: |
177-
# linux/amd64
178-
# linux/arm64/v8
179-
# tags: ${{ steps.meta.outputs.tags }}
180-
# labels: ${{ steps.meta.outputs.labels }}-jvm-universal
181-
# cache-from: type=gha
182-
# cache-to: type=gha,mode=min
156+
Build_Docker_Standalone:
157+
name: Build Standalone Docker Images
158+
runs-on: ubuntu-latest
159+
steps:
160+
- uses: actions/checkout@v4
161+
- name: Set Up QEMU
162+
uses: docker/setup-qemu-action@v3
163+
- name: Set Up Buildx
164+
uses: docker/setup-buildx-action@v3
165+
- name: Extract metadata (tags, labels) for Docker
166+
id: meta
167+
uses: docker/[email protected]
168+
with:
169+
images: ghostchu/peerbanhelper-snapshot
170+
tags: |
171+
type=ref,event=branch
172+
type=ref,event=tag
173+
type=ref,event=pr
174+
type=semver,pattern={{version}}
175+
type=semver,pattern={{major}}.{{minor}}
176+
type=raw,ci-jvm-universal
177+
type=raw,ci
178+
type=sha
179+
- name: Build and push Docker image
180+
uses: docker/[email protected]
181+
with:
182+
context: .
183+
file: ./Dockerfile
184+
push: false
185+
platforms: |
186+
linux/amd64
187+
linux/arm64/v8
188+
tags: ${{ steps.meta.outputs.tags }}
189+
labels: ${{ steps.meta.outputs.labels }}-jvm-universal
190+
cache-from: type=gha
191+
cache-to: type=gha,mode=min

.github/workflows/jvm-release.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
Build_Executable:
11+
name: Build JAR Files
1112
permissions:
1213
contents: write
1314
checks: write
@@ -21,35 +22,42 @@ jobs:
2122
uses: ./.github/workflows/build_maven.yml
2223

2324
Build_Installers:
25+
name: Generate Installers
2426
needs: Build_Executable
2527
uses: ./.github/workflows/build_installers.yml
2628
secrets: inherit
2729

2830
Build_SPK:
31+
name: Generate Synology Package
2932
needs: Build_Executable
3033
uses: ./.github/workflows/build_spk.yml
3134
with:
3235
image: registry.cn-hangzhou.aliyuncs.com/ghostchu/peerbanhelper:${{ github.ref_name }}
3336

3437
Build_DEB:
38+
name: Generate Debian Package
3539
needs: Build_Executable
3640
uses: ./.github/workflows/build_deb.yml
3741

3842
Build_PKG:
43+
name: Generate FreeBSD Package
3944
needs: Build_Executable
4045
uses: ./.github/workflows/build_pkg.yml
4146

4247
Build_Portable:
48+
name: Generate Portable Version
4349
needs: Build_Executable
4450
uses: ./.github/workflows/build_portable.yml
4551

4652
Empty_Old_S3_Files:
53+
name: Delete Outdate file in S3
4754
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
4855
needs: [Build_Executable, Build_Installers, Build_SPK, Build_DEB, Build_PKG, Build_Portable]
4956
uses: ./.github/workflows/delete_old_s3_objects.yml
5057
secrets: inherit
5158

5259
Upload_Updates_To_S3:
60+
name: Update To S3
5361
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
5462
needs: [ Build_Executable, Build_Installers, Build_SPK, Build_DEB, Build_PKG, Build_Portable, Empty_Old_S3_Files ]
5563
runs-on: ubuntu-latest
@@ -68,12 +76,14 @@ jobs:
6876
destination_dir: 'updates/latest'
6977

7078
Clear_CloudFlare_Updates:
79+
name: Clear CloudFlare Cache
7180
if: ${{ github.event_name == 'release' && !github.event.release.prerelease }}
7281
needs: [Upload_Updates_To_S3]
7382
uses: ./.github/workflows/flush_cloudflare_cache.yml
7483
secrets: inherit
7584

7685
Upload_Artifacts:
86+
name: Upload Release Artifacts
7787
continue-on-error: true
7888
if: github.event_name != 'workflow_dispatch'
7989
needs: [Build_Executable, Build_Installers, Build_SPK, Build_DEB, Build_PKG, Build_Portable]
@@ -158,6 +168,7 @@ jobs:
158168
asset_paths: '["target/media/PeerBanHelper_*", "target/media/peerbanhelper_*", "target/media/peerbanhelper-*", "target/media/_____UNSUPPORTED_PeerBanHelper_*", "peerbanhelper.torrent", "PeerBanHelper_Installers.tar.gz"]'
159169

160170
Build_Docker:
171+
name: Build Docker Image
161172
if: github.event_name != 'workflow_dispatch'
162173
permissions:
163174
contents: write
@@ -187,7 +198,7 @@ jobs:
187198
password: ${{ secrets.DOCKER_TOKEN }}
188199
- name: Extract metadata (tags, labels) for Docker
189200
id: meta
190-
uses: docker/metadata-action@v5.6.1
201+
uses: docker/metadata-action@v5.7.0
191202
with:
192203
images: ghostchu/peerbanhelper
193204
tags: |
@@ -200,7 +211,7 @@ jobs:
200211
type=raw,latest
201212
type=sha
202213
- name: Build and push Docker image
203-
uses: docker/build-push-action@v6.13.0
214+
uses: docker/build-push-action@v6.15.0
204215
with:
205216
context: .
206217
file: ./Dockerfile
@@ -222,7 +233,7 @@ jobs:
222233
password: ${{ secrets.ALIYUN_ACR_PASSWORD }}
223234
- name: Extract metadata (tags, labels) for Aliyun ACR
224235
id: meta-acr
225-
uses: docker/metadata-action@v5.6.1
236+
uses: docker/metadata-action@v5.7.0
226237
with:
227238
images: registry.cn-hangzhou.aliyuncs.com/ghostchu/peerbanhelper
228239
tags: |
@@ -235,7 +246,7 @@ jobs:
235246
type=raw,latest
236247
type=sha
237248
- name: Build and push Aliyun ACR
238-
uses: docker/build-push-action@v6.13.0
249+
uses: docker/build-push-action@v6.15.0
239250
with:
240251
context: .
241252
file: ./Dockerfile-Release

Dockerfile

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1+
FROM --platform=$BUILDPLATFORM node:current-alpine as build_web
2+
COPY webui /webui
3+
WORKDIR /webui
4+
RUN corepack enable pnpm && CI=1 pnpm i && pnpm run build
5+
6+
FROM --platform=$BUILDPLATFORM docker.io/maven:3.9.9-eclipse-temurin-21-alpine AS build
7+
COPY . /build
8+
WORKDIR /build
9+
COPY --from=build_web webui/dist src/main/resources/static
10+
RUN apk add git && \
11+
mvn -B clean package --file pom.xml -T 1.5C -P thin-sqlite-packaging
12+
113
FROM docker.io/bellsoft/liberica-runtime-container:jre-23-slim-musl
214
LABEL maintainer="https://github.com/PBH-BTN/PeerBanHelper"
3-
COPY target/libraries /app/libraries
4-
COPY target/PeerBanHelper.jar /app/PeerBanHelper.jar
515
USER 0
616
EXPOSE 9898
717
ENV TZ=UTC
818
ENV JAVA_OPTS="-Dpbh.release=docker -Djava.awt.headless=true -Xmx512M -Xms16M -Xss512k -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+ShrinkHeapInSteps"
919
WORKDIR /app
1020
VOLUME /tmp
21+
COPY --from=build build/target/libraries /app/libraries
22+
COPY --from=build build/target/PeerBanHelper.jar /app/PeerBanHelper.jar
23+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
1124
ENTRYPOINT ["sh", "-c", "${JAVA_HOME}/bin/java ${JAVA_OPTS} -jar PeerBanHelper.jar"]

PACKAGING.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,9 @@ CEF 默认使用沙盒技术避免 Web 内容危害本地计算机安全,但
204204
### 禁用更新检查
205205

206206
文件名称:disable-update-check.txt
207-
注:这会禁用更新检查,但已计划的更新仍可能会在启动时安装。
207+
注:这会禁用更新检查,但已计划的更新仍可能会在启动时安装。
208+
209+
### 更改检查并发等级
210+
211+
默认情况下最多允许 32 个并发检查,你可以通过 `pbh.checkParallelism=32` 开关参数来更改并发等级。
212+
注意:过高的并发等级可能耗尽堆内存导致程序卡死。

build.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/sh
22
echo "Setup webui files.."
3-
sh setup-webui.sh
3+
current_wd=$(pwd)
4+
static_dir="$(dirname $0)/src/main/resources/static"
5+
6+
rm -rf ${static_dir} || echo ""
7+
cd ${current_wd}/webui
8+
pnpm install
9+
pnpm run build
10+
cd ${current_wd}
11+
cp -r webui/dist ${static_dir}
412

513
echo "Prepare to build jar.."
6-
mvn -B clean package --file pom.xml
14+
mvn -B clean package --file pom.xml

cpp-src/build.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VS2015 x64 本机工具命令提示符
1+
# VS2015 x64 本机工具命令提示符
22
cl /LD /I"%JAVA_HOME%\include" /I"%JAVA_HOME%\include\win32" ghost-common-jni.cpp /link /out:ghost-common-jni_vc2015_amd64.dll
3-
VS2015 x64 ARM 兼容工具命令提示符
3+
# VS2015 x64 ARM 兼容工具命令提示符
44
cl /LD /I"%JAVA_HOME%\include" /I"%JAVA_HOME%\include\win32" ghost-common-jni.cpp /link /out:ghost-common-jni_vc2015_aarch64.dll

0 commit comments

Comments
 (0)