From ed1d62687cc844b7e63dd1d28037725bc0bc8eac Mon Sep 17 00:00:00 2001 From: Isulew <224964+netcookies@users.noreply.github.com> Date: Fri, 29 May 2026 17:53:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E9=BD=90=20MaDao=20=E7=9B=B4?= =?UTF-8?q?=E8=BF=9E=E5=8A=A8=E6=80=81=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 恢复 MaDao 直连模式的服务商、国家、线路下拉,并通过 daemon providers/countries/operators 接口级联加载。保存 madaoOperator 并在 direct acquire 中通过 metadata.operator 下发,routing 模式保留已保存的直连配置。 --- background.js | 10 + phone-sms/providers/madao.js | 4 + sidepanel/sidepanel.html | 27 ++ sidepanel/sidepanel.js | 378 ++++++++++++++++-- ...ackground-account-history-settings.test.js | 2 + ...nd-settings-import-mode-validation.test.js | 2 + ...ground-settings-schema-persistence.test.js | 5 + tests/madao-provider.test.js | 4 + tests/phone-verification-flow.test.js | 4 + ...epanel-phone-verification-settings.test.js | 201 +++++++++- 10 files changed, 596 insertions(+), 41 deletions(-) diff --git a/background.js b/background.js index faf1d9b..a411008 100644 --- a/background.js +++ b/background.js @@ -1453,6 +1453,7 @@ const PERSISTED_SETTING_DEFAULTS = { madaoRoutingPlanId: '', madaoProviderId: '', madaoCountry: '', + madaoOperator: '', madaoAutoPickCountry: true, madaoReusePhone: true, madaoMinPrice: '', @@ -2245,6 +2246,13 @@ function normalizeMaDaoPrice(value = '') { return normalizeHeroSmsMaxPrice(value); } +function normalizeMaDaoOperator(value = '') { + return String(value || '') + .trim() + .toLowerCase() + .replace(/[^a-z0-9_-]+/g, ''); +} + function normalizePhonePreferredActivation(value) { if (!value || typeof value !== 'object' || Array.isArray(value)) { return null; @@ -3595,6 +3603,8 @@ function normalizePersistentSettingValue(key, value) { return normalizeMaDaoProviderId(value); case 'madaoCountry': return normalizeMaDaoCountry(value); + case 'madaoOperator': + return normalizeMaDaoOperator(value); case 'madaoAutoPickCountry': case 'madaoReusePhone': return Boolean(value); diff --git a/phone-sms/providers/madao.js b/phone-sms/providers/madao.js index b4185c2..c3a0320 100644 --- a/phone-sms/providers/madao.js +++ b/phone-sms/providers/madao.js @@ -255,6 +255,7 @@ service: normalizeText(options?.service || state?.madaoServiceName, DEFAULT_SERVICE), }; const country = normalizeCountry(options?.country || state?.madaoCountry); + const operator = normalizeProviderId(options?.operator || state?.madaoOperator); const minPrice = normalizePrice(options?.minPrice ?? state?.madaoMinPrice); const maxPrice = normalizePrice(options?.maxPrice ?? state?.madaoMaxPrice); @@ -268,6 +269,9 @@ if (country) { request.country = country; } + if (operator) { + request.metadata = { operator }; + } if (minPrice !== null) { request.min_price = minPrice; } diff --git a/sidepanel/sidepanel.html b/sidepanel/sidepanel.html index d3e2af7..1374717 100644 --- a/sidepanel/sidepanel.html +++ b/sidepanel/sidepanel.html @@ -1565,6 +1565,33 @@ + + +