diff --git a/substore/README.md b/substore/README.md index cd74603..f432bb2 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-4 +https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5 ``` ## 推荐使用顺序 diff --git a/substore/alphaair-rename.js b/substore/alphaair-rename.js index 73ccc51..a37716d 100644 --- a/substore/alphaair-rename.js +++ b/substore/alphaair-rename.js @@ -6,10 +6,13 @@ * - 不追加订阅后缀,整合订阅最后仍交给 rename.js 处理 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -22,6 +25,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; } diff --git a/substore/common.js b/substore/common.js index 23ec6e7..8f4ce27 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-4 + * https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5 */ (function (root) { const regexSpecialChars = new Set(['.', '*', '+', '?', '^', '$', '{', '}', '(', ')', '|', '[', ']', '\\']); diff --git a/substore/liangxin-rename.js b/substore/liangxin-rename.js index a975f9f..f8c2872 100644 --- a/substore/liangxin-rename.js +++ b/substore/liangxin-rename.js @@ -3,10 +3,13 @@ * 负责去掉高速、BGP、CMCU 等 LiangXin 线路描述,保留地区、序号和倍率。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -19,6 +22,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; } diff --git a/substore/peiqian-rename.js b/substore/peiqian-rename.js index bf40542..8c0d48f 100644 --- a/substore/peiqian-rename.js +++ b/substore/peiqian-rename.js @@ -3,10 +3,13 @@ * 负责清理推荐、用途、hy2、倍率、线路特征和提供商等 PeiQian 节点文案。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -19,6 +22,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; } diff --git a/substore/rename.js b/substore/rename.js index 9f9434c..84e55d8 100644 --- a/substore/rename.js +++ b/substore/rename.js @@ -5,10 +5,13 @@ * - 基于归一化后的完整名称做精准去重 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -21,6 +24,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; } diff --git a/substore/sntp-rename.js b/substore/sntp-rename.js index 98b3e52..09d34d6 100644 --- a/substore/sntp-rename.js +++ b/substore/sntp-rename.js @@ -4,10 +4,13 @@ * 维护说明:仅需修改 featureMap 字典即可,底部逻辑永远无需改动。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -20,6 +23,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; } diff --git a/substore/yuetong-rename.js b/substore/yuetong-rename.js index 641b1cb..ae9cf1c 100644 --- a/substore/yuetong-rename.js +++ b/substore/yuetong-rename.js @@ -4,10 +4,13 @@ * 按地区稳定归并后重新连续编号,避免专属/普通节点撞号。 */ // noinspection JSUnusedGlobalSymbols -const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4'; +const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-5'; +const hasCurrentRenameUtils = utils => Boolean( + utils && typeof utils.normalizeLeadingMojibakeFlag === 'function' +); async function loadRenameUtils() { - if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) { + if (typeof globalThis !== 'undefined' && hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { return globalThis.SubStoreRenameUtils; } @@ -20,6 +23,9 @@ async function loadRenameUtils() { } new Function(String(script))(); + if (!hasCurrentRenameUtils(globalThis.SubStoreRenameUtils)) { + throw new Error('Loaded common.js is missing current rename utilities'); + } return globalThis.SubStoreRenameUtils; }