Skip to content

Update Manager

EncodeX includes a custom in-app update manager that checks GitHub Releases for new versions, notifies the user, downloads the platform-specific installer with progress reporting, and launches the installer on completion.

Architecture

GitHub Releases API
       |
  [main/updater.ts]   fetches /releases/latest, compares versions, downloads
       |
  [main/ipc/updater.ts]  registers IPC handlers + pushes events to renderer
       |
  [preload/index.ts]  exposes checkForUpdates / downloadUpdate / events
       |
  [renderer/stores/updateStore.ts]  Zustand state for update flow
       |
  [renderer/components/UpdateDialog.tsx]  MUI Dialog with progress bar

IPC Channels

ChannelDirectionPurpose
check-for-updatesrenderer -> mainTrigger update check
download-updaterenderer -> mainStart downloading the matched asset
install-updaterenderer -> mainLaunch the downloaded installer
cancel-downloadrenderer -> mainCancel in-progress download
open-release-notesrenderer -> mainOpen release page in browser
update-availablemain -> rendererNotify that a new version is available
update-not-availablemain -> rendererNotify that app is up to date
update-progressmain -> rendererPush download progress
update-downloadedmain -> rendererNotify download completed
update-errormain -> rendererPush update error

Version Comparison

  • Simple semver comparison: split on ., compare numerically
  • Strips pre-release suffixes (e.g. -beta.0) for comparison
  • Returns true if remote version is strictly greater than local

Asset Selection Logic

  1. Filter release assets by platform extension:
    • win32 -> .exe
    • darwin -> .dmg
    • linux -> .AppImage
  2. Within platform, match architecture:
    • x64 -> filename contains x64
    • arm64 -> filename contains arm64
    • ia32 -> filename contains ia32
  3. Fall back to first platform-matched asset if arch match fails

Download Flow

  1. Renderer calls download-update IPC
  2. Main process downloads to app.getPath('temp')/EncodeX-updater/
  3. Progress pushed via update-progress every ~300ms
  4. On completion, update-downloaded sent with installer path
  5. Renderer shows "Install & Restart" button
  6. On click, main process launches installer via shell.openPath() + app.quit()

UI States

StateDialog Shows
idle(dialog hidden)
checkingSpinner + "Checking for updates..."
availableVersion info, release notes link, Download button
not-available"You're up to date" message, Close button
downloadingProgress bar with percentage + speed
downloaded"Update ready to install" + Install & Restart button
errorError message + Retry / Close buttons

Released under the MIT License.