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::update::UpdateManifest::version

The newest released version, e.g. "0.2.0".

QString ew::app::update::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::update::UpdateManifest::sha256

Hex SHA-256 of the installer bytes; the downloader verifies before launching anything.

QString ew::app::update::UpdateManifest::notesUrl

Where the human-readable release notes live (optional; empty when absent).

bool ew::app::update::UpdateManifest::operator==(const UpdateManifest &) const =default

Compares equal when every field matches.

Functions

int ew::app::update::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::update::isNewerVersion(const QString &currentVersion, const UpdateManifest &manifest)

True when manifest describes a strictly newer version than currentVersion.

QString ew::app::update::legacyUpdateManifestUrl()

The pre-0.2.0 manifest URL, tried only when updateManifestUrl() cannot be reached.

Insurance against a one-way door: an install whose only manifest host became unreachable could never hear about a release again, and no amount of later server-side fixing would reach it.

std::optional< UpdateManifest > ew::app::update::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 one of updateDownloadHosts() – 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.

QStringList ew::app::update::updateDownloadHosts()

Every host an update installer may be downloaded from, current first.

There are two, and it is a deliberate migration rather than an oversight. Releases live on dl.ordfoss.com from 0.2.0 onwards. dl.easywriter.site stays accepted permanently because builds older than 0.2.0 know only that host and reject a manifest whose installer is served anywhere else – so the single release that carries those users across must be published there too. Accepting both also means a manifest can be re-pointed later without stranding anyone.

QString ew::app::update::updateManifestUrl()

The well-known manifest URL the app checks.