From f9e0d1146c1601d734886c26de6b4c848a3d85ac Mon Sep 17 00:00:00 2001 From: Orion Date: Wed, 3 Jun 2026 16:09:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D(substore):=20?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E7=89=B9=E5=BE=81=E5=B0=BE=E5=8F=B7=E5=92=8C?= =?UTF-8?q?=20HY2=20=E8=AF=AF=E5=88=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- substore/README.md | 2 +- substore/alphaair-rename.js | 2 +- substore/common.js | 14 ++++++++++++-- substore/liangxin-rename.js | 2 +- substore/peiqian-rename.js | 2 +- substore/rename.js | 11 +++++++++-- substore/sntp-rename.js | 2 +- substore/yuetong-rename.js | 2 +- 8 files changed, 27 insertions(+), 10 deletions(-) diff --git a/substore/README.md b/substore/README.md index f432bb2..57213b2 100644 --- a/substore/README.md +++ b/substore/README.md @@ -5,7 +5,7 @@ `common.js` 是公共工具库,各处理脚本会按下面的 raw 地址自动加载: ```text -https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5 +https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6 ``` ## 推荐使用顺序 diff --git a/substore/alphaair-rename.js b/substore/alphaair-rename.js index a37716d..dc31823 100644 --- a/substore/alphaair-rename.js +++ b/substore/alphaair-rename.js @@ -6,7 +6,7 @@ * - 不追加订阅后缀,整合订阅最后仍交给 rename.js 处理 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' ); diff --git a/substore/common.js b/substore/common.js index 8f4ce27..ae08db7 100644 --- a/substore/common.js +++ b/substore/common.js @@ -2,7 +2,7 @@ * Sub-Store 节点命名公共工具 * * 远程引用地址: - * https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5 + * https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6 */ (function (root) { const regexSpecialChars = new Set(['.', '*', '+', '?', '^', '$', '{', '}', '(', ')', '|', '[', ']', '\\']); @@ -206,8 +206,18 @@ match, prefix, regionCode, - sequenceNumber + sequenceNumber, + offset, + input ) => { + if ( + prefix === ' ' && + offset > 1 && + /^[A-Z]{2}$/.test(input.slice(offset - 2, offset)) + ) { + return match; + } + return `${prefix}${regionCode} ${sequenceNumber.padStart(2, '0')}`; }) .replace(new RegExp(`(\\b${regionPattern} \\d{2})-\\s*(?=\\d+(?:\\.\\d+)?X\\b)`, 'g'), '$1 ') diff --git a/substore/liangxin-rename.js b/substore/liangxin-rename.js index f8c2872..6c9a9a2 100644 --- a/substore/liangxin-rename.js +++ b/substore/liangxin-rename.js @@ -3,7 +3,7 @@ * 负责去掉高速、BGP、CMCU 等 LiangXin 线路描述,保留地区、序号和倍率。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' ); diff --git a/substore/peiqian-rename.js b/substore/peiqian-rename.js index 8c0d48f..96efe3d 100644 --- a/substore/peiqian-rename.js +++ b/substore/peiqian-rename.js @@ -3,7 +3,7 @@ * 负责清理推荐、用途、hy2、倍率、线路特征和提供商等 PeiQian 节点文案。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' ); diff --git a/substore/rename.js b/substore/rename.js index 84e55d8..71e7166 100644 --- a/substore/rename.js +++ b/substore/rename.js @@ -5,7 +5,7 @@ * - 基于归一化后的完整名称做精准去重 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' ); @@ -674,6 +674,11 @@ async function operator(proxies) { const normalizeRegionSequence = name => utils.normalizeRegionSequence(name, { allowCityCode: true }); + const stripTrailingFeatureSequence = name => String(name) + .replace(/^([A-Z]{2}(?:\s+[A-Z]{3})?)\s+([A-Z][A-Z0-9.]{1,15})\s+\d{1,2}$/i, '$1 $2') + .replace(/\s{2,}/g, ' ') + .trim(); + const regionSequenceOf = name => { const sequenceMatch = name.match(/^((?:[\u{1F1E6}-\u{1F1FF}]{2}|🏴‍☠️)\s*)?([A-Z]{2}(?:\s+[A-Z]{3})?)(?:\s+(\d{2}))?(\s.*)?$/u); if (!sequenceMatch) return null; @@ -780,7 +785,9 @@ async function operator(proxies) { core = joinAlias(flagRegionCode, core); } - core = normalizeRegionSequence(normalizeHyphenatedRegionFeatures(moveMultiplierToEnd(simplifyCoreName(core)))) + core = stripTrailingFeatureSequence( + normalizeRegionSequence(normalizeHyphenatedRegionFeatures(moveMultiplierToEnd(simplifyCoreName(core)))) + ) .replace(/^([A-Z]{2}(?:\s+[A-Z]{3})?\s+\d{2}\s+(?:标准|高级))\s+1(?=$|\s)/i, '$1'); const coreRegionCode = leadingCodeOf(core); diff --git a/substore/sntp-rename.js b/substore/sntp-rename.js index 09d34d6..69dd517 100644 --- a/substore/sntp-rename.js +++ b/substore/sntp-rename.js @@ -4,7 +4,7 @@ * 维护说明:仅需修改 featureMap 字典即可,底部逻辑永远无需改动。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' ); diff --git a/substore/yuetong-rename.js b/substore/yuetong-rename.js index ae9cf1c..82bf35e 100644 --- a/substore/yuetong-rename.js +++ b/substore/yuetong-rename.js @@ -4,7 +4,7 @@ * 按地区稳定归并后重新连续编号,避免专属/普通节点撞号。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-6'; const hasCurrentRenameUtils = utils => Boolean( utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' );