549 Commits
Author SHA1 Message Date
Your Name e784efd5f8 refactor(gui): 抽 filter_tab UI 创建到 components/filter_tab (2122 → 2037) 2026-05-30 16:18:29 +08:00
Your Name 6c7bbf0945 refactor(gui): 抽 run_tab UI 创建到 components/run_tab (2192 → 2122) 2026-05-30 16:15:24 +08:00
Your Name fe27063913 refactor(gui): 抽 reservation_tab UI 创建到 components/reservation_tab (2334 → 2192) 2026-05-30 16:11:47 +08:00
Your Name 3f04bb23c2 refactor(gui): 抽 yanghao_tab UI 创建到 components/yanghao_tab (2456 → 2334) 2026-05-30 16:06:40 +08:00
Your Name bcb0e363d1 refactor(gui): 抽 logging_tab UI 创建到 components/logging_tab (2656 → 2456) 2026-05-30 15:54:46 +08:00
Your Name b447b6a6a4 refactor(gui): 抽 debug_tab UI 创建到 components/debug_tab (3052 → 2656) 2026-05-30 15:50:58 +08:00
Your Name 3ac8664817 docs(specs): 更新 gui_app 拆分最终成果(5476 → 3052, -44.3%) 2026-05-30 15:42:56 +08:00
Your Name 6bac014c3d refactor(gui): 抽 load_config_to_ui + save_ui_to_config 到 components/config_io (3538 → 3052) 2026-05-30 15:41:27 +08:00
Your Name 3d433080c2 docs(specs): 更新 gui_app 拆分最终成果(5476 → 3538, -35.4%) 2026-05-30 15:27:44 +08:00
Your Name f6d382b0e7 refactor(gui): 抽 get_params 到 components/run_params_builder (3563 → 3538) 2026-05-30 15:26:17 +08:00
Your Name 2a05be2319 refactor(gui): 抽 save_logging_config 到 components/logging_config_io (3590 → 3563) 2026-05-30 15:22:29 +08:00
Your Name f9839f3dee docs(specs): 补充 gui_app 拆分实际成果(5476 → 3590, -34%) 2026-05-30 15:18:13 +08:00
Your Name 97935d9c48 refactor(gui): 抽 _generic_search_widget 到 components/text_search (3669 → 3590) 2026-05-30 15:16:42 +08:00
Your Name 64c210dd5a refactor(gui): 抽 refresh_run_log 到 components/run_log_view (3715 → 3669) 2026-05-30 15:12:38 +08:00
Your Name 68d1224b53 refactor(gui): 抽 _on_scan_one_click + _handle_scan_result 到 components/wifi_adb_one_click_scan (3775 → 3715) 2026-05-30 15:08:35 +08:00
Your Name 92d524297b refactor(gui): 抽预览 Tab 全部 8 个动作到 components/preview_view (3891 → 3775) 2026-05-30 15:03:45 +08:00
Your Name 59ebe8c1e7 refactor(gui): 抽 win_record Tab 全部 7 个动作到 components/win_record_view (4044 → 3891) 2026-05-30 14:53:11 +08:00
Your Name a7ef92fc7c refactor(gui): 抽 pump_logs 到 components/log_pump (4117 → 4044) 2026-05-30 14:37:03 +08:00
Your Name c5df7a05d2 refactor(gui): 抽 update_ocr_results 到 components/ocr_results_view (4148 → 4117) 2026-05-30 14:30:42 +08:00
Your Name b3380042b8 refactor(gui): 抽 _try_reconnect_last_wifi 到 components/wifi_adb_reconnect (4268 → 4148) 2026-05-30 14:24:19 +08:00
Your Name 4993fad004 refactor(gui): 抽 _open_scan_pick_dialog 到 components/wifi_adb_pick_dialog (4337 → 4268) 2026-05-30 14:18:19 +08:00
Your Name 44b091466d refactor(gui): 抽 actions_log 视图相关到 components/actions_log_view (4463 → 4337) 2026-05-30 14:10:30 +08:00
Your Name 8ea676562c refactor(gui): 抽 do_screenshot + OCR_REGIONS 到 components/screenshot_action (4635 → 4463) 2026-05-30 14:03:31 +08:00
Your Name a07ef00b5e refactor(gui): 抽 refresh_high_value_rooms 到 components/high_value_view (4656 → 4635) 2026-05-30 13:56:36 +08:00
Your Name 5329561b3a refactor(gui): 抽 refresh_reservations 到 components/reservations_view (4913 → 4656) 2026-05-30 13:52:39 +08:00
Your Name 6bffcae2de refactor(gui): 抽 open_wifi_adb_dialog 到 components/wifi_adb_dialog (5274 → 4913) 2026-05-30 13:48:22 +08:00
Your Name ac464788e1 refactor(gui): 抽 open_scan_dialog 到 components/wifi_adb_scan_dialog (5476 → 5274) 2026-05-30 13:43:17 +08:00
Your Name 8dace383ec docs(plans): 添加 gui/gui_app.py 拆分实施计划 2026-05-30 13:26:42 +08:00
Your Name 26f9e5a553 docs(specs): 添加 gui/gui_app.py 拆分设计文档 2026-05-30 13:24:07 +08:00
CodexandClaude Sonnet 4.5 bb90e2983f fix(pil): 补充修复剩余 PIL Image 资源泄漏
覆盖 14 个文件中的 Image.open() 未正确关闭问题:
- fansclub_handler: 5 处(pic/pic_rgb/img 未 close)
- image_ops: 2 处(crop 后 pic 未 close)
- douyin_popups: 2 处(pic.convert 重赋值泄漏原始句柄)
- douyin_fudai: 1 处(open().convert() 链式调用泄漏)
- douyin_robot: 2 处(同上)
- save_files/direct_attend/finder/stage/find_open/detail/_common/ocr_preprocess: 各 1-2 处

