|
wiRedPanda
Logic Circuit Simulator
|
#include "App/Core/UpdateChecker.h"#include <QDate>#include <QDebug>#include <QJsonDocument>#include <QJsonObject>#include <QNetworkReply>#include <QNetworkRequest>#include <QSslError>#include <QSysInfo>#include <QVersionNumber>#include "App/Core/Settings.h"#include "App/Versions.h"Go to the source code of this file.
Functions | |
| static QString | currentPlatform () |
| 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 ¤tVersion, const QString &skippedVersion) |
True when the release tagged tagName should be offered to a user running currentVersion who may have suppressed skippedVersion. | |
Variables | |
| static constexpr auto | k_releaseDataUrl = "https://gibis-unifesp.github.io/wiRedPanda/latest-release.json" |
|
static |
Compile-time name of the platform this binary was built for, matching the platform token releaseAssetKey() expects.
Definition at line 23 of file UpdateChecker.cpp.
| 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.
| 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.
| 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.
|
staticconstexpr |
Definition at line 19 of file UpdateChecker.cpp.
Referenced by UpdateChecker::checkForUpdates().