⚡fix(core): 优化 SubStore 节点重命名规则与错位匹配逻辑
This commit is contained in:
+20
-1
@@ -192,6 +192,19 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const normalizeHyphenatedRegionFeatures = name => {
|
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}))?-(.+)$/);
|
const hyphenatedMatch = String(name).match(/^([A-Z]{2})(?:\s+([A-Z]{3}))?-(.+)$/);
|
||||||
if (!hyphenatedMatch) return name;
|
if (!hyphenatedMatch) return name;
|
||||||
|
|
||||||
@@ -211,7 +224,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const sequenceIndex = tokens.findIndex(token => /^\d{1,2}$/.test(token));
|
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 sequenceNumber = tokens[sequenceIndex].padStart(2, '0');
|
||||||
const ingressTokens = tokens
|
const ingressTokens = tokens
|
||||||
|
|||||||
+6
-1
@@ -773,7 +773,12 @@ async function operator(proxies) {
|
|||||||
core = normalizeRegionSequence(normalizeHyphenatedRegionFeatures(moveMultiplierToEnd(simplifyCoreName(core))))
|
core = normalizeRegionSequence(normalizeHyphenatedRegionFeatures(moveMultiplierToEnd(simplifyCoreName(core))))
|
||||||
.replace(/^([A-Z]{2}(?:\s+[A-Z]{3})?\s+\d{2}\s+(?:标准|高级))\s+1(?=$|\s)/i, '$1');
|
.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) => {
|
proxies.forEach((proxy, proxyIndex) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user