mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-12 19:49:10 +08:00
fix: Full config preprocessor bug
This commit is contained in:
parent
07cae95ff4
commit
2ee515dc23
6
backend/dist/cron-sync-artifacts.min.js
vendored
6
backend/dist/cron-sync-artifacts.min.js
vendored
File diff suppressed because one or more lines are too long
6
backend/dist/sub-store-parser.loon.min.js
vendored
6
backend/dist/sub-store-parser.loon.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.8.1",
|
"version": "2.8.2",
|
||||||
"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": {
|
||||||
|
@ -95,10 +95,21 @@ 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\])\n?((.|\n)*?)\[/gm;
|
const regex = /^\[server_local]|\[Proxy]/gm;
|
||||||
const result = regex.exec(raw);
|
const match = regex.exec(raw);
|
||||||
if (result) {
|
const results = [];
|
||||||
return result[2] || '';
|
|
||||||
|
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 };
|
||||||
|
@ -41,13 +41,27 @@ async function getFlowInfo(req, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (sub.source === 'local') {
|
if (sub.source === 'local') {
|
||||||
failed(res, new RequestInvalidError('NO_FLOW_INFO', 'N/A'));
|
failed(
|
||||||
|
res,
|
||||||
|
new RequestInvalidError(
|
||||||
|
'NO_FLOW_INFO',
|
||||||
|
'N/A',
|
||||||
|
`Local subscription ${name} has no flow information!`,
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const flowHeaders = await getFlowHeaders(sub.url);
|
const flowHeaders = await getFlowHeaders(sub.url);
|
||||||
if (!flowHeaders) {
|
if (!flowHeaders) {
|
||||||
failed(res, new InternalServerError('NO_FLOW_INFO', 'N/A'));
|
failed(
|
||||||
|
res,
|
||||||
|
new InternalServerError(
|
||||||
|
'NO_FLOW_INFO',
|
||||||
|
'No flow info',
|
||||||
|
`Failed to fetch flow headers`,
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
backend/sub-store.min.js
vendored
6
backend/sub-store.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user