feat(web): 靶子显示友好名 + 支持连打次数
- targets.py 增加 label 字段(1ms 签到 / mliev 登录),下拉框、说明、历史表统一用友好名 - POST /api/jobs 支持 count(1~20):一次任务连打 N 发,发间自动按靶子频控节流、可取消 - 每发结果记入 stats.rounds,EVT_VERIFY 带 round,结果区展示「每发结果(通过 x/y)」彩色一览 - 滑块不再生成标注图(红圈+序号只表达点击顺序,对滑块是误导) - 观测台 README 补齐启动/后台运行/端口占用/自检说明
This commit is contained in:
+51
-4
@@ -9,13 +9,60 @@
|
||||
## 启动
|
||||
|
||||
```bash
|
||||
uv run --extra web python -m tcaptcha.web.app # 默认 127.0.0.1:8770
|
||||
uv run --extra web python -m tcaptcha.web.app --port 9000 --host 0.0.0.0
|
||||
uv run --extra web python -m tcaptcha.web.app --no-warmup # 不预热 AI 引擎
|
||||
# 首次(或依赖变动后):把 web extra 同步进 .venv
|
||||
uv sync --extra web
|
||||
|
||||
# 启动(默认 127.0.0.1:8770 —— 只有本机能访问)
|
||||
uv run --extra web python -m tcaptcha.web.app
|
||||
```
|
||||
|
||||
然后浏览器打开 <http://127.0.0.1:8770/>。前台运行,`Ctrl+C` 停止。
|
||||
|
||||
启动成功时终端会打印:
|
||||
|
||||
```
|
||||
tcaptcha 观测台已启动 → http://127.0.0.1:8770
|
||||
|
||||
(Ctrl+C 停止;靶子带实测最小间隔,1ms 为 60s,后端会自动节流)
|
||||
```
|
||||
|
||||
常用变体:
|
||||
|
||||
```bash
|
||||
uv run --extra web python -m tcaptcha.web.app --port 8899 # 换端口
|
||||
uv run --extra web python -m tcaptcha.web.app --host 0.0.0.0 # 局域网访问(⚠️ 界面无鉴权)
|
||||
uv run --extra web python -m tcaptcha.web.app --no-warmup # 跳过 AI 引擎预热,启动更快
|
||||
```
|
||||
|
||||
不想用 uv 也可以直接调项目 venv(两条路径等价,`uv run` 用的就是 `.venv`):
|
||||
|
||||
```bash
|
||||
.venv/bin/python -m tcaptcha.web.app
|
||||
```
|
||||
|
||||
**后台运行 + 停止**(`&` 直接后台会随终端退出而挂掉,所以用 `nohup` 并记下 PID):
|
||||
|
||||
```bash
|
||||
nohup .venv/bin/python -m tcaptcha.web.app > /tmp/tcaptcha-web.log 2>&1 &
|
||||
echo $! > /tmp/tcaptcha-web.pid
|
||||
# 停止
|
||||
kill "$(cat /tmp/tcaptcha-web.pid)"
|
||||
```
|
||||
|
||||
**端口被占用**:启动时会直接给中文提示并以退出码 2 结束(不会打一堆 errno):
|
||||
|
||||
```
|
||||
✗ 端口 8770 已被占用,服务没起来。
|
||||
查占用进程:lsof -nP -iTCP:8770 -sTCP:LISTEN
|
||||
停掉它 :kill <上面的 PID>
|
||||
或换端口 :--port 8771
|
||||
```
|
||||
|
||||
**自检**:`curl -s http://127.0.0.1:8770/api/health` 应返回
|
||||
`{"status":"online","targets":["1ms","mliev"],"cooldown":{...}}`。
|
||||
|
||||
> `fastapi` / `uvicorn` 装在 **optional extra `web`** 里,核心包(协议 / 遥测 / 求解器 / CLI)
|
||||
> 完全不依赖它们 —— `import tcaptcha` 不会把 fastapi 拉进来(有回归断言:见本文件末)。
|
||||
> 完全不依赖它们 —— `import tcaptcha` 不会把 fastapi 拉进来(有回归断言)。
|
||||
|
||||
## 架构
|
||||
|
||||
|
||||
Reference in New Issue
Block a user