7 Commits

Author SHA1 Message Date
ylytdeng
9e38684bc6 revert: 恢复 tkinter app_gui.py, 改成 Web UI / 桌面 GUI 共存
## 用户反馈

上次 commit e826b1a "删除 tkinter, 完全切到 Web UI" 误解了用户意图。
用户原意是 "完全用 webUI, **用户可以选择**" → 指 Web UI 内部给用户
充分选择, 不是删 tkinter。

用户澄清: "我的意思是共存", 即两套 GUI 都保留, 用户按场景挑。

## 改动

### 恢复
- \`app_gui.py\` (939 行, 从 e826b1a^ restore, 含之前修的 --task bug fix)

### 保留 e826b1a 的合理部分 (不回滚)
- \`monitor_web.py\` 的 \`_start_monitor_if_ready\` 重构 (无 keys 仍能开
  Web UI) - 这个 standalone 改进, 跟 GUI 选哪个无关, 保留
- \`WeChatDecrypt.spec\` 入口 \`monitor_web.py\` (Web UI 体验更好, 默认
  打包它; 想打 tkinter exe 改 spec 那一行就行)
- \`build.bat\` 简化 (单一 source of truth = spec, 不重复 add-data 清单)

### README 改共存叙事
- Windows 快速开始拆 2 个 details:
  - "Web UI (推荐, 跨平台 + 实时监听)"
  - "桌面 GUI / EXE (tkinter, 适合不开浏览器的场景)"
- 文件清单 \`app_gui.py\` 那行回来, 说明跟 \`monitor_web.py\` 共存关系
- "GUI 工具箱" 章节重写: 先讲 Web UI 推荐路径 + 三 tab 能力, 再讲
  桌面 GUI 备用场景 (公司机器禁浏览器 / 全离线 / 喜欢传统桌面应用),
  最后讲打包 (默认 Web UI exe, 改 spec 可打 tkinter exe)

### EXE_USAGE.md 共存
- 结尾的 "为什么没 tkinter" 改成 "还有个 tkinter (备用)"
- 说明何时该用哪个 + 怎么打 tkinter 版 exe

## 实测

- app_gui.py syntax OK
- monitor_web.py syntax OK
- 测试 185/185 通过
2026-05-17 19:28:57 +08:00
ylytdeng
e826b1a565 refactor: 删除 tkinter app_gui.py, 完全切到 Web UI 作为唯一入口
## 决策背景

用户反馈 "windows GUI 太难看了, 还是完全用 webUI 吧, 用户可以选择"。

tkinter app_gui.py (PR #107 引入, 929 行) 的问题:
- 中文字体下渲染糊 ("WeChat Decrypt 工具箱" 标题模糊)
- 90 年代 Windows 控件风格, 不暗色不现代
- 只能跑 Windows, 不跨平台
- 没法远程访问
- 跟 Web UI 维护两套, 重复

Web UI (monitor_web.py) 已经完全对齐功能:
- 8 个工具按钮 (3 tab 分组: 个人微信 / 企微 / 工具)
- 终止按钮 + 实时日志推送
- 导出筛选模态框 (会话搜索/复选/格式选择, close #112)
- 跟实时消息监听共享 SSE 通道
- Lucide SVG icon 统一风格 (无 emoji)
- 暗色主题 + design tokens + 玻璃质感顶栏

## 改动

### 删除
- \`app_gui.py\` (929 行 tkinter GUI)

### monitor_web.py
拆 \`main()\` → \`_start_monitor_if_ready()\` + 精简的 \`main()\`:

之前: keys 不存在 → \`sys.exit(1)\` 直接挂

现在: keys 不存在 → 跳过监听线程启动, 仅起 Web UI 服务。
用户从工具箱点 "① 提取密钥 + 解密数据库" 跑完后重启进程, 监听自动激活。
这样 exe 用户第一次双击时不会报错挂掉, 而是看到 Web UI 工具箱可以
直接用。

新启动流程: \`_start_monitor_if_ready\` 检查 keys 文件 / session.db
密钥 / session.db 路径都 OK 才启 monitor_thread, 任一不满足都给友好
提示但不退出。

### WeChatDecrypt.spec
- 入口 \`app_gui.py\` → \`monitor_web.py\`
- datas 清单补全 (加 export_all_chats / chat_export_helpers /
  batch_decrypt_images / transcribe_chat 等之前漏的)
- hiddenimports 显式列 Crypto / zstandard / pilk (避免 PyInstaller
  漏 detect)

### build.bat
- 删 30 行重复的 --add-data 清单 (跟 .spec 漂移风险)
- 改成 \`pyinstaller --noconfirm WeChatDecrypt.spec\`
- 单一 source of truth 是 .spec
- 完成提示从 "GUI 启动" 改成 "双击 → 浏览器开 Web UI"

### EXE_USAGE.md
完全重写为 Web UI 视角:
- 快速开始: 双击 exe → 浏览器自动打开
- 工具箱 3 tab 各自能力详解
- 导出筛选模态框使用说明
- 任务终止说明
- 输出目录布局
- 远程访问说明
- 结尾解释为什么去掉了 tkinter

### README.md
- 三平台 quick-start 里 "Windows GUI / EXE" → "Windows Web UI / EXE"
- 文件清单: \`app_gui.py\` 那行 → \`monitor_web.py\` (新身份: Web UI
  总入口)
- 技术细节里 "GUI 工具箱" 章节重写: 强调 Web UI 优势 (筛选模态框 /
  终止按钮 / 跨平台 / 远程访问 / 跟监听共存) + 末尾 1 句历史说明
  解释 tkinter 已删除

## 实测

- python monitor_web.py: keys 在 → 正常启动监听 + Web UI
- python monitor_web.py: 假装 keys 不在 → 跳过监听, Web UI 仍能开,
  用户从工具箱点 "① 提取密钥" 后重启即激活
- 测试 185/185 通过

## 没改 (留 follow-up)

- 实际打包 .spec 验证 (需要 Win 跑 pyinstaller, 没在 CI 跑)
- monitor_web 启动后**自动**检测 keys 文件 mtime 变化重启监听, 不需要
  用户手动重启进程 (现在的设计是"重启进程才激活")
2026-05-17 19:22:47 +08:00
ylytdeng
e9ff0d3287 fix(app_gui): _run_subprocess 漏 __file__ 导致开发模式 GUI 所有按钮失效
## 问题

GUI 点任何子任务按钮 (⑤ 企微解密 / ③ 导出 / 等), 日志报:

  unknown option --task
  usage: ... python.exe [option] ... [-c cmd | -m mod | file | -] [arg]...

返回码 2, 任务失败。

## 根因

`_run_subprocess` 构造的命令是:

  cmd = [sys.executable, "--task", task]

打包成 exe (sys.frozen=True) 时 sys.executable 就是 WeChatDecrypt.exe
本身, `--task` 是它的 argparse 子命令, 命令变成
`WeChatDecrypt.exe --task find_wxwork_keys` —— OK。

开发模式 (`python app_gui.py`) 时 sys.executable 是 python.exe,
命令变成 `python.exe --task find_wxwork_keys`, 但 `--task` 不是 python
解释器的选项, 直接报 unknown option。

## 修复

判断是否打包:

  if getattr(sys, "frozen", False):
      cmd = [sys.executable, "--task", task]
  else:
      cmd = [sys.executable, os.path.abspath(__file__), "--task", task]

加注释说明两种模式下命令行长什么样。

## 影响

- 开发模式 GUI 之前完全废, 任何按钮点了都报错。修复后恢复正常。
- 打包成 exe 路径未受影响 (该分支保持原行为)。

## 实测

本地 (Windows) 跑 `python app_gui.py`, 点 ⑤ 企业微信解密 现在能正常调
find_wxwork_keys 并解出 17 个 db。

发现路径: code review (4 个 reviewer 之一) 提到 GUI subprocess 调用方式
但没指出具体 bug, 用户实测点按钮时通过日志 `unknown option --task` 暴露。
2026-05-17 17:15:24 +08:00
xincheng
16940a8771 update 2026-05-17 06:50:11 +08:00
xincheng
ecc1cfca64 增加企业微信的解密 2026-05-17 06:24:08 +08:00
xincheng
b9f3161f84 Add SNS/image export and GUI contact export
Introduce SNS (朋友圈) and batch image tooling and enhance the GUI export workflow. Added new scripts: decrypt_sns.py (decrypt WeChat SNS cache) and batch_decrypt_images.py (bulk .dat image decrypt). Update build scripts and PyInstaller spec to include the new files. app_gui.py: add contact discovery, contact selection/export options dialog, new buttons (find image key, SNS), orchestrate combined export/voice/SNS tasks via subprocesses and env flags, and auto-run export after decryption. config.py: add output_base_dir, auto-detect WeChat Files path, and expose msgattach/xwechat cache dirs. export_messages.py: switch to output_base_dir, add image resource lookup and .dat locating/decryption helpers, and support environment-driven contact/format/image filters. Misc: update build.bat and packaging datas to include the new modules.

Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
2026-04-06 23:57:51 +08:00
xincheng
a84698b9fc Add GUI, packaging and export/voice tools
Introduce a tkinter GUI and tooling to produce a single executable and export/convert message data. Adds app_gui.py (GUI launcher that runs decrypt/export/voice subtasks), export_messages.py (export messages to CSV/HTML/JSON), voice_to_mp3.py (extract SILK_V3 voice blobs and convert to MP3 via pilk + ffmpeg), WeChatDecrypt.spec and build.bat (PyInstaller spec and convenience build script), and EXE_USAGE.md (usage for the standalone exe). Update config.py to detect the application base directory when packaged, update README.md to document the GUI and packaging flow, and add pilk/pyinstaller to requirements.txt. Also expand .gitignore with common IDE/build/temp patterns and add output/data directories to ignore. These changes enable one-file packaging and provide end-user tools for decrypting, exporting and converting audio.
2026-04-04 06:12:03 +08:00