diff --git a/backend/package.json b/backend/package.json index d5a3491..c4eb022 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.0", + "version": "2.14.1", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { @@ -51,4 +51,4 @@ "prettier-plugin-sort-imports": "^1.6.1", "tinyify": "^3.0.0" } -} +} \ No newline at end of file diff --git a/backend/src/core/proxy-utils/preprocessors/index.js b/backend/src/core/proxy-utils/preprocessors/index.js index 6b48f1a..35b2402 100644 --- a/backend/src/core/proxy-utils/preprocessors/index.js +++ b/backend/src/core/proxy-utils/preprocessors/index.js @@ -95,22 +95,10 @@ function FullConfig() { return /^(\[server_local\]|\[Proxy\])/gm.test(raw); }; const parse = function (raw) { - const regex = /^\[server_local]|\[Proxy]/gm; - const match = regex.exec(raw); - const results = []; - - let first = true; - if (match) { - raw = raw.substring(match.index); - for (const line of raw.split('\n')) { - if (!first && !line.test(/^\s*\[/)) { - results.push(line); - } - // skip the first line - first = false; - } - return results.join('\n'); - } + const match = raw.match( + /^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im, + )?.[1]; + return match || raw; }; return { name, test, parse }; }