统一修复模式:分离 open 与 convert,try/finally 确保原始句柄关闭。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 22:49:50 +08:00
CodexandClaude Sonnet 4.5 c3746b0207 fix(pil): 修复 PIL Image 资源泄漏
Image.open() 后未 close() 导致文件句柄泄漏,用 _raw + try/finally 模式修复。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 22:42:22 +08:00
CodexandClaude Sonnet 4.5 b1fa6af9ce fix(gui): 修复启动后 GUI 卡死约 1.2 秒
delayed_refresh_preview 在 mainloop 启动 300ms 后同步加载大图(PIL
Image.open + load + convert),阻塞主线程。改为:
1. 延迟到 3 秒后再触发预览(GUI 已完全初始化)
2. 图片加载放到后台线程,完成后通过 root.after 回主线程更新

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 21:58:50 +08:00
CodexandClaude Sonnet 4.5 96fdc96f24 refactor(cleanup): 移除剩余死代码模块
- 删除 douyin/utils/douyin_text_utils.py 及其测试
- 移除 performance_tracker.py 中未使用的 track_function 方法
- 移除 param_usage_tracer.py 中未使用的 stop_tracing / is_enabled
- 清理 bin/run_cli.py 和 tests/test_imports.py 中的残留引用

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 21:58:41 +08:00
CodexandClaude Sonnet 4.5 c4544489ac refactor(coords): 提取点击坐标常量,消除硬编码
在 coords.py 添加 DETAIL_OUTSIDE_CLICK、PARTICIPATE_BTN_CLICK、
FANSCLUB_JOIN_CLICK、FANSCLUB_JOIN_FALLBACK_CLICK 常量,
替换 fudai_attend/fansclub_handler/join_decision 中的硬编码坐标。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 21:20:17 +08:00
CodexandClaude Sonnet 4.5 d19d5bfc56 refactor(cleanup): 移除 logging 模块死代码
- unified_logger.py: 删除 5 个从未使用的装饰器/函数
- internal_loggers.py: 删除 3 个未使用方法和工厂函数
- action_logger.py: 删除 3 个未使用方法
- log_formatter.py: 删除 6 个未使用格式化函数(保留 GUI 依赖的 4 个)
- 同步更新 __init__.py 和测试文件

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 21:04:35 +08:00
CodexandClaude Sonnet 4.5 703da834fb fix(security): 修复 shell 注入风险和类型转换未捕获问题
- path_config.py: find_executable Unix 回退路径使用 shlex.quote 防注入
- underlying_operations.py: try_set_ime IME ID 使用 shlex.quote 防注入
- screenshot_direct.py: 环境变量 float/int 转换添加 try/except 容错
- device_select.py: 用户输入 int() 转换添加 try/except 容错
- read_once.py / image_acquirer.py / detail_verifier.py: PIL Image 添加 close()
- detector.py: 移除 return 后不可达死代码
- optimized_entry.py: 统一返回值类型 int,失败时返回 0
- read_once.py: 移除 try/except 中重复的相同代码

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 20:50:26 +08:00
CodexandClaude Sonnet 4.5 4908df19d4 refactor(cleanup): 移除死代码和冗余导入
- douyin_fudai_core.py: 移除未使用的 ThreadPoolExecutor/check_contain 导入
  和被覆盖的 fudai_result_checker 导入
