feat: 兼容某些格式的 Trojan URI(首个 # 之后的字符串均视为节点名称)

This commit is contained in:
xream 2023-11-13 18:49:50 +08:00
parent ea88cc1794
commit 9c78b87834
No known key found for this signature in database
GPG Key ID: 1D2C5225471789F9
2 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.86",
"version": "2.14.87",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {

View File

@ -463,8 +463,16 @@ function URI_Trojan() {
};
const parse = (line) => {
let [newLine, name] = line.split(/#(.+)/, 2);
const parser = getTrojanURIParser();
const proxy = parser.parse(line);
const proxy = parser.parse(newLine);
if (isNotBlank(name)) {
try {
proxy.name = decodeURIComponent(name);
} catch (e) {
console.log(e);
}
}
return proxy;
};
return { name, test, parse };