Skip to content

Commit cc556b6

Browse files
committed
fix: 修复 password 为数字时的 bug
1 parent de2813b commit cc556b6

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎backend/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store",
3-
"version": "2.14.382",
3+
"version": "2.14.383",
44
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
55
"main": "src/main.js",
66
"scripts": {

‎backend/src/core/proxy-utils/index.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
isNotBlank,
1010
ipAddress,
1111
getRandomPort,
12+
numberToString,
1213
} from '@/utils';
1314
import PROXY_PROCESSORS, { ApplyProcessor } from './processors';
1415
import PROXY_PREPROCESSORS from './preprocessors';
@@ -327,6 +328,9 @@ function formatTransportPath(path) {
327328
}
328329

329330
function lastParse(proxy) {
331+
if (typeof proxy.password === 'number') {
332+
proxy.password = numberToString(proxy.password);
333+
}
330334
if (proxy.interface) {
331335
proxy['interface-name'] = proxy.interface;
332336
delete proxy.interface;

‎backend/src/utils/index.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ function getRandomPort(portString) {
111111
}
112112
}
113113

114+
function numberToString(value) {
115+
return Number.isSafeInteger(value)
116+
? String(value)
117+
: BigInt(value).toString();
118+
}
119+
114120
export {
115121
ipAddress,
116122
isIPv4,
@@ -123,4 +129,5 @@ export {
123129
// utf8ArrayToStr,
124130
getPolicyDescriptor,
125131
getRandomPort,
132+
numberToString,
126133
};

0 commit comments

Comments
 (0)