From 9344dc64b07bede3d76d37ef10fe7f55a65c2580 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 8 Jan 2024 09:44:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=BC=E5=AE=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=B8=8D=E5=B8=A6=E8=8A=82=E7=82=B9=E5=90=8D=E7=9A=84=20URI?= 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 | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/backend/package.json b/backend/package.json index ae3382f..6fa4aa6 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.142", + "version": "2.14.143", "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 02f88dc..c33306e 100644 --- a/backend/src/core/proxy-utils/parsers/index.js +++ b/backend/src/core/proxy-utils/parsers/index.js @@ -333,10 +333,13 @@ function URI_VLESS() { line = line.split('vless://')[1]; // eslint-disable-next-line no-unused-vars let [__, uuid, server, port, ___, addons = '', name] = - /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))$/.exec(line); + /^(.*?)@(.*?):(\d+)\/?(\?(.*?))?(?:#(.*?))?$/.exec(line); port = parseInt(`${port}`, 10); uuid = decodeURIComponent(uuid); - name = decodeURIComponent(name) ?? `VLESS ${server}:${port}`; + if (name != null) { + name = decodeURIComponent(name); + } + name = name ?? `VLESS ${server}:${port}`; const proxy = { type: 'vless', name, @@ -415,13 +418,16 @@ function URI_Hysteria2() { line = line.split(/(hysteria2|hy2):\/\//)[2]; // eslint-disable-next-line no-unused-vars let [__, password, server, ___, port, ____, addons = '', name] = - /^(.*?)@(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))$/.exec(line); + /^(.*?)@(.*?)(:(\d+))?\/?(\?(.*?))?(?:#(.*?))?$/.exec(line); port = parseInt(`${port}`, 10); if (isNaN(port)) { port = 443; } password = decodeURIComponent(password); - name = decodeURIComponent(name) ?? `Hysteria2 ${server}:${port}`; + if (name != null) { + name = decodeURIComponent(name); + } + name = name ?? `Hysteria2 ${server}:${port}`; const proxy = { type: 'hysteria2',