fix(core): 优化 SubStore 节点重命名规则与错位匹配逻辑

This commit is contained in:
Orion
2026-06-03 15:20:57 +08:00
parent edb7d167c0
commit ca2274791b
2 changed files with 26 additions and 2 deletions
+20 -1
View File
@@ -192,6 +192,19 @@
};
const normalizeHyphenatedRegionFeatures = name => {
const misplacedSequenceMatch = String(name).match(/^([A-Z]{2}(?:\s+[A-Z]{3})?)\s+01\s+(\d{1,2})-(.+)$/);
if (misplacedSequenceMatch) {
return [
misplacedSequenceMatch[1],
misplacedSequenceMatch[2].padStart(2, '0'),
misplacedSequenceMatch[3].trim()
]
.filter(Boolean)
.join(' ')
.replace(/\s{2,}/g, ' ')
.trim();
}
const hyphenatedMatch = String(name).match(/^([A-Z]{2})(?:\s+([A-Z]{3}))?-(.+)$/);
if (!hyphenatedMatch) return name;
@@ -211,7 +224,13 @@
}
const sequenceIndex = tokens.findIndex(token => /^\d{1,2}$/.test(token));
if (sequenceIndex === -1) return name;
if (sequenceIndex === -1) {
return [regionCode, tokens.join('-')]
.filter(Boolean)
.join(' ')
.replace(/\s{2,}/g, ' ')
.trim();
}
const sequenceNumber = tokens[sequenceIndex].padStart(2, '0');
const ingressTokens = tokens
+6 -1
View File
@@ -773,7 +773,12 @@ async function operator(proxies) {
core = normalizeRegionSequence(normalizeHyphenatedRegionFeatures(moveMultiplierToEnd(simplifyCoreName(core))))
.replace(/^([A-Z]{2}(?:\s+[A-Z]{3})?\s+\d{2}\s+(?:标准|高级))\s+1(?=$|\s)/i, '$1');
return flag ? `${flag} ${core}` : core;
const coreRegionCode = leadingCodeOf(core);
const outputFlag = flag && knownRegionCodes.has(coreRegionCode)
? utils.regionCodeToFlag(coreRegionCode) || flag
: flag;
return outputFlag ? `${outputFlag} ${core}` : core;
};
proxies.forEach((proxy, proxyIndex) => {