mirror of
https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-10 00:52:40 +00:00
perf: Allow using full configuration as subscription source
Supported configuration formats: Loon, QX, and Surge closes #121
This commit is contained in:
@@ -89,4 +89,19 @@ function SSD() {
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
||||
export default [HTML(), Base64Encoded(), Clash(), SSD()];
|
||||
function FullConfig() {
|
||||
const name = 'Full Config Preprocessor';
|
||||
const test = function (raw) {
|
||||
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] || '';
|
||||
}
|
||||
};
|
||||
return { name, test, parse };
|
||||
}
|
||||
|
||||
export default [HTML(), Base64Encoded(), Clash(), SSD(), FullConfig()];
|
||||
|
||||
Reference in New Issue
Block a user