From 2ea46dcbf1fd668bcb999c8f139d68374f4d7f60 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 10 Feb 2025 06:44:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Shadowsocks=20URI=20=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/index.js | 15 +++++++++++++++ backend/src/core/proxy-utils/parsers/index.js | 3 +++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index bcd2e2d..51f9955 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.32", + "version": "2.16.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/index.js b/backend/src/core/proxy-utils/index.js index 13f9f35..ec03e4e 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -21,6 +21,7 @@ import { findByName } from '@/utils/database'; import { produceArtifact } from '@/restful/sync'; import { getFlag, removeFlag, getISO, MMDB } from '@/utils/geo'; import Gist from '@/utils/gist'; +import { isPresent } from './producers/utils'; function preprocess(raw) { for (const processor of PROXY_PREPROCESSORS) { @@ -572,6 +573,20 @@ function lastParse(proxy) { if (!proxy['tls-fingerprint'] && caStr) { proxy['tls-fingerprint'] = rs.generateFingerprint(caStr); } + if ( + ['shadowsocks'].includes(proxy.type) && + isPresent(proxy, 'shadow-tls-password') + ) { + proxy.plugin = 'shadow-tls'; + proxy['plugin-opts'] = { + host: proxy['shadow-tls-sni'], + password: proxy['shadow-tls-password'], + version: proxy['shadow-tls-version'], + }; + delete proxy['shadow-tls-sni']; + delete proxy['shadow-tls-password']; + delete proxy['shadow-tls-version']; + } return proxy; } diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index e456581..1b2d41b 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -128,6 +128,9 @@ function URI_SS() { } userInfoStr = content.split('@')[0]; serverAndPortArray = content.match(/@([^/]*)(\/|$)/); + } else if (content.includes('?')) { + const parsed = content.match(/(\?.*)$/); + query = parsed[1]; } const serverAndPort = serverAndPortArray[1];