JBrowser Source Docs

jbrowser.services.updater

Generated from the source code of JBrowser 1.5.4.

jbrowser/services/updater.py · 353 lines

Automatic updates from GitHub Releases.

How it works 1. Once a day (and when you press Check for updates) JBrowser asks the GitHub Releases API for the latest published release of GITHUB_REPO:

   GET https://api.github.com/repos/<owner>/<repo>/releases/latest
  1. If the release's version (its tag, e.g. v1.4.1) is newer than __version__, the ribbon shows an Update button.
  2. Installing downloads JBrowser-Setup-<version>.exe from the release and verifies it against JBrowser-Setup-<version>.exe.sha256 (also a release asset). A download that does not match is deleted and never run.
  3. JBrowser starts a small hidden PowerShell helper and closes. The helper waits until JBrowser (and its web processes) have exited, then runs the installer with /SILENT /RELAUNCH. The installer replaces the program files and starts the new version. Your data in %APPDATA%\JBrowser is never touched by an update.

Only installed copies (with unins000.exe beside JBrowser.exe) update themselves. Portable builds and source checkouts are told about new versions and can open the release page instead. Releases are made with tools/release.ps1 (see docs/RELEASING.md).

Constants#

Name Value
API_LATEST f'https://api.github.com/repos/{GITHUB_REPO}/releases/latest'
CHECK_INTERVAL_S 24 * 3600
INSTALLER_RE re.compile('^JBrowser-Setup-(\\d+\\.\\d+\\.\\d+)\\.exe$', re.IGNORECASE)
MAX_INSTALLER_BYTES 1024 * 1024 * 1024

UpdateInfo#

class UpdateInfosource

Attributes

Name Value
version str
tag str
title str
notes str
page_url str
installer_name str = ''
installer_url str = ''
installer_size int = 0
checksum_url str = ''
published str = ''

UpdateService#

class UpdateService(QObject)source
UpdateService(settings: Settings, parent: QObject | None=None)

Checks for, downloads, verifies and launches updates. All network I/O is asynchronous.

Signals

Signal Arguments
stateChanged (str)
available (object)
downloadProgress (int, int)
readyToInstall (str)

UpdateService.current_version#

property current_versionsource

UpdateService.installed_copy#

static installed_copy() -> boolsource

True for an installer-managed copy, which can update itself.

UpdateService.start#

start(delay_ms: int=15000) -> Nonesource

UpdateService.maybe_check#

maybe_check() -> Nonesource

UpdateService.check#

check(manual: bool=True) -> Nonesource

UpdateService.skip#

skip(version: str) -> Nonesource

UpdateService.can_install#

can_install() -> boolsource

UpdateService.download#

download() -> Nonesource

Fetch the checksum, then the installer; verify before announcing it.

UpdateService.signature_problem#

static signature_problem(installer: str) -> strsource

Once JBrowser itself is code-signed, an update must be signed by the same publisher. Returns why installer fails that, or "" (also while JBrowser is unsigned).

UpdateService.cancel_download#

cancel_download() -> Nonesource

UpdateService.launch_installer#

launch_installer(pid: int) -> boolsource

Start the hidden helper that waits for this process to exit and then runs the installer. The caller must close JBrowser straight afterwards.

Functions#

parse_version#

parse_version(text: str) -> tuple[int, int, int] | Nonesource

"v1.4.0" / "1.4" -> (1, 4, 0); anything else -> None.

is_newer#

is_newer(candidate: str, current: str=__version__) -> boolsource