Windows Auto-Update Design
This document describes the minimum viable auto-update solution for JiuwenSwarm on Windows desktop. The goal is to prioritize stability over seamless upgrades.
Scope
- Windows desktop edition only
- Automatic update check on startup
- Manual update check via the sidebar "Update" page
- Update source: GitHub Releases
- Download artifact: Inno Setup installer
jiuwenswarm-setup-<version>.exe - After download, an external helper script performs a silent install and restarts the application
Out of Scope
- No incremental/delta updates
- No in-process self-replacement
- No macOS auto-install
- No version-skip, canary releases, or multi-channel distribution
- No forced updates
Core Flow
- After app launch, the frontend asynchronously calls
updater.check - The backend requests the GitHub Releases API for the latest release
- If a new version is found, it records the latest version, publish date, release notes, and installer download URL
- The user clicks "Download Update" on the Update page
- The backend downloads the installer to
%USERPROFILE%\\.jiuwenswarm\\.updatesin the background - After download completes, the frontend calls the pywebview API to trigger installation
- The desktop process writes a temporary
cmdhelper script that waits for the current process to exit - The helper runs the Inno Setup installer silently, then restarts the application
Update Source
Default GitHub Releases API:
https://api.github.com/repos/{owner}/{repo}/releases/latest
Fields read from the release:
tag_name— latest version numberbody— release notespublished_at— publish dateassets[]— the installer and optional sha256 file
Configuration
Update settings are in the updater section of config.yaml:
updater:
enabled: true
repo_owner: CharlieZhao95
repo_name: jiuwenswarm
release_api_url: ""
asset_name_pattern: "jiuwenswarm-setup-{version}.exe"
sha256_name_pattern: "jiuwenswarm-setup-{version}.exe.sha256"
timeout_seconds: 20
Backend API
Three WebSocket RPC methods are registered:
updater.get_statusupdater.checkupdater.download
Status values:
idlecheckingup_to_dateupdate_availabledownloadingdownloadedinstallingerrorunsupported
Installation Execution
To avoid replacing files while the main process is running, installation is not performed within the current process.
When the desktop process receives an install request from the frontend:
- It generates a temporary
cmdhelper script - The helper waits for the desktop main process to exit
- The helper runs the installer with:
/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /CLOSEAPPLICATIONS
- After installation completes, it restarts
jiuwenswarm.exe