fix(madao): 适配国家中文标签和线路归一化

- 优先显示 MaDao 返回的 label_zh,不在 FlowPilot 内维护国家翻译表
- 兼容旧 provider_value 保存值,刷新直连国家后自动反选 ISO value
- 将 any / Any operator 归一为空线路,避免重复选项和错误下发
- 保留 MaDao 隐藏复用控件缺失时的默认开启状态
This commit is contained in:
Isulew
2026-05-29 21:59:20 +08:00
parent e441c5e7b8
commit c64ff5152c
4 changed files with 209 additions and 12 deletions
+11 -1
View File
@@ -42,6 +42,15 @@
return normalizeText(value).toLowerCase().replace(/[^a-z0-9_-]+/g, '');
}
function normalizeOperator(value = '') {
const rawValue = normalizeText(value);
const compactValue = rawValue.toLowerCase().replace(/[^a-z0-9]+/g, '');
if (!rawValue || compactValue === 'any' || compactValue === 'anyoperator') {
return '';
}
return rawValue.toLowerCase().replace(/[^a-z0-9_-]+/g, '');
}
function normalizeCountry(value = '') {
const trimmed = normalizeText(value);
if (!trimmed) {
@@ -255,7 +264,7 @@
service: normalizeText(options?.service || state?.madaoServiceName, DEFAULT_SERVICE),
};
const country = normalizeCountry(options?.country || state?.madaoCountry);
const operator = normalizeProviderId(options?.operator || state?.madaoOperator);
const operator = normalizeOperator(options?.operator || state?.madaoOperator);
const minPrice = normalizePrice(options?.minPrice ?? state?.madaoMinPrice);
const maxPrice = normalizePrice(options?.maxPrice ?? state?.madaoMaxPrice);
@@ -708,6 +717,7 @@
normalizeCountry,
normalizeCountryKey,
normalizeCountryLabel,
normalizeOperator,
resolveActivationCountry,
pollActivation,
pollActivationCode,