diff --git a/backend/package.json b/backend/package.json index 2abbdc5c..39eab8c5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.21.69", + "version": "2.21.70", "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 697066d6..79f16016 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -287,8 +287,14 @@ function URI_SS() { ).split(';'); const params = {}; for (const item of pluginInfo) { - const [key, val] = item.split('='); - if (key) params[key] = val || true; // some options like "tls" will not have value + const separatorIndex = item.indexOf('='); + if (separatorIndex === -1) { + if (item) params[item] = true; // some options like "tls" will not have value + continue; + } + const key = item.slice(0, separatorIndex); + const val = item.slice(separatorIndex + 1).replace(/\\=/g, '='); + if (key) params[key] = val || true; } switch (params.plugin) { case 'obfs-local': @@ -308,6 +314,8 @@ function URI_SS() { getIfNotBlank(params['host']), path: getIfNotBlank(params.path), tls: getIfPresent(params.tls), + // mux 目前有问题 v2rayN 有 bug...开了 mux 导出时也是 0, 如果改成 1 导入它就报错 + // 有需求的自己用脚本操作吧 }; break; case 'shadow-tls': { diff --git a/backend/src/test/proxy-parsers/uri.spec.js b/backend/src/test/proxy-parsers/uri.spec.js index 9a3482bf..8fd98705 100644 --- a/backend/src/test/proxy-parsers/uri.spec.js +++ b/backend/src/test/proxy-parsers/uri.spec.js @@ -97,6 +97,33 @@ describe('Proxy URI parser coverage', function () { }); }); + it('parses v2ray-plugin paths containing escaped equals signs', function () { + const userInfo = encodeURIComponent( + Base64.encode('aes-128-gcm:secret'), + ); + const plugin = encodeURIComponent( + 'v2ray-plugin;mode=websocket;host=cdn.example.com;path=/?enc\\=aes-128-gcm', + ); + const proxy = parseOne( + `ss://${userInfo}@ss.example.com:8080?plugin=${plugin}#SS%20Escaped%20Path`, + ); + + expectSubset(proxy, { + type: 'ss', + name: 'SS Escaped Path', + server: 'ss.example.com', + port: 8080, + cipher: 'aes-128-gcm', + password: 'secret', + plugin: 'v2ray-plugin', + 'plugin-opts': { + mode: 'websocket', + host: 'cdn.example.com', + path: '/?enc=aes-128-gcm', + }, + }); + }); + it('parses shadowsocks shadow-tls compatibility payloads', function () { const userInfo = Base64.encode('aes-256-gcm:shadow-pass'); const payload = Base64.encode(