From 8c3fc5767db22d303d6f1b89766766af09f9dbbe Mon Sep 17 00:00:00 2001 From: xream Date: Sun, 25 Oct 2026 09:40:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20AnyTLS=20=E9=87=8D=E5=A4=8D=E8=A7=A3?= =?UTF-8?q?=E7=A0=81=E5=AF=86=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/core/proxy-utils/parsers/index.js | 1 - backend/src/test/proxy-producers/text.spec.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/backend/src/core/proxy-utils/parsers/index.js b/backend/src/core/proxy-utils/parsers/index.js index e4461814..0be4f9c5 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -2130,7 +2130,6 @@ function URI_AnyTLS() { // eslint-disable-next-line no-unused-vars let [__, password, server, port, addons = '', name] = /^(.*?)@(.*?)(?::(\d+))?\/?(?:\?(.*?))?(?:#(.*?))?$/.exec(line); - password = decodeURIComponent(password); port = parseInt(`${port}`, 10); if (isNaN(port)) { port = 443; diff --git a/backend/src/test/proxy-producers/text.spec.js b/backend/src/test/proxy-producers/text.spec.js index e5bfe41b..1d08ecf5 100644 --- a/backend/src/test/proxy-producers/text.spec.js +++ b/backend/src/test/proxy-producers/text.spec.js @@ -5817,6 +5817,23 @@ describe('Proxy text producers', function () { expect(parsed.password).to.equal('p@ss:w/rd#1?'); }); + for (const password of ['p%40ss', 'p%ss']) { + it(`round-trips the URI AnyTLS password ${password}`, function () { + const output = produceExternal('URI', { + type: 'anytls', + name: 'URI AnyTLS Password', + server: 'anytls.example.com', + port: 443, + password, + sni: 'anytls.example.com', + }); + + const parsed = ProxyUtils.parse(output); + expect(parsed).to.have.length(1); + expect(parsed[0].password).to.equal(password); + }); + } + it('produces URI Trojan links with vcn from the sidecar', function () { const output = produceExternal('URI', { type: 'trojan',