♻️ refactor: 优化 Iris Cloud 节点重命名与排序逻辑
- 移除 multiplierValueOf 工具函数及倍率数值转换逻辑 - 简化节点排序规则,移除基于倍率大小的二次排序逻辑 - 保持原有的区域顺序和初始索引顺序进行节点排序
This commit is contained in:
@@ -36,6 +36,7 @@ async function operator(proxies) {
|
||||
const utils = await loadRenameUtils();
|
||||
|
||||
const landingPrefixOf = name => {
|
||||
if (/^(?:US)(?:$|[\s|.-])/i.test(name)) return 'US';
|
||||
if (/(?:^|[-\s])SG(?:$|[-\s.])/i.test(name)) return 'SG';
|
||||
if (/(?:^|[-\s])TYO(?:$|[-\s])/i.test(name)) return 'JP TYO';
|
||||
if (/(?:^|[-\s])JP(?:$|[-\s])/i.test(name)) return 'JP';
|
||||
@@ -49,10 +50,6 @@ async function operator(proxies) {
|
||||
return match ? `${match[1]}X` : '';
|
||||
};
|
||||
|
||||
const multiplierValueOf = multiplier => (
|
||||
multiplier ? Number(multiplier.replace(/X$/i, '')) : Number.NEGATIVE_INFINITY
|
||||
);
|
||||
|
||||
const cleanCoreName = name => {
|
||||
const { text } = utils.splitLeadingOrInlineFlag(name);
|
||||
return text
|
||||
@@ -108,11 +105,6 @@ async function operator(proxies) {
|
||||
const firstRegionOrder = regionOrder[firstItem.regionPrefix];
|
||||
const secondRegionOrder = regionOrder[secondItem.regionPrefix];
|
||||
if (firstRegionOrder !== secondRegionOrder) return firstRegionOrder - secondRegionOrder;
|
||||
const firstMultiplierValue = multiplierValueOf(firstItem.multiplier);
|
||||
const secondMultiplierValue = multiplierValueOf(secondItem.multiplier);
|
||||
if (firstMultiplierValue !== secondMultiplierValue) {
|
||||
return firstMultiplierValue - secondMultiplierValue;
|
||||
}
|
||||
return firstItem.originalIndex - secondItem.originalIndex;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user