- ocr_executor.py: 移除重复的 _fudai_ocr_executor_state 初始化
- flow_control_pkg: 移除 stage_handler/no_fudai/find_open 中未使用的导入

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 20:27:41 +08:00
CodexandClaude Sonnet 4.5 ca00258bf3 fix(code-quality): 修复 NameError 风险和死代码清理
- detect_by_template.py: 添加缺失的 os 和 path_config 导入
- join_decision.py: 添加缺失的 is_watch_task_fudai 导入
- read_once.py: 添加缺失的 Optional 类型导入
- fudai_detail_validator.py: 使用 extract_2digits 做更健壮的数字解析
- screenshot_manager: 移除未使用的导入和死代码

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 20:22:52 +08:00
CodexandClaude Sonnet 4.5 e62314fa25 fix(import): 修复 fudai_attend 相对导入路径错误
join_decision.py 在 fudai_filter_pkg 子包内,用 .fudai_attend 会查找
fudai_filter_pkg.fudai_attend(不存在),实际模块在上层 core 包。
改为 ..fudai_attend。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 19:26:58 +08:00
CodexandClaude Sonnet 4.5 df69c6ab67 fix(countdown): 修复长倒计时被截断到15分钟的bug
check_countdown 中 >900s 的上限过于激进,将实际的58分钟福袋截断到14:50。
改为 >3600s(1小时)上限,兼容抖音的60分钟福袋。

同时修复 _extract_digits 取后N位的问题,改为取前N位,
避免当子图意外捕获额外数字时(如 "1458")被误提取为 "58"。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 19:22:20 +08:00
CodexandClaude Sonnet 4.5 a50f08de5a fix(fudai): 验证失败时按钮可操作则继续参与
验证失败(如内容识别被禁用导致内容为空)时,若按钮状态为
"可以参与"/"需要加入粉丝团"等可操作状态,继续走参与流程而非
直接返回,避免漏参与有效福袋。同时修正 basic_join_decision 调用签名。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 19:03:51 +08:00
CodexandClaude Sonnet 4.5 8fd38dd30b fix(fudai): validator 内容检查正确尊重 disable 配置
当 config.json 中 fudai_disable_content_recognition=true 时,
跳过内容为空的检查。原实现在 except 块中丢失 disable_content
状态,导致配置生效时仍误判内容为空为验证失败。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 19:00:32 +08:00
CodexandClaude Sonnet 4.5 d850af2c44 fix(fudai): 验证器不再因内容为空而拒绝有效福袋
当奖品价值>0且倒计时合理时,内容为空是正常的(部分福袋无文字
内容),不应判定验证失败导致跳过参与。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 18:39:13 +08:00
Codex 2fab3f238e fix: entry-point scripts douyin.* import 失败 — sys.path 在 import 之后才设置
bin/run_cli.py 的 _BASE_DIR+sys.path.insert 原在 logging import 之后,
导致 No module named 'douyin' 警告。tools/ 下 5 个脚本完全缺失 sys.path
设置,auto_connect_wifi_adb.py 层级算错只跳到 tools/ 而非项目根。
2026-05-23 18:11:18 +08:00
Codex f750969df3 fix(deps): pin protobuf==3.20.3 修复 PaddleOCR 初始化失败回退到慢速 EasyOCR 2026-05-23 17:43:01 +08:00
Codex 842dd254e3 fix: correct import path for check_detail_height in detect_fudai_detail_page
The relative import from .douyin_detection was looking in the
douyin/detection/pixel/ package, but douyin_detection.py lives
at douyin/detection/douyin_detection.py. This caused every fudai
detail page detection to fail with detection_exception, making the
system always treat successful detail page opens as misclicks.
2026-05-23 17:05:43 +08:00
CodexandClaude Sonnet 4.5 6f38907119 fix(fudai/reservation): 修 3 处拆模块遗留 NameError
- douyin_fudai_core.py: get_fudai_contain 引用 TASK_LIST / PARTICIPATE_BUTTON
  但只导入了 LIVE_ROOM_TITLE,运行时必触发 NameError
