Files
client/docs/updates.md
T

8.9 KiB

Updates

TeamsPeach updates itself only from published releases of the public Gitea repository https://git.eeee.moe/TeamsPeach/client. Branches, commits, Actions artifacts and draft releases are never used. The client needs no credentials; the release host, owner and repository are constants in the main process and the renderer cannot pass URLs.

How a check works

  1. app/main/update-source.js reads the complete release list anonymously (GET /api/v1/repos/TeamsPeach/client/releases?draft=false, every page, X-Total-Count checked, 20 s budget). A network failure, timeout, HTTP error, malformed body or incomplete listing is an error, never "up to date".
  2. Releases are filtered:
    • drafts and tags that are not v + strict SemVer (no build metadata, no leading zeros) are ignored;
    • only versions greater than the running one (SemVer precedence via semver, 0.1.2-rc.1 < 0.1.2) are considered — never the same version, never a downgrade;
    • channel policy (see below);
    • the release must contain this installation's feed and its exact installer name, otherwise it is listed in newerWithoutBuild (with a reason code) and an older complete release may be offered instead.
  3. For auto-update targets, a fresh electron-updater 6.8.11 instance (generic provider) reads the feed of the chosen release from https://git.eeee.moe/TeamsPeach/client/releases/download/<tag>/. The feed must describe the same version and list exactly one file: this target's installer by its exact builder name, present in the release with the same size and with a sha512. An arm64 feed pointing at the x64 AppImage, a renamed installer or a foreign path is refused. A feed that times out (60 s) ends the check with an error; the abandoned updater instance cannot influence later checks or downloads.
  4. electron-updater downloads the package and verifies its sha512 (a mismatch is reported as checksum and nothing becomes installable).

Checks run 15 s after start and every 6 hours, and on demand from Settings → Information.

Channels

Channel Accepts
preview (default) every published release, including prereleases
stable only releases that Gitea does not mark as prerelease and whose version has no prerelease part

A release counts as preview if either the Gitea flag or the SemVer prerelease part says so. The default is preview because the distribution currently ships prereleases; the setting is visible in Settings → Information (pref updateChannel). In the stable channel the state field newerPreview names the newest preview that the channel hides.

Platforms

Installation Detection Behaviour
Windows x64, NSIS installer Uninstall TeamsPeach.exe next to the executable download, then silent NSIS update after the user confirms; the installer starts the new version
Windows x64, NSIS installer, started with TEAMSPEACH_PROFILE_DIR as above + profile override notification only (mode: 'manual', manualReason: 'custom-profile'); never downloads or installs, update:install returns custom-profile even when the user confirms
Linux x64 / arm64 AppImage APPIMAGE environment variable download, then the AppImage file is replaced and the app relaunches after the user confirms
Windows x64 zip, Linux tar.gz otherwise notification only; "open release page"; the user replaces files manually
macOS, Windows ARM64, development runs — updates disabled (disabledCode) — no builds are published for them

AppImage install uses quitAndInstall(isSilent=true, isForceRunAfter=false): electron-updater swaps the file (a versioned file name such as TeamsPeach-0.1.2.AppImage becomes the new versioned name in the same directory, so shortcuts to the old name must be updated), then app.relaunch({ execPath }) starts the new AppImage only after the old process has exited, so the single-instance lock and the core's core.lock are free. NSIS uses quitAndInstall(true, true); whether the installer then succeeds happens after the app quit and is not reported by the app.

The first updater-capable version must be installed manually: 0.1.1 and older have no updater.

User confirmation and active sessions

Nothing is installed or restarted automatically (autoInstallOnAppQuit is off). While the app is connected to a server (voice or stream viewing) background downloads wait (deferred) and update:install returns session-active unless the user explicitly confirms the interruption. User data (identity.json, profile.json, prefs.json: UID, nickname, bookmarks, devices) lives in the profile directory and is not touched by updates.

IPC and state

Invoke-only channels: update:get-state, update:check, update:download, update:install({ confirmInterrupt }), update:open-release, update:set-channel; push channel update:state. All check the trusted sender. The state carries stable codes and parameters only (error: { code, params }, newerWithoutBuild[]: { version, code, params }, disabledCode); the renderer localizes them through the shared catalog (update.* keys). params.detail is raw technical text. The service log is logs/updater.log in the profile directory (English).

Release requirements

  • package.json build.publish (generic provider) makes electron-builder write the feeds: latest.yml (Windows), latest-linux.yml, latest-linux-arm64.yml; for a prerelease version X.Y.Z-rc.N they are rc.yml, rc-linux.yml, rc-linux-arm64.yml.
  • Package names must stay exactly as built: TeamsPeach-<v>.AppImage, TeamsPeach-<v>-arm64.AppImage, TeamsPeach-<v>-win-x64-setup.exe (+ .blockmap). Renaming breaks the feed.
  • scripts/update-feed-check.mjs verifies feed version, file names, sizes and sha512 against the files next to it; the release workflow runs it after packaging, and scripts/publish-release.mjs runs it before uploading and uploads feeds after all packages.
  • Windows assets built locally are appended to the published release with TOKEN=… API=… TAG=<tag> node scripts/publish-release.mjs --append <dir> (dir: setup exe, blockmap, feed, zip, build-info). It refuses to overwrite existing assets. Until the Windows feed is attached, Windows clients simply see no newer build.
  • Releases are created as prereleases unless PRERELEASE=false is set and the tag has no prerelease part.

Verification

  • test/update-source.test.js: selection, SemVer order (RC → final, no RC after final), drafts, channels, wrong architecture, missing assets, exact feed check, full paging, timeout / HTTP / garbage / redirect / refused connection. TEAMSPEACH_LIVE_UPDATE_TEST=1 adds a read of the live public release list.
  • test/update-engine.test.mjs: the real service and real electron-updater inside Electron against an emulated release server at the protocol layer — download and sha512 verification, corrupt checksum, wrong-arch feed, missing feed file, feed timeout followed by a late answer that must not contaminate the next download, unreachable server, stable channel, deferred download and install confirmation during a session. Needs a display on Linux (xvfb-run). Never installs.
  • .gitea/workflows/update-e2e.yml (manual): downloads an older published AppImage, runs it in a disposable profile under Xvfb with APPIMAGE_EXTRACT_AND_RUN=1, lets it update itself from the real release server, and checks the relaunched version, the installed file against the feed sha512, and that UID, nickname, bookmark and device preference are unchanged (scripts/update-e2e.mjs).
  • scripts/update-live-check.mjs --as <version>: real check, download and sha512 verification against the public release server through the platform's real updater (NSIS on Windows, AppImage on Linux) in a dev-mode harness with a temp profile and cache. It never installs.

Why the Windows install is not tested on a normal user account

A silent NSIS update with --force-run relaunches the app through StdUtils.ExecShellAsUser (templates/nsis/common.nsh, installSection.nsh), i.e. IShellDispatch2::ShellExecute of the desktop shell on the Start Menu shortcut. The new process inherits Explorer's environment, not the installer's, so a TEAMSPEACH_PROFILE_DIR test profile is not carried over, and the installer writes to the per-user installation registered for dev.teamspeach.desktop. An install test therefore needs a separate Windows account or VM; on a normal account only check, download and verification are exercised (update-live-check.mjs). For the same reason the product never self-updates an NSIS installation that runs on a TEAMSPEACH_PROFILE_DIR profile: the updated app would come back on the default profile, so such a run gets the release page and a reason instead (engine test scenario "custom profile"). The AppImage relaunch uses app.relaunch, which keeps the environment, so a custom profile survives it.