feat: 支持双模式 exe 入口

This commit is contained in:
phoenixray2000
2026-05-18 01:53:20 +08:00
committed by ylytdeng
parent 728dbb72df
commit f3c32d4ca2
8 changed files with 363 additions and 27 deletions

View File

@@ -1,17 +1,18 @@
# -*- mode: python ; coding: utf-8 -*-
# PyInstaller spec — 打包 monitor_web.py 为单 exe。
# PyInstaller spec — 打包 wechat_decrypt_launcher.py 为双模式单 exe。
#
# 启动后:
# 1. 起 HTTP 服务 + 监听线程 (如 keys 已就绪)
# 2. 自动开浏览器到 http://localhost:5678
# 3. 用户在 Web UI 工具箱里操作 (解密 / 导出 / 朋友圈 / 企微 / 语音)
# 1. 无参数/ web: 起 HTTP 服务 + 自动开浏览器到 http://localhost:5678
# 2. 带 CLI 参数: 分发到 main.py / export_all_chats.py / 其他工具脚本
# 3. 兼容 Web UI 内部 sys.executable + script.py 的子进程调用
#
# (历史: 这个 spec 之前打包 tkinter app_gui.py, 现已删除 — 完全切到 Web UI)
# (历史: 这个 spec 之前打包 tkinter app_gui.py, 现默认是 Web UI + CLI)
from PyInstaller.utils.hooks import collect_all
# 所有子进程 (工具按钮触发) 需要的脚本, 打进 exe 同目录
datas = [
('monitor_web.py', '.'),
('main.py', '.'),
('config.py', '.'),
('config.example.json', '.'),
@@ -44,7 +45,13 @@ datas = [
binaries = []
hiddenimports = [
# 显式列, 避免 PyInstaller 漏 detect 导致打包后 import 报错
'argparse', 'csv', 'glob', 'hashlib', 'hmac', 'http.server', 'json',
'platform', 'queue', 'socketserver', 'sqlite3', '_sqlite3',
'subprocess', 'tempfile', 'threading', 'urllib.parse', 'uuid', 'wave',
'xml.etree.ElementTree',
'mcp', 'mcp.server', 'mcp.server.fastmcp',
'Crypto', 'Crypto.Cipher', 'Crypto.Cipher.AES',
'Crypto.Util', 'Crypto.Util.Padding',
'zstandard',
'pilk',
]
@@ -55,7 +62,7 @@ datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
a = Analysis(
['monitor_web.py'], # ← 入口从 app_gui.py 改成 monitor_web.py
['wechat_decrypt_launcher.py'],
pathex=[],
binaries=binaries,
datas=datas,