- douyin_reservation_verify.py: match_reservation 末尾日志引用
  current_title,但该变量仅在 if expected_title 块内赋值,
  expected_title 为空时 NameError(被 try/except 吞掉但丢失日志)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 13:28:54 +08:00
CodexandClaude Sonnet 4.5 470c68a252 fix(fudai/stage): 修 reservation_check_start NameError + ocr_detection 缩进 + stage 默认值
- douyin_fudai.py: 补回 reservation_check_start 初始化(ffd048f 拆 helper 时丢失)
- ocr_detection.py: 修 _confirm_live_list 中 OCR 变量在 if 块外赋值的缩进 bug
- ocr_detection.py: shopping_redpacket_ocr_confidence_threshold 改 getattr 兜底 0.35
- douyin_stage.py: enable_ocr_mode1 默认值 False→True;像素检测未命中补 return
- config.json: 同步 enable_ocr_mode1 默认值

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-05-23 11:22:03 +08:00
CodexandClaude Opus 4.7 fe97e82104 fix(gui): 实时查看器/状态 Tab 的耗时解析支持 ms 单位
问题:实际 actions.log 写的是 `耗时=10.00ms`(毫秒),但 _parse_minimal
和 parse_action_duration 的正则只匹配 `s`,导致:
- 实时查看弹窗永远显示"暂无动作"
- 实时状态 Tab 同样空白

同时存在的副 bug:兜底正则在整行匹配,前缀里的 `192.168.5.2:5555` /
日志时间戳 `2026-05-21` 都可能被误识别成耗时。

修复:
- 解析窗口限定到 line.find("耗时") 之后的子串 (tail)
- 优先匹配 ms(顺序很重要:\s*s 会先吃掉 "10ms" 的 m)
- s 单位加 (?![a-zA-Z]) 负向后顾,避免匹配 "ms" / "second" 之类
- 同步修复 gui_app.py:3685 的 parse_action_duration(实时状态 Tab)

测试:
- _parse_minimal 加 4 个新测试覆盖 ms / 整数 ms / 优先级 / 前缀干扰
- 全量 1426 passed (+5)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 09:08:58 +08:00
CodexandClaude Opus 4.7 9f330572cc test(gui): 加 gui_app.main() 启动冒烟测试
背景:d759921 抽 _open_realtime_viewer_impl 时误删 16 行搜索工具栏定义,
gui_app 启动时报 NameError,但 pytest 1421 passed 没抓住——def main()
里的 NameError 只有真正调用 main() 才触发,单纯 import 不会执行函数体。

新测试通过 patch tk.Misc.mainloop 让 GUI 创建完所有控件后立刻 quit,
覆盖 def main() 内部所有顶层语句,能抓住 NameError / AttributeError /
ImportError 这类启动期失败。

已验证:临时 revert ca6c2e4 后该测试 FAIL(精确指向 L3994 NameError),
恢复 ca6c2e4 后 PASS。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 08:59:30 +08:00