fix(launcher): bootstrap release state and signed manifest

This commit is contained in:
Comely
2026-07-10 02:38:04 -07:00
parent 9d632f3323
commit bec05cdbc8
13 changed files with 150 additions and 10 deletions
+1
View File
@@ -17,6 +17,7 @@ target_compile_features(Launcher PRIVATE cxx_std_17)
target_link_libraries(Launcher
PRIVATE
Common
UpdateClientUpdaterLogic
Qt5::Core
Qt5::Network
Qt5::Gui
+44 -2
View File
@@ -12,7 +12,9 @@
#include "../Common/TicketHelper.h"
#include "../Common/DeviceIdentityHelper.h"
#include "../Common/IntegrityHelper.h"
#include "../Common/ManifestBootstrapPolicy.h"
#include "../Common/TranslationHelper.h"
#include "../Updater/UpdaterLogic.h"
#include <QFile>
#include <QFileDialog>
#include <QDir>
@@ -198,7 +200,47 @@ int main(int argc, char *argv[])
const QString mainAppPath = QDir(appDir).filePath(mainExecutable);
const QString updaterPath = QDir(appDir).filePath(updaterExecutable);
IntegrityHelper integrity(config.installRoot());
if (!integrity.verifyInstalledVersion(appId, channel, currentVersion))
bool integrityVerified = integrity.verifyInstalledVersion(
appId, channel, currentVersion);
QString integrityError = integrity.errorString();
const UpdateClient::ManifestBootstrapAction bootstrapAction =
UpdateClient::manifestBootstrapAction(
integrity.isManifestCacheMissing(), networkOk, needUpdate,
targetVersionId);
if (!integrityVerified
&& bootstrapAction
== UpdateClient::ManifestBootstrapAction::FetchCurrentManifest)
{
UpdaterLogic manifestLogic;
manifestLogic.getManifest(
appId, channel, currentVersion, targetVersionId);
const QString cacheDirectory = QDir(config.updateRoot()).filePath(
QStringLiteral("manifest_cache"));
if (manifestLogic.verifyManifestSignature()
&& manifestLogic.saveManifestCache(cacheDirectory))
{
integrityVerified = integrity.verifyInstalledVersion(
appId, channel, currentVersion);
integrityError = integrity.errorString();
}
else
{
integrityError = QCoreApplication::translate(
"Launcher",
"The signed manifest for version %1 could not be fetched or cached.")
.arg(currentVersion);
}
}
else if (!integrityVerified
&& bootstrapAction
== UpdateClient::ManifestBootstrapAction::CurrentVersionNotPublished)
{
integrityError = QCoreApplication::translate(
"Launcher",
"Version %1 is not published on the update server. Publish this exact installed build before distribution so its signed manifest can be verified.")
.arg(currentVersion);
}
if (!integrityVerified)
{
progress.close();
QMessageBox::critical(
@@ -207,7 +249,7 @@ int main(int argc, char *argv[])
QCoreApplication::translate(
"Launcher",
"Application files failed signed manifest verification:\n%1")
.arg(integrity.errorString()));
.arg(integrityError));
return -1;
}
const auto importOfflinePackage = [&]()