mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2026-11-30 08:28:10 +00:00
fix: 支持 plugin 参数中 \= 这种转义形式
This commit is contained in:
3 files changed
+38
-3
No files matched your search
@@ -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": {
|
||||
|
||||
@@ -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': {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user