feat: ProxyUtils 新增 JSON5

This commit is contained in:
xream
2025-06-05 11:01:41 +08:00
parent 956fff1b98
commit 6cfcd1c6e2
4 changed files with 22 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.19.60",
"version": "2.19.61",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.",
"main": "src/main.js",
"scripts": {
@@ -27,17 +27,18 @@
"automerge": "1.0.1-preview.7",
"body-parser": "^1.19.0",
"buffer": "^6.0.3",
"dotenv": "^16.4.7",
"connect-history-api-fallback": "^2.0.0",
"cron": "^3.1.6",
"dns-packet": "^5.6.1",
"dotenv": "^16.4.7",
"express": "^4.17.1",
"mime-types": "^2.1.35",
"http-proxy-middleware": "^3.0.3",
"ip-address": "^9.0.5",
"js-base64": "^3.7.2",
"json5": "^2.2.3",
"jsrsasign": "^11.1.0",
"lodash": "^4.17.21",
"mime-types": "^2.1.35",
"ms": "^2.1.3",
"nanoid": "^3.3.3",
"semver": "^7.6.3",

15
backend/pnpm-lock.yaml generated
View File

@@ -34,6 +34,9 @@ importers:
dns-packet:
specifier: ^5.6.1
version: 5.6.1
dotenv:
specifier: ^16.4.7
version: 16.5.0
express:
specifier: ^4.17.1
version: 4.21.2
@@ -46,12 +49,18 @@ importers:
js-base64:
specifier: ^3.7.2
version: 3.7.7
json5:
specifier: ^2.2.3
version: 2.2.3
jsrsasign:
specifier: ^11.1.0
version: 11.1.0
lodash:
specifier: ^4.17.21
version: 4.17.21
mime-types:
specifier: ^2.1.35
version: 2.1.35
ms:
specifier: ^2.1.3
version: 2.1.3
@@ -1655,6 +1664,10 @@ packages:
resolution: {integrity: sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==}
engines: {node: '>=0.4', npm: '>=1.2'}
dotenv@16.5.0:
resolution: {integrity: sha512-m/C+AwOAr9/W1UOIZUo232ejMNnJAJtYQjUbHoNTBNTJSvqzzDh7vnrei3o3r3m9blf6ZoDkvcw0VmozNRFJxg==}
engines: {node: '>=12'}
dunder-proto@1.0.1:
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
@@ -6057,6 +6070,8 @@ snapshots:
domain-browser@1.2.0: {}
dotenv@16.5.0: {}
dunder-proto@1.0.1:
dependencies:
call-bind-apply-helpers: 1.0.1

View File

@@ -25,6 +25,7 @@ import { getFlag, removeFlag, getISO, MMDB } from '@/utils/geo';
import Gist from '@/utils/gist';
import { isPresent } from './producers/utils';
import { doh } from '@/utils/dns';
import JSON5 from 'json5';
function preprocess(raw) {
for (const processor of PROXY_PREPROCESSORS) {
@@ -347,6 +348,7 @@ export const ProxyUtils = {
doh,
Buffer,
Base64,
JSON5,
};
function tryParse(parser, line) {

View File

@@ -133,6 +133,7 @@ function operator(proxies = [], targetPlatform, context) {
// isValidUUID, // 辅助判断是否为有效的 UUID
// Buffer, // https://github.com/feross/buffer
// Base64, // https://github.com/dankogai/js-base64
// JSON5, // https://github.com/json5/json5
// }
// 为兼容 https://github.com/xishang0128/sparkle 的 JavaScript 覆写, 也可以直接使用 `b64d`(Base64 解码), `b64e`(Base64 编码), `Buffer`, `yaml`(简单兼容了下 `yaml.parse` 和 `yaml.stringify`)