Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.3.3 #920

Merged
merged 68 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f61a713
还是换成 libtorrent
Ghost-chu Jan 14, 2025
33d8c6a
清理语言文件
Ghost-chu Jan 14, 2025
c1006ce
Update dependency org.bouncycastle:bcpg-jdk18on to v1.80
renovate[bot] Jan 15, 2025
acb7a58
Update dependency org.bouncycastle:bcprov-jdk18on to v1.80
renovate[bot] Jan 15, 2025
e2d3792
添加 Tracker 操作支持
Ghost-chu Jan 15, 2025
2738e41
Update docker/build-push-action action to v6.12.0
renovate[bot] Jan 15, 2025
ca6c853
支持批量替换 Tracker
Ghost-chu Jan 15, 2025
94c3393
使用 ExternalSwitch 实现更加灵活的开关控制
Ghost-chu Jan 15, 2025
d286c8b
Update src/main/java/com/ghostchu/peerbanhelper/module/impl/webapi/PB…
Ghost-chu Jan 15, 2025
9ea4ceb
修复 BBT 忘记替换的占位符
Ghost-chu Jan 15, 2025
d41838e
Merge remote-tracking branch 'origin/tracker-operation' into tracker-…
Ghost-chu Jan 15, 2025
2513705
Update src/main/java/com/ghostchu/peerbanhelper/torrent/TrackerImpl.java
Ghost-chu Jan 15, 2025
5b75964
Update src/main/java/com/ghostchu/peerbanhelper/torrent/TrackerImpl.java
Ghost-chu Jan 15, 2025
7e1b13a
BitComet 代码重用
Ghost-chu Jan 15, 2025
db94264
修复 BitComet 私有种子检查不起作用的问题
Ghost-chu Jan 15, 2025
69fe559
Merge remote-tracking branch 'origin/tracker-operation' into tracker-…
Ghost-chu Jan 15, 2025
fc4bcc0
BiglyBT 代码复用
Ghost-chu Jan 15, 2025
4bc8b6d
修复 includePrivate 错误
Ghost-chu Jan 15, 2025
ac52721
Transmission 代码复用
Ghost-chu Jan 15, 2025
aab7497
qBittorrent 代码复用
Ghost-chu Jan 15, 2025
e1e44f5
Merge branch 'dev' into tracker-operation
Ghost-chu Jan 15, 2025
6fef194
谢谢兔子
Ghost-chu Jan 15, 2025
3731d74
Merge pull request #912 from PBH-BTN/tracker-operation
Ghost-chu Jan 15, 2025
ce7a173
Merge pull request #911 from PBH-BTN/renovate/docker-build-push-actio…
Ghost-chu Jan 15, 2025
24dcdf5
Merge pull request #909 from PBH-BTN/renovate/org.bouncycastle-bcprov…
Ghost-chu Jan 15, 2025
611b876
Merge pull request #908 from PBH-BTN/renovate/org.bouncycastle-bcpg-j…
Ghost-chu Jan 15, 2025
0429f26
replace with toList
Ghost-chu Jan 15, 2025
c5bcab2
fix: changelog backgroud color
Gaojianli Jan 16, 2025
d74e67a
屏蔽场景网络空间测绘引擎
Ghost-chu Jan 16, 2025
bd5e9a6
支持下载器过滤
Ghost-chu Jan 16, 2025
c27ba38
增量更新 Torrent 的 Private 属性
Ghost-chu Jan 16, 2025
7ede0b5
bump btn_protocol_version
Ghost-chu Jan 16, 2025
06b6098
这俩实际上毫无关联
Ghost-chu Jan 16, 2025
45f07bb
修复构建错误
Ghost-chu Jan 16, 2025
072ef9a
发现 10000 条还是漏数据,偷懒大失败
Ghost-chu Jan 16, 2025
899b685
fix link
Ghost-chu Jan 16, 2025
2eea9e4
在 Docker 中发生 JVM 致命错误时,将错误写入 PBH Data 目录
Ghost-chu Jan 16, 2025
45adf12
fix easter egg
Ghost-chu Jan 16, 2025
f852660
fix build error
Ghost-chu Jan 16, 2025
78a443c
fix sql error
Ghost-chu Jan 16, 2025
1b86a22
换成 CountDownLatch 正经的信号量
Ghost-chu Jan 16, 2025
7c7e8ef
ci: 更新 pre-commit hook以加快pre-commit速度
Ovler-Young Jan 16, 2025
455117d
Update pre-commit
Ovler-Young Jan 16, 2025
553b3cf
disable route-view
Ghost-chu Jan 17, 2025
803f66e
修复测试版本提交 History 存在的问题
Ghost-chu Jan 17, 2025
9d274cc
bump version
Ghost-chu Jan 17, 2025
3160934
现在可以降低 batchSize 了
Ghost-chu Jan 18, 2025
7abfd6f
标记可能为null
Ghost-chu Jan 18, 2025
db20ee3
修复 BiglyBT 的 fetchTorrents 问题
Ghost-chu Jan 18, 2025
64258ca
Update src/main/java/com/ghostchu/peerbanhelper/torrent/TrackerImpl.java
Ghost-chu Jan 18, 2025
ab7a9c7
Update src/main/java/com/ghostchu/peerbanhelper/torrent/TrackerImpl.java
Ghost-chu Jan 18, 2025
5388280
请勿提交过于老旧的数据
Ghost-chu Jan 18, 2025
ad60750
Merge remote-tracking branch 'origin/dev' into dev
Ghost-chu Jan 18, 2025
b6925d4
继续之前检查 BiglyBT 适配器版本
Ghost-chu Jan 18, 2025
a95bc81
format
Ghost-chu Jan 18, 2025
8c21e61
手动添加一个 30 秒的超时
Ghost-chu Jan 18, 2025
4ec3634
还是交给 JVM 自己处理了
Ghost-chu Jan 18, 2025
664a521
对 Trackers 做一个空检查
Ghost-chu Jan 18, 2025
b1766aa
Merge pull request #919 from PBH-BTN/dev
Ghost-chu Jan 18, 2025
5c79ad2
bump version
Ghost-chu Jan 18, 2025
83210cc
移除意外添加的final
Ghost-chu Jan 18, 2025
6d95dce
添加后台任务,定时执行 SQLite 的优化 SQL
Ghost-chu Jan 19, 2025
09c1fc6
添加数据填充实验
Ghost-chu Jan 19, 2025
4570d17
安全关闭资源
Ghost-chu Jan 19, 2025
7bb59e0
加一个加不加都行的 autowired 注解
Ghost-chu Jan 19, 2025
cada622
invokeAndWait
Ghost-chu Jan 19, 2025
4fc53e5
修复内存泄漏
Ghost-chu Jan 19, 2025
f3ed673
修复奇怪的 NPE 问题
Ghost-chu Jan 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/jvm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
type=raw,ci
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.12.0
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
type=raw,ci
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.12.0
with:
context: .
file: ./Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/jvm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
type=raw,latest
type=sha
- name: Build and push Docker image
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.12.0
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
type=raw,latest
type=sha
- name: Build and push Aliyun ACR
uses: docker/build-push-action@v6.11.0
uses: docker/build-push-action@v6.12.0
with:
context: .
file: ./Dockerfile-Release
Expand Down
13 changes: 9 additions & 4 deletions git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ fi
# 如果有修改,进入 webui 目录
cd webui || exit 1

