feat(client): 迁移Hub更新客户端实现
This commit is contained in:
+21
-12
@@ -24,7 +24,7 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
QApplication::setApplicationName("Marsco Updater");
|
||||
QApplication::setApplicationName("SimCAE Updater");
|
||||
QTranslator translator;
|
||||
if (translator.load(":/i18n/update-client_zh_CN.qm"))
|
||||
app.installTranslator(&translator);
|
||||
@@ -35,10 +35,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
UpdaterLogic logic;
|
||||
QString offlinePackagePath;
|
||||
QString appId;
|
||||
QString channel;
|
||||
QString targetVersion;
|
||||
int targetVersionId = 0;
|
||||
QString appId;
|
||||
QString channel;
|
||||
QString targetVersion;
|
||||
QString releaseId;
|
||||
int targetVersionId = 0;
|
||||
if (argc >= 2 && QString(argv[1]).startsWith("--offline-package=")) {
|
||||
offlinePackagePath = QString(argv[1]).mid(QString("--offline-package=").size());
|
||||
if (!logic.loadOfflinePackage(offlinePackagePath)) {
|
||||
@@ -62,11 +63,13 @@ int main(int argc, char* argv[])
|
||||
appId = argv[1]; channel = argv[2]; targetVersion = argv[3]; targetVersionId = QString(argv[4]).toInt();
|
||||
}
|
||||
QString bootstrapResult;
|
||||
for (int i = 5; i < argc; ++i) {
|
||||
const QString arg = argv[i];
|
||||
if (arg.startsWith("--bootstrap-resume="))
|
||||
bootstrapResult = arg.mid(QString("--bootstrap-resume=").size());
|
||||
}
|
||||
for (int i = 5; i < argc; ++i) {
|
||||
const QString arg = argv[i];
|
||||
if (arg.startsWith("--bootstrap-resume="))
|
||||
bootstrapResult = arg.mid(QString("--bootstrap-resume=").size());
|
||||
else if (arg.startsWith("--release-id="))
|
||||
releaseId = arg.mid(QString("--release-id=").size());
|
||||
}
|
||||
const bool resumingFromBootstrap = !bootstrapResult.isEmpty();
|
||||
const QString runtimeDir = QApplication::applicationDirPath();
|
||||
|
||||
@@ -74,7 +77,13 @@ int main(int argc, char* argv[])
|
||||
const QString targetDir = config.installRoot();
|
||||
const QString updateDir = config.updateRoot();
|
||||
QDir().mkpath(updateDir);
|
||||
if (appId != config.getValue("App", "app_id") || channel != config.getValue("App", "channel")) {
|
||||
QString configuredProductCode = config.getValue("App", "product_code").trimmed();
|
||||
if (configuredProductCode.isEmpty())
|
||||
configuredProductCode = config.getValue("App", "app_id").trimmed();
|
||||
QString configuredChannel = config.getValue("App", "channel").trimmed();
|
||||
if (configuredChannel.isEmpty())
|
||||
configuredChannel = QStringLiteral("stable");
|
||||
if (appId != configuredProductCode || channel != configuredChannel) {
|
||||
QMessageBox::critical(nullptr,
|
||||
QCoreApplication::translate("Updater", "Offline Package Not Applicable"),
|
||||
QCoreApplication::translate("Updater", "The update package application or channel does not match the local configuration."));
|
||||
@@ -310,7 +319,7 @@ int main(int argc, char* argv[])
|
||||
withDetails(QCoreApplication::translate("Updater", "Cannot read the signed manifest cache after Bootstrap installation."),
|
||||
logic.errorString()));
|
||||
} else if (offlinePackagePath.isEmpty()) {
|
||||
logic.getManifest(appId, channel, targetVersion, targetVersionId);
|
||||
logic.getManifest(appId, channel, targetVersion, targetVersionId, releaseId);
|
||||
}
|
||||
if (!logic.verifyManifestSignature()) {
|
||||
if (resumingFromBootstrap)
|
||||
|
||||
Reference in New Issue
Block a user