From e2011de69e55ebf2dc2eca70a2037e3e7d8d1d7e Mon Sep 17 00:00:00 2001 From: xream Date: Wed, 26 Mar 2025 00:26:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Loon=20=E8=A7=A3=E6=9E=90=E5=99=A8?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8F=82=E6=95=B0=20`resourceUrlOnly`=20?= =?UTF-8?q?=E4=BB=85=E4=BD=BF=E7=94=A8=E8=BF=9C=E7=A8=8B=E8=B5=84=E6=BA=90?= =?UTF-8?q?,=20=E5=BF=BD=E7=95=A5=20Loon=20=E8=87=AA=E8=BA=AB=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/products/resource-parser.loon.js | 41 ++++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/backend/package.json b/backend/package.json index 0b46b8c..a5ac06f 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.19.8", + "version": "2.19.9", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and Shadowrocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/products/resource-parser.loon.js b/backend/src/products/resource-parser.loon.js index 33ed296..ce2a087 100644 --- a/backend/src/products/resource-parser.loon.js +++ b/backend/src/products/resource-parser.loon.js @@ -28,24 +28,28 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : ''; } else { arg = {}; } + console.log(`arg: ${JSON.stringify(arg)}`); const RESOURCE_TYPE = { PROXY: 1, RULE: 2, }; - - result = resource; + if (!arg.resourceUrlOnly) { + result = resource; + } if (resourceType === RESOURCE_TYPE.PROXY) { - try { - let proxies = ProxyUtils.parse(resource); - result = ProxyUtils.produce(proxies, 'Loon', undefined, { - 'include-unsupported-proxy': - arg?.includeUnsupportedProxy || build >= 838, - }); - } catch (e) { - console.log('解析器: 使用 resource 出现错误'); - console.log(e.message ?? e); + if (!arg.resourceUrlOnly) { + try { + let proxies = ProxyUtils.parse(resource); + result = ProxyUtils.produce(proxies, 'Loon', undefined, { + 'include-unsupported-proxy': + arg?.includeUnsupportedProxy || build >= 838, + }); + } catch (e) { + console.log('解析器: 使用 resource 出现错误'); + console.log(e.message ?? e); + } } if ((!result || /^\s*$/.test(result)) && resourceUrl) { console.log(`解析器: 尝试从 ${resourceUrl} 获取订阅`); @@ -62,18 +66,21 @@ let resourceUrl = typeof $resourceUrl !== 'undefined' ? $resourceUrl : ''; ); let proxies = ProxyUtils.parse(raw); result = ProxyUtils.produce(proxies, 'Loon', undefined, { - 'include-unsupported-proxy': arg?.includeUnsupportedProxy, + 'include-unsupported-proxy': + arg?.includeUnsupportedProxy || build >= 838, }); } catch (e) { console.log(e.message ?? e); } } } else if (resourceType === RESOURCE_TYPE.RULE) { - try { - const rules = RuleUtils.parse(resource); - result = RuleUtils.produce(rules, 'Loon'); - } catch (e) { - console.log(e.message ?? e); + if (!arg.resourceUrlOnly) { + try { + const rules = RuleUtils.parse(resource); + result = RuleUtils.produce(rules, 'Loon'); + } catch (e) { + console.log(e.message ?? e); + } } if ((!result || /^\s*$/.test(result)) && resourceUrl) { console.log(`解析器: 尝试从 ${resourceUrl} 获取规则`);