# 执行 prettier 格式化
pnpm prettier --write src/
# 去除CHANGED_FILES的webui/前缀
CHANGED_FILES=$(echo "$CHANGED_FILES" | sed 's/webui\///g')

# 对有改动的文件执行 prettier 格式化
echo "$CHANGED_FILES" | xargs -P 4 pnpm prettier --write

if [ $? -ne 0 ]; then
echo "Prettier formatting failed."
exit 1
fi

# 执行 eslint 检查
pnpm eslint . --ignore-pattern 'dist/*' --fix
# 对有改动的文件执行 eslint 检查
echo "$CHANGED_FILES" | xargs -P 4 pnpm eslint --cache --ignore-pattern 'dist/*' --fix

if [ $? -ne 0 ]; then
echo "ESLint check failed."
exit 1
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.ghostchu.peerbanhelper</groupId>
<artifactId>peerbanhelper</artifactId>
<version>7.3.2</version>
<version>7.3.3</version>
<packaging>jar</packaging>

<name>PeerBanHelper</name>
Expand Down Expand Up @@ -432,13 +432,13 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.79</version>
<version>1.80</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.bouncycastle/bcpg-jdk18on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk18on</artifactId>
<version>1.79</version>
<version>1.80</version>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/ghostchu/peerbanhelper/BuildMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public final class BuildMeta {
private String compileTime = "Unknown";

public void loadBuildMeta(YamlConfiguration configuration) {
this.version = configuration.getString("maven.version");
this.branch = configuration.getString("git.branch");
this.version = ExternalSwitch.parse("pbh.buildmeta.maven.version", configuration.getString("maven.version"));
this.branch = ExternalSwitch.parse("pbh.buildmeta.git.branch", configuration.getString("git.branch"));
this.commit = configuration.getString("git.commit.id.commit-id");
this.abbrev = configuration.getString("git.commit.id.abbrev");
this.os = System.getProperty("os.name");
Expand Down
108 changes: 108 additions & 0 deletions src/main/java/com/ghostchu/peerbanhelper/ExternalSwitch.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
package com.ghostchu.peerbanhelper;

import org.jetbrains.annotations.Nullable;

import java.util.Locale;

public class ExternalSwitch {
public static String parse(String args, @Nullable String def) {
var value = System.getProperty(args);
if (value == null)
value = System.getenv(args.replace(".", "_").replace("-", "_").toUpperCase(Locale.ROOT));
if (value == null)
return def;
return value;
}

public static boolean parseBoolean(String args, boolean def) {
var value = parse(args, null);
if (value == null)
return def;
return Boolean.parseBoolean(value);
}

public static int parseInt(String args, int def) {
var value = parse(args, null);
if (value == null)
return def;
return Integer.parseInt(value);
}

public static long parseLong(String args, long def) {
var value = parse(args, null);
if (value == null)
return def;
return Long.parseLong(value);
}

public static double parseDouble(String args, double def) {
var value = parse(args, null);
if (value == null)
return def;
return Double.parseDouble(value);
}

public static float parseFloat(String args, float def) {
var value = parse(args, null);
if (value == null)
return def;
return Float.parseFloat(value);
}

public static short parseShort(String args, short def) {
var value = parse(args, null);
if (value == null)
return def;
return Short.parseShort(value);
}

public static byte parseByte(String args, byte def) {
var value = parse(args, null);
if (value == null)
return def;
return Byte.parseByte(value);
}

public static char parseChar(String args, char def) {
var value = parse(args, null);
if (value == null)
return def;
return value.charAt(0);
}
Ghost-chu marked this conversation as resolved.
Show resolved Hide resolved

public static String parse(String args) {
return parse(args, null);
}

public static boolean parseBoolean(String args) {
return parseBoolean(args, false);
}

public static int parseInt(String args) {
return parseInt(args, 0);
}

public static long parseLong(String args) {
return parseLong(args, 0);
}

public static double parseDouble(String args) {
return parseDouble(args, 0);
}

public static float parseFloat(String args) {
return parseFloat(args, 0);
}

public static short parseShort(String args) {
return parseShort(args, (short) 0);
}

public static byte parseByte(String args) {
return parseByte(args, (byte) 0);
}

public static char parseChar(String args) {
return parseChar(args, '\u0000');
}
}
26 changes: 13 additions & 13 deletions src/main/java/com/ghostchu/peerbanhelper/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class Main {
@Getter
private static long startupAt = System.currentTimeMillis();
private static String userAgent;
public static final int PBH_BTN_PROTOCOL_IMPL_VERSION = 8;
public static final int PBH_BTN_PROTOCOL_IMPL_VERSION = 10;
public static final String PBH_BTN_PROTOCOL_READABLE_VERSION = "0.0.3";

public static void main(String[] args) {
Expand All @@ -112,7 +112,7 @@ public static void main(String[] args) {
log.info("Current system language tag: {}", defLocaleTag);
DEF_LOCALE = mainConfig.getString("language");
if (DEF_LOCALE == null || DEF_LOCALE.equalsIgnoreCase("default")) {
DEF_LOCALE = System.getenv("PBH_USER_LOCALE");
DEF_LOCALE = ExternalSwitch.parse("PBH_USER_LOCALE");
if (DEF_LOCALE == null) {
DEF_LOCALE = defLocaleTag;
}
Expand Down Expand Up @@ -180,7 +180,7 @@ public static void setupLogback() {
}

try {
var targetLevel = System.getProperty("pbh.log.level");
var targetLevel = ExternalSwitch.parse("pbh.log.level");
if (targetLevel != null) {
var rootLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) rootLogger;
Expand Down Expand Up @@ -230,7 +230,7 @@ private static void setupProxySettings() {
private static void setupConfDirectory(String[] args) {
String osName = System.getProperty("os.name");
String root = "data";
if ("true".equalsIgnoreCase(System.getProperty("pbh.usePlatformConfigLocation"))) {
if (ExternalSwitch.parseBoolean("pbh.usePlatformConfigLocation")) {
if (osName.contains("Windows")) {
root = new File(System.getenv("LOCALAPPDATA"), "PeerBanHelper").getAbsolutePath();
} else {
Expand All @@ -243,20 +243,20 @@ private static void setupConfDirectory(String[] args) {
root = dataDirectory.resolve("PeerBanHelper").toAbsolutePath().toString();
}
}
if (System.getProperty("pbh.datadir") != null) {
root = System.getProperty("pbh.datadir");
if (ExternalSwitch.parse("pbh.datadir") != null) {
root = ExternalSwitch.parse("pbh.datadir");
}

dataDirectory = new File(root);
logsDirectory = new File(dataDirectory, "logs");
configDirectory = new File(dataDirectory, "config");
pluginDirectory = new File(dataDirectory, "plugins");
debugDirectory = new File(dataDirectory, "debug");
if (System.getProperty("pbh.configdir") != null) {
configDirectory = new File(System.getProperty("pbh.configdir"));
if (ExternalSwitch.parse("pbh.configdir") != null) {
configDirectory = new File(ExternalSwitch.parse("pbh.configdir"));
}
if (System.getProperty("pbh.logsdir") != null) {
logsDirectory = new File(System.getProperty("pbh.logsdir"));
if (ExternalSwitch.parse("pbh.logsdir") != null) {
logsDirectory = new File(ExternalSwitch.parse("pbh.logsdir"));
}
// other directories aren't allowed to change by user to keep necessary structure
}
Expand All @@ -270,7 +270,7 @@ private static YamlConfiguration loadConfiguration(File file) {
configuration.load(file);
} catch (IOException | InvalidConfigurationException e) {
log.error("Unable to load configuration: invalid YAML configuration // 无法加载配置文件:无效的 YAML 配置,请检查是否有语法错误", e);
if (!Desktop.isDesktopSupported() || System.getProperty("pbh.nogui") != null || Arrays.stream(startupArgs).anyMatch(arg -> arg.equalsIgnoreCase("nogui"))) {
if (!Desktop.isDesktopSupported() || ExternalSwitch.parse("pbh.nogui") != null || Arrays.stream(startupArgs).anyMatch(arg -> arg.equalsIgnoreCase("nogui"))) {
try {
log.error("Bad configuration: {}", Files.readString(file.toPath()));
} catch (IOException ex) {
Expand Down Expand Up @@ -338,7 +338,7 @@ private static void setupShutdownHook() {

private static void initGUI(String[] args) {
String guiType = "swing";
if (!Desktop.isDesktopSupported() || System.getProperty("pbh.nogui") != null || Arrays.stream(args).anyMatch(arg -> arg.equalsIgnoreCase("nogui"))) {
if (!Desktop.isDesktopSupported() || ExternalSwitch.parse("pbh.nogui") != null || Arrays.stream(args).anyMatch(arg -> arg.equalsIgnoreCase("nogui"))) {
guiType = "console";
} else if (Arrays.stream(args).anyMatch(arg -> arg.equalsIgnoreCase("swing"))) {
guiType = "swing";
Expand All @@ -354,7 +354,7 @@ public static String getUserAgent() {
if (userAgent != null) return userAgent;
String userAgentTemplate = "PeerBanHelper/%s (%s; %s,%s,%s) BTN-Protocol/%s BTN-Protocol-Version/%s";
var osMXBean = ManagementFactory.getOperatingSystemMXBean();
String release = System.getProperty("pbh.release");
String release = ExternalSwitch.parse("pbh.release");
if (release == null) {
release = "unknown";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.ghostchu.peerbanhelper.lab.Laboratory;
import com.ghostchu.peerbanhelper.metric.BasicMetrics;
import com.ghostchu.peerbanhelper.module.*;
import com.ghostchu.peerbanhelper.module.impl.background.BackgroundModule;
import com.ghostchu.peerbanhelper.module.impl.rule.*;
import com.ghostchu.peerbanhelper.module.impl.webapi.*;
import com.ghostchu.peerbanhelper.peer.Peer;
Expand Down Expand Up @@ -197,14 +198,13 @@ public void start() throws SQLException {

@SneakyThrows
private void runTestCode() {
if (!"LiveDebug".equalsIgnoreCase(System.getProperty("pbh.release"))) {
if (!"LiveDebug".equalsIgnoreCase(ExternalSwitch.parse("pbh.release"))) {
return;
}
// run some junky test code here
// ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory
// .getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
// root.setLevel(ch.qos.logback.classic.Level.TRACE);

}


Expand Down Expand Up @@ -384,10 +384,7 @@ private void saveBanList() {
}

private void registerHttpServer() {
String token = System.getenv("PBH_API_TOKEN");
if (token == null) {
token = System.getProperty("pbh.api_token");
}
String token = ExternalSwitch.parse("pbh.api_token");
if (token == null) {
token = Main.getMainConfig().getString("server.token");
}
Expand Down Expand Up @@ -737,7 +734,8 @@ private void registerModules() {
moduleManager.register(PBHPushController.class);
moduleManager.register(PBHLabController.class);
moduleManager.register(PBHEasterEggController.class);

moduleManager.register(PBHUtilitiesController.class);
moduleManager.register(BackgroundModule.class);
}

public Map<Downloader, Map<Torrent, List<Peer>>> collectPeers() {
Expand Down
Loading
Loading