From 47849dc6d083cb037b193ff990207e69aa65c3f1 Mon Sep 17 00:00:00 2001 From: xream Date: Thu, 30 May 2024 04:28:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=8A=82=E7=82=B9=E4=B8=8A=E7=9A=84?= =?UTF-8?q?=E9=A2=9D=E5=A4=96=E5=8F=82=E6=95=B0=E8=B0=83=E6=95=B4=E4=B8=BA?= =?UTF-8?q?=E4=B8=8B=E5=88=92=E7=BA=BF=E5=BC=80=E5=A4=B4,=20=E5=8E=9F?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=9B=AE=E5=89=8D=E4=BB=8D=E4=BF=9D=E7=95=99?= =?UTF-8?q?,=20=E8=8B=A5=E6=9C=89=E8=84=9A=E6=9C=AC=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=BF=99=E4=BA=9B=E5=8F=82=E6=95=B0=E8=AF=B7?= =?UTF-8?q?=E5=B0=BD=E5=BF=AB=E4=BF=AE=E6=94=B9(=5FsubName,=20=5Fcollectio?= =?UTF-8?q?nName,=20=5Fresolved)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/package.json | 2 +- backend/src/core/proxy-utils/index.js | 4 ++++ backend/src/utils/geo.js | 10 ++++++++++ scripts/demo.js | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/backend/package.json b/backend/package.json index a7e5bf28b..88225d0e5 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "sub-store", - "version": "2.14.320", + "version": "2.14.321", "description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.", "main": "src/main.js", "scripts": { diff --git a/backend/src/core/proxy-utils/index.js b/backend/src/core/proxy-utils/index.js index 418027339..eac7ae645 100644 --- a/backend/src/core/proxy-utils/index.js +++ b/backend/src/core/proxy-utils/index.js @@ -199,6 +199,10 @@ function produce(proxies, targetPlatform, type, opts = {}) { ); proxies = proxies.map((proxy) => { + proxy._subName = proxy.subName; + proxy._collectionName = proxy.collectionName; + proxy._resolved = proxy.resolved; + if (!isNotBlank(proxy.name)) { proxy.name = `${proxy.type} ${proxy.server}:${proxy.port}`; } diff --git a/backend/src/utils/geo.js b/backend/src/utils/geo.js index 29b222c94..71ad888c4 100644 --- a/backend/src/utils/geo.js +++ b/backend/src/utils/geo.js @@ -438,11 +438,21 @@ export class MMDB { const countryFile = country || eval('process.env.SUB_STORE_MMDB_COUNTRY_PATH'); const asnFile = asn || eval('process.env.SUB_STORE_MMDB_ASN_PATH'); + // $.info( + // `GeoLite2 Country MMDB: ${countryFile}, exists: ${fs.existsSync( + // countryFile, + // )}`, + // ); if (countryFile) { this.countryReader = Reader.openBuffer( fs.readFileSync(countryFile), ); } + // $.info( + // `GeoLite2 ASN MMDB: ${asnFile}, exists: ${fs.existsSync( + // asnFile, + // )}`, + // ); if (asnFile) { if (!fs.existsSync(asnFile)) throw new Error('GeoLite2 ASN MMDB does not exist'); diff --git a/scripts/demo.js b/scripts/demo.js index 508b7f6b5..92b879b4d 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -8,9 +8,11 @@ function operator(proxies = [], targetPlatform, context) { // 结构大致参考了 Clash.Meta(mihomo) 有私货 // 可在预览界面点击节点查看 JSON 结构 或查看 `target=JSON` 的通用订阅 // 1. `no-resolve` 为不解析域名 - // 2. 域名解析后 会多一个 `resolved` 字段 + // 2. 域名解析后 会多一个 `_resolved` 字段 // 3. 域名解析后会有`_IPv4`, `_IPv6`, `_IP`(若有多个步骤, 只取第一次成功的 v4 或 v6 数据), `_domain` 字段 // 4. 节点字段 `exec` 为 `ssr-local` 路径, 默认 `/usr/local/bin/ssr-local`; 端口从 10000 开始递增(暂不支持配置) + // 5. `_subName` 为单条订阅名 + // 6. `_collectionName` 为组合订阅名 // $arguments 为传入的脚本参数