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

Checks the GitHub Releases API for newer versions of wiRedPanda. 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 GitHub Releases API and emits a signal when a newer version is available. More...

Functions

bool isMatchingReleaseAsset (const QString &name, const QString &platform, const QString &arch)
 True when a GitHub release asset filename is the binary for the given platform ("Windows"/"macOS"/"Linux") and CPU arch token (a QSysInfo arch name, e.g. "x86_64", "arm64").
bool isSafeGitHubUrl (const QUrl &url)
 True when url is safe to download from or hand to the OS's URL handler.
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 GitHub Releases API for newer versions of wiRedPanda.

Definition in file UpdateChecker.h.

Function Documentation

◆ isMatchingReleaseAsset()

bool isMatchingReleaseAsset ( const QString & name,
const QString & platform,
const QString & arch )

True when a GitHub release asset filename is the binary for the given platform ("Windows"/"macOS"/"Linux") and CPU arch token (a QSysInfo arch name, e.g. "x86_64", "arm64").

Exposed for testing. Linux (.AppImage) and Windows (.zip) releases ship a per-architecture asset, so the arch token must also match; macOS ships a single universal DMG and is matched on platform alone.

Definition at line 37 of file UpdateChecker.cpp.

◆ 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 GitHub's release JSON ever populates browser_download_url / html_url with (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/future-relaxed API 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 63 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 52 of file UpdateChecker.cpp.