From 9d90369594f547d35d149218da088b29b69656f0 Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 28 Nov 2024 13:15:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Trojan=20URI=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9C=81=E7=95=A5=E7=AB=AF=E5=8F=A3=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/parsers/index.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 4f13f67ac..0c8fb8b2c 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.428", + "version": "2.14.429", "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 070089836..55e03b3e4 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -842,6 +842,11 @@ function URI_Trojan() { }; const parse = (line) => { + const matched = /^(trojan:\/\/.*?@.*?)(:(\d+))?\/?(\?.*?)?$/.exec(line); + const port = matched?.[2]; + if (!port) { + line = line.replace(matched[1], `${matched[1]}:443`); + } let [newLine, name] = line.split(/#(.+)/, 2); const parser = getTrojanURIParser(); const proxy = parser.parse(newLine);