mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-12 18:19:14 +08:00
fix (proxy-parser): ws-headers with multiple keys are not correctly handled when parsing Surge proxies
closes #120
This commit is contained in:
parent
730986fed4
commit
305ae480bc
6
backend/dist/cron-sync-artifacts.min.js
vendored
6
backend/dist/cron-sync-artifacts.min.js
vendored
File diff suppressed because one or more lines are too long
6
backend/dist/sub-store-parser.loon.min.js
vendored
6
backend/dist/sub-store-parser.loon.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -24,7 +24,7 @@ const grammars = String.raw`
|
|||||||
if (obfs.type === "ws") {
|
if (obfs.type === "ws") {
|
||||||
proxy.network = "ws";
|
proxy.network = "ws";
|
||||||
$set(proxy, "ws-opts.path", obfs.path);
|
$set(proxy, "ws-opts.path", obfs.path);
|
||||||
$set(proxy, "ws-opts.headers.Host", obfs.host);
|
$set(proxy, "ws-opts.headers", obfs['ws-headers']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,8 +158,14 @@ method = comma "encrypt-method" equals cipher:cipher {
|
|||||||
cipher = ("aes-128-gcm"/"aes-192-gcm"/"aes-256-gcm"/"aes-128-cfb"/"aes-192-cfb"/"aes-256-cfb"/"aes-128-ctr"/"aes-192-ctr"/"aes-256-ctr"/"rc4-md5"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none");
|
cipher = ("aes-128-gcm"/"aes-192-gcm"/"aes-256-gcm"/"aes-128-cfb"/"aes-192-cfb"/"aes-256-cfb"/"aes-128-ctr"/"aes-192-ctr"/"aes-256-ctr"/"rc4-md5"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none");
|
||||||
|
|
||||||
ws = comma "ws" equals flag:bool { obfs.type = "ws"; }
|
ws = comma "ws" equals flag:bool { obfs.type = "ws"; }
|
||||||
ws_headers = comma "ws-headers" equals "Host:" host:domain {
|
ws_headers = comma "ws-headers" equals headers:$[^,]+ {
|
||||||
obfs.host = host;
|
const pairs = headers.split("|");
|
||||||
|
const result = {};
|
||||||
|
pairs.forEach(pair => {
|
||||||
|
const [key, value] = pair.trim().split(":");
|
||||||
|
result[key.trim()] = value.trim();
|
||||||
|
})
|
||||||
|
obfs["ws-headers"] = result;
|
||||||
}
|
}
|
||||||
ws_path = comma "ws-path" equals path:uri { obfs.path = path; }
|
ws_path = comma "ws-path" equals path:uri { obfs.path = path; }
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
if (obfs.type === "ws") {
|
if (obfs.type === "ws") {
|
||||||
proxy.network = "ws";
|
proxy.network = "ws";
|
||||||
$set(proxy, "ws-opts.path", obfs.path);
|
$set(proxy, "ws-opts.path", obfs.path);
|
||||||
$set(proxy, "ws-opts.headers.Host", obfs.host);
|
$set(proxy, "ws-opts.headers", obfs['ws-headers']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,8 +156,14 @@ method = comma "encrypt-method" equals cipher:cipher {
|
|||||||
cipher = ("aes-128-gcm"/"aes-192-gcm"/"aes-256-gcm"/"aes-128-cfb"/"aes-192-cfb"/"aes-256-cfb"/"aes-128-ctr"/"aes-192-ctr"/"aes-256-ctr"/"rc4-md5"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none");
|
cipher = ("aes-128-gcm"/"aes-192-gcm"/"aes-256-gcm"/"aes-128-cfb"/"aes-192-cfb"/"aes-256-cfb"/"aes-128-ctr"/"aes-192-ctr"/"aes-256-ctr"/"rc4-md5"/"chacha20-ietf-poly1305"/"chacha20-ietf"/"chacha20-poly1305"/"chacha20"/"none");
|
||||||
|
|
||||||
ws = comma "ws" equals flag:bool { obfs.type = "ws"; }
|
ws = comma "ws" equals flag:bool { obfs.type = "ws"; }
|
||||||
ws_headers = comma "ws-headers" equals "Host:" host:domain {
|
ws_headers = comma "ws-headers" equals headers:$[^,]+ {
|
||||||
obfs.host = host;
|
const pairs = headers.split("|");
|
||||||
|
const result = {};
|
||||||
|
pairs.forEach(pair => {
|
||||||
|
const [key, value] = pair.trim().split(":");
|
||||||
|
result[key.trim()] = value.trim();
|
||||||
|
})
|
||||||
|
obfs["ws-headers"] = result;
|
||||||
}
|
}
|
||||||
ws_path = comma "ws-path" equals path:uri { obfs.path = path; }
|
ws_path = comma "ws-path" equals path:uri { obfs.path = path; }
|
||||||
|
|
||||||
|
6
backend/sub-store.min.js
vendored
6
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user