diff --git a/backend/package.json b/backend/package.json index 04617db..43e836c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.75", + "version": "2.19.76", "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/peggy/surge.js b/backend/src/core/proxy-utils/parsers/peggy/surge.js index 8491732..0892b2a 100644 --- a/backend/src/core/proxy-utils/parsers/peggy/surge.js +++ b/backend/src/core/proxy-utils/parsers/peggy/surge.js @@ -212,11 +212,11 @@ ws_headers = comma "ws-headers" equals headers:$[^,]+ { const result = {}; pairs.forEach(pair => { const [key, value] = pair.trim().split(":"); - result[key.trim()] = value.trim(); + result[key.trim()] = value.trim().trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }) 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.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; }; diff --git a/backend/src/core/proxy-utils/parsers/peggy/surge.peg b/backend/src/core/proxy-utils/parsers/peggy/surge.peg index e840145..bec68fd 100644 --- a/backend/src/core/proxy-utils/parsers/peggy/surge.peg +++ b/backend/src/core/proxy-utils/parsers/peggy/surge.peg @@ -209,11 +209,11 @@ ws_headers = comma "ws-headers" equals headers:$[^,]+ { const result = {}; pairs.forEach(pair => { const [key, value] = pair.trim().split(":"); - result[key.trim()] = value.trim(); + result[key.trim()] = value.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); }) 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.trim().replace(/^"(.*?)"$/, '$1').replace(/^'(.*?)'$/, '$1'); } obfs = comma "obfs" equals type:("http"/"tls") { obfs.type = type; } obfs_host = comma "obfs-host" equals host:domain { obfs.host = host; };