From b80d7f5875709208b5f3297d5f620996caa47c19 Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 18 Jan 2024 12:14:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Clash=20=E8=8A=82=E7=82=B9=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20fingerprint(=E5=86=85=E9=83=A8=E8=BD=AC=E4=B8=BA=20?= =?UTF-8?q?tls-fingerprint);=20=E6=94=AF=E6=8C=81=20Clash=20=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD=E7=9A=84=20global-client-f?= =?UTF-8?q?ingerprint=20=E4=BC=98=E5=85=88=E7=BA=A7=E4=BD=8E=E4=BA=8E=20pr?= =?UTF-8?q?oxy=20=E5=86=85=E7=9A=84=20client-fingerprint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/parsers/index.js | 4 ++++ .../src/core/proxy-utils/preprocessors/index.js | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index f4b7462..7bf0ccc 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.179", + "version": "2.14.181", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index d5bb588..c5b1ecb 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -578,6 +578,10 @@ function Clash_All() { } } + if (proxy.fingerprint) { + proxy['tls-fingerprint'] = proxy.fingerprint; + } + if (proxy['benchmark-url']) { proxy['test-url'] = proxy['benchmark-url']; } diff --git a/backend/src/core/proxy-utils/preprocessors/index.js b/backend/src/core/proxy-utils/preprocessors/index.js index 1c57cf0..01c2342 100644 --- a/backend/src/core/proxy-utils/preprocessors/index.js +++ b/backend/src/core/proxy-utils/preprocessors/index.js @@ -46,8 +46,19 @@ function Clash() { }; const parse = function (raw) { // Clash YAML format - const proxies = safeLoad(raw).proxies; - return proxies.map((p) => JSON.stringify(p)).join('\n'); + const { + proxies, + 'global-client-fingerprint': globalClientFingerprint, + } = safeLoad(raw); + return proxies + .map((p) => { + // https://github.com/MetaCubeX/mihomo/blob/Alpha/docs/config.yaml#L73C1-L73C26 + if (globalClientFingerprint && !p['client-fingerprint']) { + p['client-fingerprint'] = globalClientFingerprint; + } + return JSON.stringify(p); + }) + .join('\n'); }; return { name, test, parse }; }