From f5888ad992e6e3e90f4af296196f18cabdf49d0b Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Wed, 6 Nov 2024 20:00:17 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B2=A1=E6=94=B9=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1d0736cf95..3a54508162 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.ghostchu.peerbanhelper peerbanhelper - 7.1.0-beta1 + 7.1.0 jar PeerBanHelper From f836699ab250afadaa678d1df034e52ced6e6533 Mon Sep 17 00:00:00 2001 From: Ghost_chu Date: Wed, 6 Nov 2024 20:07:43 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=85=89=E9=80=9F=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E8=84=9A=E6=9C=AC=E6=89=A7=E8=A1=8C=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../peerbanhelper/config/ProfileUpdateScript.java | 6 ++++++ .../module/impl/rule/BtnNetworkOnline.java | 10 +++++++--- src/main/resources/profile.yml | 4 +++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ghostchu/peerbanhelper/config/ProfileUpdateScript.java b/src/main/java/com/ghostchu/peerbanhelper/config/ProfileUpdateScript.java index 597aab070c..fb175981c1 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/config/ProfileUpdateScript.java +++ b/src/main/java/com/ghostchu/peerbanhelper/config/ProfileUpdateScript.java @@ -25,6 +25,12 @@ public ProfileUpdateScript(YamlConfiguration conf) { this.conf = conf; } + @UpdateScript(version = 23) + public void scriptExecuteSwitch() { + conf.set("module.btn.allow-script-execute", true); + } + + @UpdateScript(version = 22) public void workaroundForBadWebUI() { if(conf.getInt("module.auto-range-ban.ipv6") == 32) { // WebUI bug diff --git a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/BtnNetworkOnline.java b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/BtnNetworkOnline.java index 7caca10c0f..1eb5a9f238 100644 --- a/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/BtnNetworkOnline.java +++ b/src/main/java/com/ghostchu/peerbanhelper/module/impl/rule/BtnNetworkOnline.java @@ -66,6 +66,7 @@ public class BtnNetworkOnline extends AbstractRuleFeatureModule implements Reloa private ScriptEngine scriptEngine; @Autowired private ScriptStorageDao scriptStorageDao; + private boolean allowScript; @Override @@ -156,6 +157,7 @@ public ReloadResult reloadModule() throws Exception { public void reloadConfig() { this.banDuration = getConfig().getLong("ban-duration", 0); + this.allowScript = getConfig().getBoolean("allow-script-execute"); getCache().invalidateAll(); } @@ -174,9 +176,11 @@ public boolean isThreadSafe() { if (checkExceptionResult.action() == PeerAction.SKIP) { return checkExceptionResult; } - var scriptResult = checkScript(torrent, peer, downloader, ruleExecuteExecutor); - if (scriptResult.action() != PeerAction.NO_ACTION) { - return scriptResult; + if(allowScript) { + var scriptResult = checkScript(torrent, peer, downloader, ruleExecuteExecutor); + if (scriptResult.action() != PeerAction.NO_ACTION) { + return scriptResult; + } } return checkShouldBan(torrent, peer, downloader, ruleExecuteExecutor); } diff --git a/src/main/resources/profile.yml b/src/main/resources/profile.yml index 5151f7685e..da20b84afb 100644 --- a/src/main/resources/profile.yml +++ b/src/main/resources/profile.yml @@ -1,4 +1,4 @@ -config-version: 22 +config-version: 23 # Check interval (Timeunit: ms) # 检查频率(单位:毫秒) check-interval: 5000 @@ -271,6 +271,8 @@ module: enabled: true # 封禁时间,单位:毫秒,使用 default 则跟随全局设置 ban-duration: 259200000 + # 是否允许执行从 BTN 服务器下发的 Aviator Script + allow-script-execute: true # 多拨封禁 # Multi-dialing blocker multi-dialing-blocker: From aeb1d27e5aa15f9ab08eed8da8295d967ba2eaca Mon Sep 17 00:00:00 2001 From: Gaojianli Date: Wed, 6 Nov 2024 20:23:46 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=85=89=E9=80=9F=E8=BF=BD=E5=8A=A0?= =?UTF-8?q?=E5=89=8D=E7=AB=AFUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webui/src/api/model/profile.ts | 1 + .../settings/components/profile/components/btn.vue | 11 +++++++++++ .../views/settings/components/profile/locale/en-US.ts | 6 +++++- .../views/settings/components/profile/locale/zh-CN.ts | 7 ++++++- 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/webui/src/api/model/profile.ts b/webui/src/api/model/profile.ts index c43a0cc936..1b1bee561a 100644 --- a/webui/src/api/model/profile.ts +++ b/webui/src/api/model/profile.ts @@ -91,6 +91,7 @@ export interface AutoRangeBan { export interface Btn { enabled: boolean ban_duration: BanDuration + allow_script_execute: boolean } export interface MultiDialingBlocker { diff --git a/webui/src/views/settings/components/profile/components/btn.vue b/webui/src/views/settings/components/profile/components/btn.vue index 159dd14ad1..f6f88efe4b 100644 --- a/webui/src/views/settings/components/profile/components/btn.vue +++ b/webui/src/views/settings/components/profile/components/btn.vue @@ -21,6 +21,17 @@ ={{ formatMilliseconds(model.ban_duration) }} + + + +