From 589a6bfadb422b69b1bff13e7edb739f2894815a Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 8 Jan 2025 20:13:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Base64=20Pre-processor=20=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E8=A7=A3=E7=A0=81=E6=98=AF=E5=90=A6=E6=AD=A3=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/preprocessors/index.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/package.json b/backend/package.json index e470960d4..867eea7fe 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.16.4", + "version": "2.16.5", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/preprocessors/index.js b/backend/src/core/proxy-utils/preprocessors/index.js index 6067b1e76..5ad08992d 100644 --- a/backend/src/core/proxy-utils/preprocessors/index.js +++ b/backend/src/core/proxy-utils/preprocessors/index.js @@ -1,5 +1,6 @@ import { safeLoad } from '@/utils/yaml'; import { Base64 } from 'js-base64'; +import $ from '@/core/app'; function HTML() { const name = 'HTML'; @@ -35,8 +36,15 @@ function Base64Encoded() { ); }; const parse = function (raw) { - raw = Base64.decode(raw); - return raw; + const decoded = Base64.decode(raw); + if (!/^\w+:\/\/\w+/m.test(decoded)) { + $.error( + `Base64 Pre-processor error: decoded line does not start with protocol`, + ); + return raw; + } + + return decoded; }; return { name, test, parse }; }