♻️ refactor(substore): 将倍率标识移动到节点名称末尾
This commit is contained in:
@@ -97,9 +97,11 @@
|
|||||||
```text
|
```text
|
||||||
🇺🇸 4X|美国夏威夷家宽|三网1
|
🇺🇸 4X|美国夏威夷家宽|三网1
|
||||||
=> 🇺🇸 US HNL 4X 01
|
=> 🇺🇸 US HNL 4X 01
|
||||||
|
=> 🇺🇸 US HNL 01 4X - Alpha Air
|
||||||
|
|
||||||
3X 🇨🇳 台湾家宽Hinet|COP
|
3X 🇨🇳 台湾家宽Hinet|COP
|
||||||
=> 🇹🇼 TW 3X 01
|
=> 🇹🇼 TW 3X 01
|
||||||
|
=> 🇹🇼 TW 01 3X - Alpha Air
|
||||||
|
|
||||||
🇭🇰 SkyStroll|毕业
|
🇭🇰 SkyStroll|毕业
|
||||||
=> 🇭🇰 HK SkyStroll 01
|
=> 🇭🇰 HK SkyStroll 01
|
||||||
@@ -116,6 +118,7 @@
|
|||||||
- 常见城市转短码,例如 `Los Angeles` -> `LAX`、`San Jose` -> `SJC`、`Seattle` -> `SEA`、`东京` -> `TYO`。
|
- 常见城市转短码,例如 `Los Angeles` -> `LAX`、`San Jose` -> `SJC`、`Seattle` -> `SEA`、`东京` -> `TYO`。
|
||||||
- 国家/地区别名表覆盖常见英文、中文国家名;城市尽量使用三字 IATA/城市码,避免 `LA` 这类两字码被旗帜操作误识别为国家。
|
- 国家/地区别名表覆盖常见英文、中文国家名;城市尽量使用三字 IATA/城市码,避免 `LA` 这类两字码被旗帜操作误识别为国家。
|
||||||
- 支持国旗在中间的节点名,例如 `Pro-🇭🇰 Sharon|守夜人` -> `🇭🇰 HK Pro-Sharon|守夜人`。
|
- 支持国旗在中间的节点名,例如 `Pro-🇭🇰 Sharon|守夜人` -> `🇭🇰 HK Pro-Sharon|守夜人`。
|
||||||
|
- 将倍率移动到节点核心末尾、订阅后缀之前,例如 `US 2X 02 - Alpha Air` -> `US 02 2X - Alpha Air`。
|
||||||
- 清理 `[DIP China-Hongkong]` 为 `[DIP]`。
|
- 清理 `[DIP China-Hongkong]` 为 `[DIP]`。
|
||||||
- 清理 `IEPL 专线` 这类冗余描述。
|
- 清理 `IEPL 专线` 这类冗余描述。
|
||||||
- 追加订阅后缀 `- _subName`。
|
- 追加订阅后缀 `- _subName`。
|
||||||
|
|||||||
+16
-1
@@ -661,6 +661,21 @@ function operator(proxies) {
|
|||||||
.trim();
|
.trim();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const moveMultiplierToEnd = name => {
|
||||||
|
const multipliers = [];
|
||||||
|
const nameWithoutMultiplier = name
|
||||||
|
.replace(/\b(\d+(?:\.\d+)?X)\b/gi, multiplier => {
|
||||||
|
multipliers.push(multiplier.toUpperCase());
|
||||||
|
return ' ';
|
||||||
|
})
|
||||||
|
.replace(/\s+\[/g, ' [')
|
||||||
|
.replace(/\s{2,}/g, ' ')
|
||||||
|
.trim();
|
||||||
|
|
||||||
|
if (!multipliers.length) return name;
|
||||||
|
return `${nameWithoutMultiplier} ${multipliers.join(' ')}`.trim();
|
||||||
|
};
|
||||||
|
|
||||||
const normalizeBilingualName = name => {
|
const normalizeBilingualName = name => {
|
||||||
const bilingualMatch = name.match(/^(.+?)\s*|\s*(.+)$/);
|
const bilingualMatch = name.match(/^(.+?)\s*|\s*(.+)$/);
|
||||||
if (!bilingualMatch) return name;
|
if (!bilingualMatch) return name;
|
||||||
@@ -725,7 +740,7 @@ function operator(proxies) {
|
|||||||
core = joinAlias(flagRegionCode, core);
|
core = joinAlias(flagRegionCode, core);
|
||||||
}
|
}
|
||||||
|
|
||||||
core = simplifyCoreName(core);
|
core = moveMultiplierToEnd(simplifyCoreName(core));
|
||||||
|
|
||||||
return flag ? `${flag} ${core}` : core;
|
return flag ? `${flag} ${core}` : core;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user