refactor(substore): 将通用工具函数迁移至公共库
- 从各个重命名脚本中移除重复的工具函数实现 - 将 multiplierOf、multiplierValueOf、stripSubscriptionSuffix 等函数统一到 common.js - 使用 utils.multiplierOf、utils.multiplierValueOf 替代本地实现 - 引入 utils.createSequenceCounter 替代手动计数逻辑 - 更新版本号从 20260608-1 到 20260702-1 - 移除重复的正则表达式匹配逻辑 - 标准化序列计数器实现方式 - 优化 yinyun-rename.js 中的信息节点过滤逻辑
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* 负责清理推荐、用途、hy2、倍率、线路特征和提供商等 PeiQian 节点文案。
|
||||
*/
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
const COMMON_SCRIPT_VERSION = '20260608-1';
|
||||
const COMMON_SCRIPT_VERSION = '20260702-1';
|
||||
const COMMON_SCRIPT_URL = `https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=${COMMON_SCRIPT_VERSION}`;
|
||||
const hasCurrentRenameUtils = utils => Boolean(
|
||||
utils && utils.version === COMMON_SCRIPT_VERSION
|
||||
@@ -44,11 +44,10 @@ async function operator(proxies) {
|
||||
.replace(/\s*\|\s*避免晚高峰使用/gi, '')
|
||||
.replace(/\s*\|\s*(?:电信联通移动|电信联通|移动联通|三网)推荐(?:\s*-\s*hy2)?/gi, '')
|
||||
.replace(/\s*\|\s*高速专线(?:推荐)?(?:\s*-\s*hy2)?/gi, '')
|
||||
.replace(/-\s*(\d+(?:\.\d+)?)倍/gi, ' $1x')
|
||||
.replace(/(\d+(?:\.\d+)?)倍/gi, '$1x')
|
||||
.replace(/\s*\[(?:专线|移联|电联|三网|HY2)(?:\s+(?:专线|移联|电联|三网|HY2))*\]/gi, '')
|
||||
.replace(/\s+\[/g, ' [')
|
||||
.replace(/\s{2,}/g, ' ');
|
||||
proxy.name = utils.normalizeMultiplierText(proxy.name);
|
||||
proxy.name = utils.normalizeLeadingFlagSpacing(proxy.name);
|
||||
|
||||
return proxy;
|
||||
|
||||
Reference in New Issue
Block a user