Skip to content

Commit 528fe0b

Browse files
committed
fix(release): prevent frozen backend worker relaunch during key scan
1 parent 7dbc5af commit 528fe0b

8 files changed

Lines changed: 23 additions & 8 deletions

File tree

desktop/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "wechat-data-analysis-desktop",
33
"private": true,
4-
"version": "1.11.2",
4+
"version": "1.11.3",
55
"main": "src/main.cjs",
66
"scripts": {
77
"dev": "node scripts/dev.cjs",

main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@
88
默认在10392端口启动API服务
99
"""
1010

11-
import uvicorn
11+
import multiprocessing
1212
import os
1313
from pathlib import Path
14+
15+
# Keep standalone/frozen launches safe when scanner code uses multiprocessing.
16+
if __name__ == "__main__":
17+
multiprocessing.freeze_support()
18+
19+
import uvicorn
1420
from wechat_decrypt_tool.network_access import get_lan_access_host
1521
from wechat_decrypt_tool.runtime_settings import read_effective_backend_host, read_effective_backend_port
1622

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "wechat-decrypt-tool"
3-
version = "1.11.2"
3+
version = "1.11.3"
44
description = "Modern WeChat database decryption tool with React frontend"
55
readme = "README.md"
66
requires-python = ">=3.11"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""微信数据库解密工具
22
"""
33

4-
__version__ = "1.11.1"
4+
__version__ = "1.11.3"
55
__author__ = "WeChat Decrypt Tool"

src/wechat_decrypt_tool/backend_entry.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
cannot detect reliably.
55
"""
66

7+
import multiprocessing
78
import os
89

10+
# PyInstaller/frozen Windows builds re-launch this executable for
11+
# multiprocessing workers. The memory/DLL key scanners use process pools; if
12+
# we import and start the FastAPI app before freeze_support() has a chance to
13+
# divert worker processes, every worker tries to bind the backend port again.
14+
if __name__ == "__main__":
15+
multiprocessing.freeze_support()
16+
917
import uvicorn
1018

1119
from wechat_decrypt_tool.api import app

src/wechat_decrypt_tool/key_service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import random
1919
import logging
2020
import asyncio
21+
import importlib
2122
import httpx
2223
from pathlib import Path
2324
from typing import Optional, List, Dict, Any
@@ -440,7 +441,7 @@ def _get_db_key_with_v4(
440441
candidate_plan.extend((candidate, "scan.py") for candidate in scan_candidates)
441442

442443
try:
443-
from . import key_v4 as key_v4_module
444+
key_v4_module = importlib.import_module(".key_v4", __package__)
444445
except Exception as e:
445446
raise RuntimeError(f"包内 key_v4.py 加载失败: {e}") from e
446447

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)