Skip to content

Commit

Permalink
fix: 修复 password 为数字时的 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Sep 15, 2024
1 parent de2813b commit cc556b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions backend/src/core/proxy-utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
isNotBlank,
ipAddress,
getRandomPort,
numberToString,
} from '@/utils';
import PROXY_PROCESSORS, { ApplyProcessor } from './processors';
import PROXY_PREPROCESSORS from './preprocessors';
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions backend/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ function getRandomPort(portString) {
}
}

function numberToString(value) {
return Number.isSafeInteger(value)
? String(value)
: BigInt(value).toString();
}

export {
ipAddress,
isIPv4,
Expand All @@ -123,4 +129,5 @@ export {
// utf8ArrayToStr,
getPolicyDescriptor,
getRandomPort,
numberToString,
};

0 comments on commit cc556b6

Please sign in to comment.