wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
UpdateChecker.h File Reference

Checks the wiRedPanda site's published release data for newer versions. More...

#include <QNetworkAccessManager>
#include <QObject>
#include <QString>
#include <QUrl>
#include <QVersionNumber>
Include dependency graph for UpdateChecker.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UpdateChecker
 Asynchronously queries the site's release data and emits a signal when a newer version is available. More...

Functions

bool isSafeGitHubUrl (const QUrl &url)
 True when url is safe to download from or hand to the OS's URL handler.
QString releaseAssetKey (const QString &platform, const QString &arch)
 The key in latest-release.json holding the download URL for the given platform ("Windows"/"macOS"/"Linux") and CPU arch token (a QSysInfo arch name, e.g. "x86_64", "arm64"), or an empty string if that combination isn't published.
bool shouldOfferUpdate (const QString &tagName, const QVersionNumber &currentVersion, const QString &skippedVersion)
 True when the release tagged tagName should be offered to a user running currentVersion who may have suppressed skippedVersion.

Detailed Description

Checks the wiRedPanda site's published release data for newer versions.

Definition in file UpdateChecker.h.

Function Documentation

◆ isSafeGitHubUrl()

bool isSafeGitHubUrl ( const QUrl & url)

True when url is safe to download from or hand to the OS's URL handler.

Exposed for testing. Requires scheme https and host github.com — the only shape the site's latest-release.json ever populates a download URL with (it's copied verbatim from GitHub's browser_download_url; the CDN redirect for the actual asset happens only after fetching this URL, so the field itself never contains the CDN's host). Guards against a compromised/corrupted release-data response smuggling a file:// path (silently copies a local file into the Downloads folder) or an unexpected scheme/UNC-style URL into QDesktopServices::openUrl.

Definition at line 74 of file UpdateChecker.cpp.

◆ releaseAssetKey()

QString releaseAssetKey ( const QString & platform,
const QString & arch )

The key in latest-release.json holding the download URL for the given platform ("Windows"/"macOS"/"Linux") and CPU arch token (a QSysInfo arch name, e.g. "x86_64", "arm64"), or an empty string if that combination isn't published.

Exposed for testing. Linux and Windows ship a per-architecture asset, so the arch token selects between two keys; macOS ships a single universal DMG and is keyed on platform alone.

Definition at line 36 of file UpdateChecker.cpp.

◆ shouldOfferUpdate()

bool shouldOfferUpdate ( const QString & tagName,
const QVersionNumber & currentVersion,
const QString & skippedVersion )

True when the release tagged tagName should be offered to a user running currentVersion who may have suppressed skippedVersion.

Exposed for testing. A release is offered only when its tag parses to a valid version that is strictly newer than the running application and whose normalized string does not match the user's per-version suppression.

Definition at line 63 of file UpdateChecker.cpp.