feat: 打开时提示新版本并自动更新

This commit is contained in:
Nixevol
2026-10-29 07:33:38 +08:00
parent 54d0460cfb
commit 623c7c28e9
10 changed files with 414 additions and 3 deletions
+9
View File
@@ -216,6 +216,14 @@ def hide_server_source(stage: Path) -> None:
raise SystemExit("服务端没有编译出字节码")
def write_version(stage: Path) -> None:
conf = json.loads((ROOT / "src-tauri" / "tauri.conf.json").read_text(encoding="utf-8"))
version = str(conf.get("version") or "").strip()
if not version:
raise SystemExit("没有版本号")
(stage / "version.json").write_text(json.dumps({"version": version}, ensure_ascii=False), encoding="utf-8")
def make_zip(stage: Path) -> Path:
suffix = "windows-x64" if sys.platform == "win32" else platform.system().lower()
archive = DIST / f"{STAGE_NAME}-{suffix}.zip"
@@ -251,6 +259,7 @@ def main() -> None:
if stage.exists():
shutil.rmtree(stage)
stage.mkdir(parents=True)
write_version(stage)
shutil.copy2(exe, stage / exe.name)
copy_server(stage)
ui_dest = stage / "dist" / "ui"