feat(phone-sms): support 5sim provider
(cherry picked from commit 7d10cab9765ed662b5088f791c8635fd8cc63e44)
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
4. Plus 免费试用资格提前判断,以及跳过账号仍标记“已用”。
|
||||
5. SUB2API 多分组创建账号。
|
||||
6. OAuth 登录使用全新标签页。
|
||||
7. 本地导出配置 `/config.json` 忽略规则。
|
||||
7. 接码平台多平台适配:HeroSMS + 5sim。
|
||||
8. 本地导出配置 `/config.json` 忽略规则。
|
||||
|
||||
推荐每次同步后执行:
|
||||
|
||||
@@ -37,6 +38,8 @@ cc7671e feat(sub2api): 支持多分组创建账号
|
||||
b3790c1 fix(auth): OAuth 登录使用全新标签页
|
||||
```
|
||||
|
||||
补充:接码平台多平台适配是当前分支新增的本地自定义功能;真实 5sim API Key 只允许通过侧边栏输入并保存到本地配置,不写入仓库、测试或文档。
|
||||
|
||||
排查本地定制范围可用:
|
||||
|
||||
```bash
|
||||
@@ -304,7 +307,71 @@ OAuth 登录流程打开新标签页,避免复用旧页面导致状态污染
|
||||
|
||||
上游如果改 OAuth tab 打开方式,确认仍保留“全新标签页”语义,不要退回到复用已有 tab。
|
||||
|
||||
## 7. 本地配置文件忽略
|
||||
## 7. 接码平台多平台适配:HeroSMS + 5sim
|
||||
|
||||
### 目标
|
||||
|
||||
手机号验证 Step 9 支持按平台切换接码能力:
|
||||
|
||||
- 默认仍为 `HeroSMS`,老配置无需迁移。
|
||||
- 新增 `5sim` 平台,下拉框在接码设置卡片中直接可见。
|
||||
- 国家/地区列表、API Key、价格上限、余额、买号、查码、完成、取消、ban、复用均按当前 `phoneSmsProvider` 分发。
|
||||
- HeroSMS 继续使用原 `heroSms*` 字段;5sim 使用独立 `fiveSim*` 字段,切换平台时不会互相覆盖草稿。
|
||||
|
||||
### 关键文件
|
||||
|
||||
| 文件 | 作用 |
|
||||
| --- | --- |
|
||||
| `phone-sms/providers/hero-sms.js` | HeroSMS 适配层,承接 HeroSMS 余额、价格、国家规范化等平台逻辑。 |
|
||||
| `phone-sms/providers/five-sim.js` | 5sim 适配层,封装 profile、countries、prices、buy、check、finish、cancel、ban、reuse。 |
|
||||
| `phone-sms/providers/registry.js` | 接码平台注册表,按 `phoneSmsProvider` 选择平台模块。 |
|
||||
| `background.js` | 持久字段默认值、导入脚本、配置规范化、phone flow helper 注入。 |
|
||||
| `background/phone-verification-flow.js` | Step 9 运行态按 activation.provider 分发后续查码/完成/取消/ban/reuse。 |
|
||||
| `sidepanel/sidepanel.html` | 接码平台下拉、余额按钮、5sim operator 输入。 |
|
||||
| `sidepanel/sidepanel.js` | 平台切换、地区列表联动、价格/余额查询、配置收集与恢复。 |
|
||||
| `tests/five-sim-provider.test.js` | 5sim provider 单测。 |
|
||||
| `tests/phone-verification-flow.test.js` | 5sim Step 9 buy/check/finish/reuse 分发测试。 |
|
||||
| `tests/sidepanel-phone-verification-settings.test.js` | 接码平台下拉和侧边栏联动测试。 |
|
||||
|
||||
### 关键状态字段
|
||||
|
||||
- 通用:
|
||||
- `phoneSmsProvider: "hero-sms" | "5sim"`
|
||||
- HeroSMS:
|
||||
- `heroSmsApiKey`
|
||||
- `heroSmsCountryId`
|
||||
- `heroSmsCountryLabel`
|
||||
- `heroSmsCountryFallback`
|
||||
- `heroSmsMaxPrice`
|
||||
- `heroSmsReuseEnabled`
|
||||
- `heroSmsAcquirePriority`
|
||||
- 5sim:
|
||||
- `fiveSimApiKey`
|
||||
- `fiveSimCountryId`
|
||||
- `fiveSimCountryLabel`
|
||||
- `fiveSimCountryFallback`
|
||||
- `fiveSimMaxPrice`
|
||||
- `fiveSimOperator`
|
||||
|
||||
### 维护注意
|
||||
|
||||
1. 不要把真实 5sim key 写入代码、测试或文档;只允许用户在侧边栏输入。
|
||||
2. 上游同步时如果改了 Step 9 手机号验证,必须保留 `currentPhoneActivation.provider` 驱动的后续分发。
|
||||
3. 上游同步时如果改了 sidepanel 接码区域,必须保留 `select-phone-sms-provider`,且地区列表按平台加载:HeroSMS 数字国家 ID,5sim 字符串 country slug。
|
||||
4. 5sim 产品码当前固定为 `openai`,operator 默认 `any`;价格上限为空时按价格目录最低可用价尝试。
|
||||
|
||||
### 验证
|
||||
|
||||
```bash
|
||||
node --check phone-sms/providers/hero-sms.js
|
||||
node --check phone-sms/providers/five-sim.js
|
||||
node --check phone-sms/providers/registry.js
|
||||
node --check background/phone-verification-flow.js
|
||||
node --check sidepanel/sidepanel.js
|
||||
node --test tests/five-sim-provider.test.js tests/phone-verification-flow.test.js tests/sidepanel-phone-verification-settings.test.js
|
||||
```
|
||||
|
||||
## 8. 本地配置文件忽略
|
||||
|
||||
### 目标
|
||||
|
||||
@@ -388,3 +455,13 @@ rg -n "normalizeSub2ApiGroupNames|getGroupsByNames|sub2apiGroupIds|input-sub2api
|
||||
tests
|
||||
```
|
||||
|
||||
检查接码多平台适配:
|
||||
|
||||
```bash
|
||||
rg -n "phoneSmsProvider|select-phone-sms-provider|PhoneSmsFiveSimProvider|PhoneSmsProviderRegistry|fiveSim" \
|
||||
background.js \
|
||||
background/phone-verification-flow.js \
|
||||
phone-sms \
|
||||
sidepanel \
|
||||
tests
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user