feat(auth): print a scannable ASCII QR in the terminal

WSL and --no-browser never showed the PNG, and placeholder Chinese cookies crashed urllib latin-1 headers before the code was issued.
This commit is contained in:
kairee committed 2026-11-02 10:35:56 +08:00
1 parent 12732f6316
commit 2641ba6f87
5 files changed
+183 -11

No files matched your search

+3 -3
View File
@@ -15,7 +15,7 @@
| 功能 | 状态 | 说明 |
|---|---|---|
| 收藏夹排序 | 可用 | 同一 UP 连续,组内按发布时间倒序,组间按该 UP 最早视频发布时间倒序。唯一使用写鉴权的功能。 |
| 扫码授权与 Cookie 续期 | 可用 | 本地生成二维码;更新身份 Cookie 时保留设备指纹。 |
| 扫码授权与 Cookie 续期 | 可用 | 终端打印 ASCII 二维码并写出 PNG;更新身份 Cookie 时保留设备指纹。 |
| 视频入库 | 可用 | 搜索候选经 Telegram 确认入库;私聊发送视频链接、BV 号、av 号或 `b23.tv` 短链手动入库。只写本地库。 |
| 视频日快照 | 可用(P1) | 逐条采集播放、点赞、投币、收藏、转发、评论、弹幕。 |
| 粉丝追踪 | 可用(P1) | 每日记录咻咻满等配置 UP 的粉丝数。 |
@@ -283,7 +283,7 @@ docker compose up -d --build
- 服务器配置需使用 `web.host = 0.0.0.0` 并设置 `web.auth_token`,否则服务拒绝启动;
- `storage.database_path` 使用 `/data/app.db`,`storage.backup_dir` 使用 `/data/backup`;
- 首次部署可先在本地执行 `uv run python app.py auth --account read` 扫码,再把生成好的 `config.json` 放到服务器;
- 也可在容器内扫码:`docker compose -f compose.example.yml run --rm board python app.py auth --account read --no-browser`,二维码会打印在临时文件路径,可用 `docker cp` 取出;
- 也可在容器内扫码:`docker compose -f compose.example.yml run --rm board python app.py auth --account read --no-browser`,终端会打印 ASCII 二维码;PNG 仍写在临时文件路径,可用 `docker cp` 取出;
- 镜像包含 `tools/`,可直接在容器内执行 `python tools/import_fans_csv.py ...` 回填粉丝历史;
- 数据卷包含数据库、备份与预览库,建议定期备份 `/data`。
@@ -381,7 +381,7 @@ uv run python app.py auth --account write
uv run python app.py auth-check --account all
```
授权流程在本地生成二维码图片并等待手机客户端扫码确认。成功后:
授权流程会在终端打印 UTF-8 半块字符二维码(TTY 下白底黑字,方便深色终端扫码),同时写出 PNG,并等待手机客户端扫码确认。`--no-browser` 只跳过打开图片,仍会打印终端二维码。成功后:
- 更新 `SESSDATA`、`bili_jct`、`DedeUserID`、`sid` 等身份字段;
- 保留 `buvid3`、`buvid4`、`_uuid`、`buvid_fp` 等设备指纹;