feat: 完成登录状态检测

- 增强 editor 登录检测,新增 login_status 详情结果

- 保留 is_logged_in bool 包装并处理登录页、缺 Cookie 等状态

- 新增登录检测单元测试覆盖 CDP 分支

- 更新任务看板、API 合约、当前状态和进度记录
This commit is contained in:
chengma
2026-06-27 09:42:41 +08:00
parent e325f66eef
commit deb12cb76c
6 changed files with 232 additions and 20 deletions
+8
View File
@@ -312,3 +312,11 @@
- 范围:本轮不实现 `.lnk` 快捷方式,留给 T-106。
- 验证:`py -3 -m compileall app main.py tests` 通过;`py -3 -m unittest discover -s tests` 通过(17 tests,skipped=2);`python -m unittest discover -s tests` 通过(17 tests,skipped=2)。
- 下一步:按任务看板领取 T-103。
## 【2026-06-27】T-103 登录保活与检测
- 状态:DONE
- 变更:增强 `app/editor.py` 登录检测,新增 `login_status(account, timeout=8)` 返回 `logged_in/reason/url/host/cookie_names`,`is_logged_in()` 保持 bool 包装;无 Shopee tab 时打开卖家中心用于检测/人工登录;新增 `tests/test_editor_login.py` 覆盖登录页、会话 Cookie、缺 Cookie、无 Shopee tab 创建检测页;同步 `docs/06-tasks.md`、`docs/current-state.md`、`docs/api.md`。
- 规则:不自动登录、不填密码;登录态依赖 T-101/T-102 的稳定 user-data-dir 保留;URL 命中登录页返回 `LOGIN_PAGE`,缺 `SPC_ST/SPC_U` 返回 `NO_SESSION_COOKIE`。
- 验证:`py -3 -m compileall app main.py tests` 通过;`py -3 -m unittest discover -s tests` 通过(22 tests,skipped=2);`python -m unittest discover -s tests` 通过(22 tests,skipped=2)。
- 下一步:按任务看板领取 T-104。