From da9b1d87958ebf06e0d5518f42b602fe93795c2e Mon Sep 17 00:00:00 2001 From: xream Date: Sat, 26 Apr 2025 13:46:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BE=93=E5=87=BA=E5=88=B0=20Clash/Sta?= =?UTF-8?q?sh/Shadowrocket=20=E6=97=B6,=20=E4=BC=9A=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E6=8E=89=E9=85=8D=E7=BD=AE=E4=BA=86=E5=89=8D=E7=BD=AE=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E7=9A=84=E8=8A=82=E7=82=B9,=20=E5=B9=B6=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BD=BF=E7=94=A8=E5=AF=B9=E5=BA=94=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/producers/clash.js | 11 ++++++----- .../src/core/proxy-utils/producers/shadowrocket.js | 6 ++++++ scripts/demo.js | 1 + 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/package.json b/backend/package.json index 859b5ab..6da7373 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.32", + "version": "2.19.33", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/producers/clash.js b/backend/src/core/proxy-utils/producers/clash.js index 8f4268d..f5940f6 100644 --- a/backend/src/core/proxy-utils/producers/clash.js +++ b/backend/src/core/proxy-utils/producers/clash.js @@ -1,4 +1,5 @@ import { isPresent } from '@/core/proxy-utils/producers/utils'; +import $ from '@/core/app'; export default function Clash_Producer() { const type = 'ALL'; @@ -46,6 +47,11 @@ export default function Clash_Producer() { proxy['reality-opts'])) ) { return false; + } else if (proxy['underlying-proxy'] || proxy['dialer-proxy']) { + $.error( + `Clash 不支持前置代理字段. 已过滤节点 ${proxy.name}`, + ); + return false; } return true; }) @@ -152,11 +158,6 @@ export default function Clash_Producer() { } delete proxy['tls-fingerprint']; - if (proxy['underlying-proxy']) { - proxy['dialer-proxy'] = proxy['underlying-proxy']; - } - delete proxy['underlying-proxy']; - if (isPresent(proxy, 'tls') && typeof proxy.tls !== 'boolean') { delete proxy.tls; } diff --git a/backend/src/core/proxy-utils/producers/shadowrocket.js b/backend/src/core/proxy-utils/producers/shadowrocket.js index 2fab6a0..a03fa71 100644 --- a/backend/src/core/proxy-utils/producers/shadowrocket.js +++ b/backend/src/core/proxy-utils/producers/shadowrocket.js @@ -1,4 +1,5 @@ import { isPresent } from '@/core/proxy-utils/producers/utils'; +import $ from '@/core/app'; export default function Shadowrocket_Producer() { const type = 'ALL'; @@ -10,6 +11,11 @@ export default function Shadowrocket_Producer() { return false; } else if (['mieru', 'anytls'].includes(proxy.type)) { return false; + } else if (proxy['underlying-proxy'] || proxy['dialer-proxy']) { + $.error( + `Shadowrocket 不支持前置代理字段. 已过滤节点 ${proxy.name}. 请使用 App 内的 "代理通过" 功能`, + ); + return false; } return true; }) diff --git a/scripts/demo.js b/scripts/demo.js index 6d1af3d..78bbad0 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -17,6 +17,7 @@ function operator(proxies = [], targetPlatform, context) { // 只给 mihomo 输出的话, `dialer-proxy` 也行 // 只给 sing-box 输出的话, `detour` 也行 // 只给 egern 输出的话, `prev_hop` 也行 + // 输出到 Clash/Stash/Shadowrocket 时, 会过滤掉配置了前置代理的节点, 并提示使用对应的功能. // 9. `trojan`, `tuic`, `hysteria`, `hysteria2`, `juicity` 会在解析时设置 `tls`: true (会使用 tls 类协议的通用逻辑), 输出时删除 // 10. `sni` 在某些协议里会自动与 `servername` 转换 // 11. 读取节点的 ca-str 和 _ca (后端文件路径) 字段, 自动计算 fingerprint (参考 https://t.me/zhetengsha/1512)