From b3f6876bbd8a2d6cae8cab8a35474d646512d246 Mon Sep 17 00:00:00 2001 From: xream Date: Sun, 11 May 2025 16:21:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=20xishang0128/sparkl?= =?UTF-8?q?e=20=E7=9A=84=20JavaScript=20=E8=A6=86=E5=86=99;=20ProxyUtils?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9E=20Buffer,=20Base64?= 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 | 3 +++ backend/src/core/proxy-utils/processors/index.js | 16 ++++++++++++++++ backend/src/utils/yaml.js | 2 ++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/backend/package.json b/backend/package.json index 44ec36e..5fcfdac 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.37", + "version": "2.19.38", "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 91218ec..86474e5 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -1,3 +1,4 @@ +import { Base64 } from 'js-base64'; import { Buffer } from 'buffer'; import rs from '@/utils/rs'; import YAML from '@/utils/yaml'; @@ -333,6 +334,8 @@ export const ProxyUtils = { downloadFile, isValidUUID, doh, + Buffer, + Base64, }; function tryParse(parser, line) { diff --git a/backend/src/core/proxy-utils/processors/index.js b/backend/src/core/proxy-utils/processors/index.js index a155d36..58f2ec5 100644 --- a/backend/src/core/proxy-utils/processors/index.js +++ b/backend/src/core/proxy-utils/processors/index.js @@ -1141,6 +1141,10 @@ function createDynamicFunction(name, script, $arguments, $options) { '$httpClient', '$notification', 'ProxyUtils', + 'yaml', + 'Buffer', + 'b64d', + 'b64e', 'scriptResourceCache', 'flowUtils', 'produceArtifact', @@ -1158,6 +1162,10 @@ function createDynamicFunction(name, script, $arguments, $options) { // eslint-disable-next-line no-undef $notification, ProxyUtils, + ProxyUtils.yaml, + ProxyUtils.Buffer, + ProxyUtils.Base64.decode, + ProxyUtils.Base64.encode, scriptResourceCache, flowUtils, produceArtifact, @@ -1170,6 +1178,10 @@ function createDynamicFunction(name, script, $arguments, $options) { '$substore', 'lodash', 'ProxyUtils', + 'yaml', + 'Buffer', + 'b64d', + 'b64e', 'scriptResourceCache', 'flowUtils', 'produceArtifact', @@ -1181,6 +1193,10 @@ function createDynamicFunction(name, script, $arguments, $options) { $, lodash, ProxyUtils, + ProxyUtils.yaml, + ProxyUtils.Buffer, + ProxyUtils.Base64.decode, + ProxyUtils.Base64.encode, scriptResourceCache, flowUtils, produceArtifact, diff --git a/backend/src/utils/yaml.js b/backend/src/utils/yaml.js index 9ea9c0e..c09b8c4 100644 --- a/backend/src/utils/yaml.js +++ b/backend/src/utils/yaml.js @@ -34,4 +34,6 @@ export default { load, safeDump, dump, + parse: safeLoad, + stringify: safeDump, };