mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
fix: Full config preprocessor bug
This commit is contained in:
@@ -95,10 +95,21 @@ function FullConfig() {
|
||||
return /^(\[server_local\]|\[Proxy\])/gm.test(raw);
|
||||
};
|
||||
const parse = function (raw) {
|
||||
const regex = /^(\[server_local\]|\[Proxy\])\n?((.|\n)*?)\[/gm;
|
||||
const result = regex.exec(raw);
|
||||
if (result) {
|
||||
return result[2] || '';
|
||||
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');
|
||||
}
|
||||
};
|
||||
return { name, test, parse };
|
||||
|
||||
Reference in New Issue
Block a user