2323#include " system.h"
2424
2525SplashController::SplashController (
26- RelaunchCommand command, const QString& updateUpdaterUrl ,
26+ RelaunchCommand command, const QStringList& updateUpdaterUrls ,
2727 const QString& connectUrl, const Settings& settings) :
28- relaunchCommand_(command), updateUpdaterUrl_(updateUpdaterUrl ),
28+ relaunchCommand_(command), updateUpdaterUrls_(updateUpdaterUrls ),
2929 connectUrl_(connectUrl), settings_(settings) {}
3030
3131// Possibly initiates an asynchronous request for the latest available versions.
@@ -37,7 +37,7 @@ void SplashController::checkForUpdate()
3737 case RelaunchCommand::UPDATE_GAME:
3838 break ;
3939 case RelaunchCommand::UPDATE_UPDATER:
40- if (!updateUpdaterUrl_ .isEmpty ()) {
40+ if (!updateUpdaterUrls_ .isEmpty ()) {
4141 return ;
4242 }
4343 break ;
@@ -82,8 +82,8 @@ void SplashController::onCurrentVersions(QString updaterVersion, QStringList upd
8282
8383 emit newsUrlFetched (newsUrl);
8484
85- if (relaunchCommand_ == RelaunchCommand::UPDATE_UPDATER && updateUpdaterUrl_ .isEmpty ()) {
86- updateUpdaterUrl_ = latestUpdaterUrls_. at ( 0 ) ;
85+ if (relaunchCommand_ == RelaunchCommand::UPDATE_UPDATER && updateUpdaterUrls_ .isEmpty ()) {
86+ updateUpdaterUrls_ = latestUpdaterUrls_;
8787 emit updaterUpdateNeeded ();
8888 }
8989}
@@ -126,8 +126,11 @@ void SplashController::autoLaunchOrUpdate()
126126 // fetch has not succeeded yet. Only do something at that time when the updater url is
127127 // passed by command line. When the current.json fetch has succeeded, this function is
128128 // called again if there was no url passed by command line.
129- if (!updateUpdaterUrl_.isEmpty ()) {
130- qDebug () << " Updater update to" << updateUpdaterUrl_ << " requested as relaunch action" ;
129+ if (!updateUpdaterUrls_.isEmpty ()) {
130+ qDebug () << " Updater update requested as relaunch action" ;
131+ for (auto & url : updateUpdaterUrls_) {
132+ qDebug () << " Updater update available: " << url;
133+ }
131134 // It is assumed the process is already elevated
132135 emit updaterUpdate ();
133136 }
@@ -143,7 +146,12 @@ void SplashController::autoLaunchOrUpdate()
143146 // If no relaunch action, detect update needed based on versions.json
144147 if (!latestUpdaterVersion_.isEmpty () && latestUpdaterVersion_ != updaterAppVersion ()) {
145148 qDebug () << " Updater update to version" << latestUpdaterVersion_ << " required" ;
146- QString updaterArgs = " --splashms 1 --internalcommand updateupdater --updaterurl " + latestUpdaterUrls_.at (0 );
149+ QString updaterArgs = " --splashms 1 --internalcommand updateupdater" ;
150+
151+ for (auto & url : latestUpdaterUrls_) {
152+ updaterArgs += " --updaterurl " + url;
153+ }
154+
147155 // Remember the URL if we are doing updater update
148156 if (!connectUrl_.isEmpty ()) {
149157 updaterArgs += " -- " + connectUrl_;
0 commit comments