fix(substore): normalize mojibake flag prefixes

This commit is contained in:
Orion
2026-06-03 15:47:30 +08:00
parent 29224499f8
commit 354521d161
8 changed files with 47 additions and 17 deletions
+5 -1
View File
@@ -5,7 +5,7 @@
* - 基于归一化后的完整名称做精准去重
*/
// noinspection JSUnusedGlobalSymbols
const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-3';
const COMMON_SCRIPT_URL = 'https://git.orionc.me/orion/script/raw/branch/main/substore/common.js?v=20260603-4';
async function loadRenameUtils() {
if (typeof globalThis !== 'undefined' && globalThis.SubStoreRenameUtils) {
@@ -581,6 +581,9 @@ async function operator(proxies) {
const escapeRegex = utils.escapeRegex;
const leadingFlagRegex = /^([\u{1F1E6}-\u{1F1FF}]{2}|🏴‍☠️)\s*/u;
const inlineFlagRegex = /^(.{1,24}?)([\u{1F1E6}-\u{1F1FF}]{2}|🏴‍☠️)\s*(.*)$/u;
const normalizeLeadingMojibakeFlag = utils.normalizeLeadingMojibakeFlag
|| utils.stripLeadingMojibakeFlag
|| (name => String(name).trim());
const flagToRegionCode = flag => utils.flagToRegionCode(flag, flagCodeOverrides);
@@ -726,6 +729,7 @@ async function operator(proxies) {
};
const normalizeCoreName = name => {
name = normalizeLeadingMojibakeFlag(name);
const leadingFlagMatch = name.match(leadingFlagRegex);
const inlineFlagMatch = leadingFlagMatch
? null