mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-06-04 11:13:59 +08:00
feat: Loon 解析器支持参数 resourceUrlOnly
仅使用远程资源, 忽略 Loon 自身解析数据
This commit is contained in:
parent
9568f4d6d9
commit
e2011de69e
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.19.8",
|
"version": "2.19.9",
|
||||||
"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": {
|
||||||
|
@ -28,15 +28,18 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
} else {
|
} else {
|
||||||
arg = {};
|
arg = {};
|
||||||
}
|
}
|
||||||
|
console.log(`arg: ${JSON.stringify(arg)}`);
|
||||||
|
|
||||||
const RESOURCE_TYPE = {
|
const RESOURCE_TYPE = {
|
||||||
PROXY: 1,
|
PROXY: 1,
|
||||||
RULE: 2,
|
RULE: 2,
|
||||||
};
|
};
|
||||||
|
if (!arg.resourceUrlOnly) {
|
||||||
result = resource;
|
result = resource;
|
||||||
|
}
|
||||||
|
|
||||||
if (resourceType === RESOURCE_TYPE.PROXY) {
|
if (resourceType === RESOURCE_TYPE.PROXY) {
|
||||||
|
if (!arg.resourceUrlOnly) {
|
||||||
try {
|
try {
|
||||||
let proxies = ProxyUtils.parse(resource);
|
let proxies = ProxyUtils.parse(resource);
|
||||||
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
||||||
@ -47,6 +50,7 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
console.log('解析器: 使用 resource 出现错误');
|
console.log('解析器: 使用 resource 出现错误');
|
||||||
console.log(e.message ?? e);
|
console.log(e.message ?? e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
||||||
console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`);
|
console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`);
|
||||||
try {
|
try {
|
||||||
@ -62,19 +66,22 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : '';
|
|||||||
);
|
);
|
||||||
let proxies = ProxyUtils.parse(raw);
|
let proxies = ProxyUtils.parse(raw);
|
||||||
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
result = ProxyUtils.produce(proxies, 'Loon', undefined, {
|
||||||
'include-unsupported-proxy': arg?.includeUnsupportedProxy,
|
'include-unsupported-proxy':
|
||||||
|
arg?.includeUnsupportedProxy || build >= 838,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.message ?? e);
|
console.log(e.message ?? e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (resourceType === RESOURCE_TYPE.RULE) {
|
} else if (resourceType === RESOURCE_TYPE.RULE) {
|
||||||
|
if (!arg.resourceUrlOnly) {
|
||||||
try {
|
try {
|
||||||
const rules = RuleUtils.parse(resource);
|
const rules = RuleUtils.parse(resource);
|
||||||
result = RuleUtils.produce(rules, 'Loon');
|
result = RuleUtils.produce(rules, 'Loon');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.message ?? e);
|
console.log(e.message ?? e);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
if ((!result || /^\s*$/.test(result)) && resourceUrl) {
|
||||||
console.log(`解析器: 尝试从 ${resourceUrl} 获取规则`);
|
console.log(`解析器: 尝试从 ${resourceUrl} 获取规则`);
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user