Add device query UI and improve mapper indexing

This commit is contained in:
袁震
2026-03-17 21:57:59 +08:00
parent f6ba48a0d0
commit 3c0e5ed49c
6 changed files with 197536 additions and 0 deletions

110
web/README.md Normal file
View File

@@ -0,0 +1,110 @@
# Web UI
## Start
From repository root:
```bash
python3 -m http.server 8123
```
Open:
- http://127.0.0.1:8123/web/device_query.html (设备查询)
- http://127.0.0.1:8123/web/brand_management.html (数据管理)
页面顶部有导航条Gitea 风格):
- `设备查询`
- `数据管理`
## 设备查询
### Mode A: 客户端上报模式(新增)
字段按你给的上报方式输入:
- Android
- `platform=android`
- `model_raw=Build.MODEL`(例如 `SM-G9980`
- iOS
- `platform=ios`
- `model_raw=utsname.machine`(例如 `iPhone14,2`
- 鸿蒙
- `platform=harmony`
- `model_raw`(如果有就原样填)
- `deviceInfo.marketName`(页面里填 `marketName`
- `deviceInfo.osFullName`(页面里填 `osFullName`
说明:
- 鸿蒙模式下,`model_raw``marketName` 至少填一个。
- 页面会输出完整候选列表,并附带 `report_payload` 方便核对上报值。
### Mode B: 通用多字段模式(原有)
`primaryName`:
- Put the strongest identifier first, such as `iPhone14,5`, `M2102J2SC`, `L55M5-AD`, `SM-G9910`.
`extraNames` (one line each):
- Paste all values you can get from client APIs, for example:
```text
model=SM-G9910
device=star2qltechn
marketName=Galaxy S21
buildProduct=o1qzcx
```
`brand`:
- Optional. Supports aliases like `苹果`, `samsung`, `huawei`, `小米`.
`platform`:
- iOS / Android / HarmonyOS / Unknown
## Output
设备查询页会返回:
- best candidate
- complete ranked candidates
- normalized brand + parent manufacturer
- source rank/weight (from source order config)
- matched inputs
- matched normalized keys
- source markdown file and section
- full JSON output for direct integration or debugging
## Data management
数据管理页支持:
- Independent maintenance:
- Brand list is maintained independently in the UI and initialized from index data on first load.
- Changes are stored in browser `localStorage`.
- Alias normalization (brand only):
- `华为 / huawei / HUAWEI` are normalized to brand `HUAWEI`.
- Brand-manufacturer relations:
- One brand has exactly one parent manufacturer.
- One manufacturer can contain multiple brands.
- Examples:
- `Xiaomi` manufacturer includes brands `Xiaomi`, `Redmi`, `POCO`.
- `vivo` manufacturer includes brands `vivo`, `iQOO`.
- `OPPO` manufacturer includes brands `OPPO`, `OnePlus`, `realme`.
- Click `品牌数 / 厂商数` to open full list popup.
- `编辑品牌列表`: popup edit.
- `编辑品牌-厂商关系`: popup edit.
- `编辑品牌同义词`: popup edit.
- 数据来源管理(新增):
- Supports drag-and-drop source ordering.
- Ranking weight is higher for sources at the top.
- Initial order puts `*_cn.md` before non-`cn` sources.
## Notes
- If browser blocks local file fetch, start HTTP server as above.
- You can also manually upload `dist/device_index.json` in the page.

1085
web/brand_management.html Normal file

File diff suppressed because it is too large Load Diff

1314
web/device_query.html Normal file

File diff suppressed because it is too large Load Diff