diff --git a/backend/package.json b/backend/package.json index e97b5cc..870884f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.45", + "version": "2.19.46", "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 d9145bf..fbe6e35 100644 --- a/backend/src/core/proxy-utils/preprocessors/index.js +++ b/backend/src/core/proxy-utils/preprocessors/index.js @@ -50,6 +50,26 @@ function Base64Encoded() { return { name, test, parse }; } +function fallbackBase64Encoded() { + const name = 'Fallback Base64 Pre-processor'; + + const test = function (raw) { + return true; + }; + const parse = function (raw) { + const decoded = Base64.decode(raw); + if (!/^\w+(:\/\/|\s*?=\s*?)\w+/m.test(decoded)) { + $.error( + `Fallback Base64 Pre-processor error: decoded line does not start with protocol`, + ); + return raw; + } + + return decoded; + }; + return { name, test, parse }; +} + function Clash() { const name = 'Clash Pre-processor'; const test = function (raw) { @@ -163,4 +183,11 @@ function FullConfig() { return { name, test, parse }; } -export default [HTML(), Clash(), Base64Encoded(), SSD(), FullConfig()]; +export default [ + HTML(), + Clash(), + Base64Encoded(), + SSD(), + FullConfig(), + fallbackBase64Encoded(), +];