fix(launcher): bootstrap release state and signed manifest
This commit is contained in:
@@ -19,6 +19,11 @@ IntegrityHelper::IntegrityHelper(const QString& installDir)
|
||||
|
||||
QString IntegrityHelper::errorString() const { return m_error; }
|
||||
|
||||
bool IntegrityHelper::isManifestCacheMissing() const
|
||||
{
|
||||
return m_manifestCacheMissing;
|
||||
}
|
||||
|
||||
bool IntegrityHelper::safeRelativePath(const QString& path) const
|
||||
{
|
||||
const QString clean = QDir::cleanPath(QDir::fromNativeSeparators(path));
|
||||
@@ -82,14 +87,20 @@ bool IntegrityHelper::verifyInstalledVersion(const QString& appId, const QString
|
||||
const QString& version)
|
||||
{
|
||||
m_error.clear();
|
||||
m_manifestCacheMissing = false;
|
||||
QString cachePath = QDir(ConfigHelper::instance().updateRoot()).filePath(
|
||||
"manifest_cache/manifest_" + version + ".json");
|
||||
const QString legacyCachePath = QDir(m_installDir).filePath(
|
||||
"update/manifest_cache/manifest_" + version + ".json");
|
||||
if (!QFile::exists(cachePath))
|
||||
cachePath = legacyCachePath;
|
||||
if (!QFile::exists(cachePath)) {
|
||||
m_manifestCacheMissing = true;
|
||||
m_error = "signed manifest cache missing for " + version;
|
||||
return false;
|
||||
}
|
||||
QFile cache(cachePath);
|
||||
if (!cache.open(QIODevice::ReadOnly)) { m_error = "signed manifest cache missing for " + version; return false; }
|
||||
if (!cache.open(QIODevice::ReadOnly)) { m_error = "cannot read signed manifest cache for " + version; return false; }
|
||||
QJsonParseError wrapperError;
|
||||
const QJsonDocument wrapperDoc = QJsonDocument::fromJson(cache.readAll(), &wrapperError);
|
||||
if (wrapperError.error != QJsonParseError::NoError || !wrapperDoc.isObject()) {
|
||||
|
||||
Reference in New Issue
Block a user