mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-12 02:09:03 +08:00
fix: Full Config Preprocessor
This commit is contained in:
parent
b9ce4e8f20
commit
38f1728e42
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -51,4 +51,4 @@
|
|||||||
"prettier-plugin-sort-imports": "^1.6.1",
|
"prettier-plugin-sort-imports": "^1.6.1",
|
||||||
"tinyify": "^3.0.0"
|
"tinyify": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -95,22 +95,10 @@ function FullConfig() {
|
|||||||
return /^(\[server_local\]|\[Proxy\])/gm.test(raw);
|
return /^(\[server_local\]|\[Proxy\])/gm.test(raw);
|
||||||
};
|
};
|
||||||
const parse = function (raw) {
|
const parse = function (raw) {
|
||||||
const regex = /^\[server_local]|\[Proxy]/gm;
|
const match = raw.match(
|
||||||
const match = regex.exec(raw);
|
/^\[server_local|Proxy\]([\s\S]+?)^\[.+?\](\r?\n|$)/im,
|
||||||
const results = [];
|
)?.[1];
|
||||||
|
return match || raw;
|
||||||
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');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return { name, test, parse };
|
return { name, test, parse };
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user