UpdateCheck.h header
#include <ew/app/UpdateCheck.h>
Namespace ew::app
UpdateManifest struct
struct ew::app::UpdateManifest
The published description of the newest release, fetched from the well-known manifest URL (https://dl.easywriter.site/latest.json, written by tools/web/publish-release.ps1). The desktop uses it to flag "an update is available" and to download + verify the installer.
Members
QString ew::app::UpdateManifest::version
The newest released version, e.g. "0.2.0".
QString ew::app::UpdateManifest::installerUrl
Where the installer lives. parseUpdateManifest guarantees this is HTTPS on the official download host – the manifest names a binary the app will RUN, so anything else is rejected wholesale.
QString ew::app::UpdateManifest::sha256
Hex SHA-256 of the installer bytes; the downloader verifies before launching anything.
QString ew::app::UpdateManifest::notesUrl
Where the human-readable release notes live (optional; empty when absent).
bool ew::app::UpdateManifest::operator==(const UpdateManifest &) const =default
Compares equal when every field matches.
Functions
int ew::app::compareVersions(const QString &a, const QString &b)
Compares two dotted-numeric versions ("1.2.10" style): negative when a < b, zero when equal, positive when a > b. Missing segments count as zero ("1.2" == "1.2.0"); non-numeric segments compare as zero.
bool ew::app::isNewerVersion(const QString ¤tVersion, const UpdateManifest &manifest)
True when manifest describes a strictly newer version than currentVersion.
std::optional< UpdateManifest > ew::app::parseUpdateManifest(const QByteArray &json)
Parses json (the fetched latest.json) into a manifest, or nullopt when it is malformed or unsafe. Unsafe means: missing/non-semantic version, missing/malformed SHA-256, or an installer URL that is not HTTPS on updateDownloadHost() – the manifest tells the app what binary to fetch and run, so a tampered or mis-hosted entry rejects the whole manifest rather than degrade.
bool ew::app::shouldAutoCheck(const QString &lastCheckIso, const QString &nowIso)
True when the automatic startup check should run: lastCheckIso (the stored ISO-8601 timestamp of the previous check, empty for never) is at least a day before nowIso. Keeps the automatic check to at most once per day; a manual Help-menu check ignores this.
QString ew::app::updateDownloadHost()
The one host an update may ever be downloaded from.
QString ew::app::updateManifestUrl()
The well-known manifest URL the app checks.