fix: 修复 password 为数字时的 bug

This commit is contained in:
xream
2024-09-16 01:43:16 +08:00
parent c63d9a304e
commit abf3c84cd4
3 changed files with 12 additions and 1 deletions

View File

@@ -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": {

View File

@@ -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;

View File

@@ -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,
};