diff --git a/backend/banner b/backend/banner index 53a7f6b..6356592 100644 --- a/backend/banner +++ b/backend/banner @@ -5,7 +5,7 @@ * ╚════██║██║ ██║██╔══██╗╚════╝╚════██║ ██║ ██║ ██║██╔══██╗██╔══╝ * ███████║╚██████╔╝██████╔╝ ███████║ ██║ ╚██████╔╝██║ ██║███████╗ * ╚══════╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ - * Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket! + * Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket! * @updated: <%= updated %> * @version: <%= pkg.version %> * @author: Peng-YM diff --git a/backend/package.json b/backend/package.json index 39f8f7b..bcd2e2d 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,7 +1,7 @@ { "name": "sub-store", - "version": "2.16.31", - "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", + "version": "2.16.32", + "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { "preinstall": "npx only-allow pnpm", diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index 3daab08..e456581 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -146,11 +146,10 @@ function URI_SS() { // } // handle obfs - const idx = content.indexOf('?plugin='); - if (idx !== -1) { + const pluginMatch = content.match(/[?&]plugin=([^&]+)/); + if (pluginMatch) { const pluginInfo = ( - 'plugin=' + - decodeURIComponent(content.split('?plugin=')[1].split('&')[0]) + 'plugin=' + decodeURIComponent(pluginMatch[1]) ).split(';'); const params = {}; for (const item of pluginInfo) { @@ -175,6 +174,16 @@ function URI_SS() { tls: getIfPresent(params.tls), }; break; + case 'shadow-tls': { + proxy.plugin = 'shadow-tls'; + const version = getIfNotBlank(params['version']); + proxy['plugin-opts'] = { + host: getIfNotBlank(params['host']), + password: getIfNotBlank(params['password']), + version: version ? parseInt(version, 10) : undefined, + }; + break; + } default: throw new Error( `Unsupported plugin option: ${params.plugin}`, diff --git a/backend/src/core/proxy-utils/producers/shadowrocket.js b/backend/src/core/proxy-utils/producers/shadowrocket.js index ea9fd23..2446c0d 100644 --- a/backend/src/core/proxy-utils/producers/shadowrocket.js +++ b/backend/src/core/proxy-utils/producers/shadowrocket.js @@ -1,6 +1,6 @@ import { isPresent } from '@/core/proxy-utils/producers/utils'; -export default function ShadowRocket_Producer() { +export default function Shadowrocket_Producer() { const type = 'ALL'; const produce = (proxies, type, opts = {}) => { const list = proxies diff --git a/backend/src/core/proxy-utils/producers/uri.js b/backend/src/core/proxy-utils/producers/uri.js index 88f5f79..7b87540 100644 --- a/backend/src/core/proxy-utils/producers/uri.js +++ b/backend/src/core/proxy-utils/producers/uri.js @@ -54,6 +54,11 @@ export default function URI_Producer() { }${opts.tls ? ';tls' : ''}`, ); break; + case 'shadow-tls': + result += encodeURIComponent( + `shadow-tls;host=${opts.host};password=${opts.password};version=${opts.version}`, + ); + break; default: throw new Error( `Unsupported plugin option: ${proxy.plugin}`,