From cc556b641d32f5af571101cd825d76f8506a0855 Mon Sep 17 00:00:00 2001 From: xream Date: Mon, 16 Sep 2024 01:43:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20password=20?= =?UTF-8?q?=E4=B8=BA=E6=95=B0=E5=AD=97=E6=97=B6=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/index.js | 4 ++++ backend/src/utils/index.js | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 1ae453726..7b9b0da7a 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.382", + "version": "2.14.383", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js index 57e0f88df..1e2f04ec3 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -9,6 +9,7 @@ import { isNotBlank, ipAddress, getRandomPort, + numberToString, } from '@/utils'; import PROXY_PROCESSORS, { ApplyProcessor } from './processors'; import PROXY_PREPROCESSORS from './preprocessors'; @@ -327,6 +328,9 @@ function formatTransportPath(path) { } function lastParse(proxy) { + if (typeof proxy.password === 'number') { + proxy.password = numberToString(proxy.password); + } if (proxy.interface) { proxy['interface-name'] = proxy.interface; delete proxy.interface; diff --git a/backend/src/utils/index.js b/backend/src/utils/index.js index 9b74698cf..8330beaaa 100644 --- a/backend/src/utils/index.js +++ b/backend/src/utils/index.js @@ -111,6 +111,12 @@ function getRandomPort(portString) { } } +function numberToString(value) { + return Number.isSafeInteger(value) + ? String(value) + : BigInt(value).toString(); +} + export { ipAddress, isIPv4, @@ -123,4 +129,5 @@ export { // utf8ArrayToStr, getPolicyDescriptor, getRandomPort, + numberToString, };