♻️ refactor(substore): 优化节点重命名规则并规范化地区序列号格式

This commit is contained in:
Orion
2026-06-03 11:18:28 +08:00
parent a41e7e7959
commit 51488a5ec2
2 changed files with 19 additions and 12 deletions
+14 -1
View File
@@ -676,6 +676,19 @@ function operator(proxies) {
return `${nameWithoutMultiplier} ${multipliers.join(' ')}`.trim();
};
const normalizeRegionSequence = name => name
.replace(/(^|\s)([A-Z]{2}(?:\s+[A-Z]{3})?)[\s|\-]*(\d{1,2})(?=$|[\s|\-[\]])/g, (
match,
prefix,
regionCode,
sequenceNumber
) => {
return `${prefix}${regionCode} ${sequenceNumber.padStart(2, '0')}`;
})
.replace(/(\b[A-Z]{2}(?:\s+[A-Z]{3})? \d{2})-\s*(?=\d+(?:\.\d+)?X\b)/g, '$1 ')
.replace(/\s{2,}/g, ' ')
.trim();
const normalizeBilingualName = name => {
const bilingualMatch = name.match(/^(.+?)\s*\s*(.+)$/);
if (!bilingualMatch) return name;
@@ -740,7 +753,7 @@ function operator(proxies) {
core = joinAlias(flagRegionCode, core);
}
core = moveMultiplierToEnd(simplifyCoreName(core));
core = normalizeRegionSequence(moveMultiplierToEnd(simplifyCoreName(core)));
return flag ? `${flag} ${core}` : core;
};