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,10 +126,12 @@ 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+ for (auto & url : updateUpdaterUrls_) {
131+ qDebug () << " Updater update to" << url << " requested as relaunch action" ;
132+ }
131133 // It is assumed the process is already elevated
132- emit updaterUpdate (updateUpdaterUrl_ );
134+ emit updaterUpdate (updateUpdaterUrls_ );
133135 }
134136 return ;
135137
@@ -143,14 +145,19 @@ void SplashController::autoLaunchOrUpdate()
143145 // If no relaunch action, detect update needed based on versions.json
144146 if (!latestUpdaterVersion_.isEmpty () && latestUpdaterVersion_ != updaterAppVersion ()) {
145147 qDebug () << " Updater update to version" << latestUpdaterVersion_ << " required" ;
146- QString updaterArgs = " --splashms 1 --internalcommand updateupdater --updaterurl " + latestUpdaterUrls_.at (0 );
148+ QString updaterArgs = " --splashms 1 --internalcommand updateupdater" ;
149+
150+ for (auto & url : latestUpdaterUrls_) {
151+ updaterArgs += " --updaterurl " + url;
152+ }
153+
147154 // Remember the URL if we are doing updater update
148155 if (!connectUrl_.isEmpty ()) {
149156 updaterArgs += " -- " + connectUrl_;
150157 }
151158 switch (Sys::RelaunchElevated (updaterArgs)) {
152159 case Sys::ElevationResult::UNNEEDED:
153- emit updaterUpdate (latestUpdaterUrls_. at ( 0 ) );
160+ emit updaterUpdate (latestUpdaterUrls_);
154161 return ;
155162 case Sys::ElevationResult::RELAUNCHED:
156163 QCoreApplication::quit ();
0 commit comments