diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-09-04 21:27:09 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-09-04 21:27:09 +0200 |
commit | 938f896bfa7775cf7dcf1ee6883572f514f53993 (patch) | |
tree | e95720f21a0e818e45659ce055b7306f81ee6919 /launcher/updater | |
parent | cd87029e6fc0c8d8b25c9162812ae066066ad11a (diff) | |
download | PrismLauncher-938f896bfa7775cf7dcf1ee6883572f514f53993.tar.gz PrismLauncher-938f896bfa7775cf7dcf1ee6883572f514f53993.tar.bz2 PrismLauncher-938f896bfa7775cf7dcf1ee6883572f514f53993.zip |
GH-4014 change updater to recognize new Qt 5.15.2 builds
Diffstat (limited to 'launcher/updater')
-rw-r--r-- | launcher/updater/DownloadTask.cpp | 2 | ||||
-rw-r--r-- | launcher/updater/UpdateChecker.cpp | 40 | ||||
-rw-r--r-- | launcher/updater/UpdateChecker.h | 4 |
3 files changed, 31 insertions, 15 deletions
diff --git a/launcher/updater/DownloadTask.cpp b/launcher/updater/DownloadTask.cpp index 20b26ebb..2c62ad24 100644 --- a/launcher/updater/DownloadTask.cpp +++ b/launcher/updater/DownloadTask.cpp @@ -170,4 +170,4 @@ OperationList DownloadTask::operations() return m_operations; } -}
\ No newline at end of file +} diff --git a/launcher/updater/UpdateChecker.cpp b/launcher/updater/UpdateChecker.cpp index be33c73c..eea73dcf 100644 --- a/launcher/updater/UpdateChecker.cpp +++ b/launcher/updater/UpdateChecker.cpp @@ -23,9 +23,12 @@ #define API_VERSION 0 #define CHANLIST_FORMAT 0 -UpdateChecker::UpdateChecker(QString channelListUrl, QString currentChannel, int currentBuild) +#include "BuildConfig.h" +#include "sys.h" + +UpdateChecker::UpdateChecker(QString channelUrl, QString currentChannel, int currentBuild) { - m_channelListUrl = channelListUrl; + m_channelUrl = channelUrl; m_currentChannel = currentChannel; m_currentBuild = currentBuild; } @@ -48,8 +51,7 @@ void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate) // later. if (!m_chanListLoaded) { - qDebug() << "Channel list isn't loaded yet. Loading channel list and deferring " - "update check."; + qDebug() << "Channel list isn't loaded yet. Loading channel list and deferring update check."; m_checkUpdateWaiting = true; m_deferredUpdateChannel = updateChannel; updateChanList(notifyNoUpdate); @@ -62,29 +64,43 @@ void UpdateChecker::checkForUpdate(QString updateChannel, bool notifyNoUpdate) return; } - m_updateChecking = true; - // Find the desired channel within the channel list and get its repo URL. If if cannot be // found, error. + QString stableUrl; m_newRepoUrl = ""; for (ChannelListEntry entry : m_channels) { - if (entry.id == updateChannel) + qDebug() << "channelEntry = " << entry.id; + if(entry.id == "stable") { + stableUrl = entry.url; + } + if (entry.id == updateChannel) { m_newRepoUrl = entry.url; - if (entry.id == m_currentChannel) + qDebug() << "is intended update channel: " << entry.id; + } + if (entry.id == m_currentChannel) { m_currentRepoUrl = entry.url; + qDebug() << "is current update channel: " << entry.id; + } } qDebug() << "m_repoUrl = " << m_newRepoUrl; - // If we didn't find our channel, error. + if (m_newRepoUrl.isEmpty()) { + qWarning() << "m_repoUrl was empty. defaulting to 'stable': " << stableUrl; + m_newRepoUrl = stableUrl; + } + + // If nothing applies, error if (m_newRepoUrl.isEmpty()) { - qCritical() << "m_repoUrl is empty!"; + qCritical() << "failed to select any update repository for: " << updateChannel; emit updateCheckFailed(); return; } + m_updateChecking = true; + QUrl indexUrl = QUrl(m_newRepoUrl).resolved(QUrl("index.json")); auto job = new NetJob("GoUpdate Repository Index"); @@ -174,7 +190,7 @@ void UpdateChecker::updateChanList(bool notifyNoUpdate) return; } - if (m_channelListUrl.isEmpty()) + if (m_channelUrl.isEmpty()) { qCritical() << "Failed to update channel list. No channel list URL set." << "If you'd like to use MultiMC's update system, please pass the channel " @@ -184,7 +200,7 @@ void UpdateChecker::updateChanList(bool notifyNoUpdate) m_chanListLoading = true; NetJob *job = new NetJob("Update System Channel List"); - job->addNetAction(Net::Download::makeByteArray(QUrl(m_channelListUrl), &chanlistData)); + job->addNetAction(Net::Download::makeByteArray(QUrl(m_channelUrl), &chanlistData)); connect(job, &NetJob::succeeded, [this, notifyNoUpdate]() { chanListDownloadFinished(notifyNoUpdate); }); QObject::connect(job, &NetJob::failed, this, &UpdateChecker::chanListDownloadFailed); chanListJob.reset(job); diff --git a/launcher/updater/UpdateChecker.h b/launcher/updater/UpdateChecker.h index 91b6e26e..219c3c62 100644 --- a/launcher/updater/UpdateChecker.h +++ b/launcher/updater/UpdateChecker.h @@ -23,7 +23,7 @@ class UpdateChecker : public QObject Q_OBJECT public: - UpdateChecker(QString channelListUrl, QString currentChannel, int currentBuild); + UpdateChecker(QString channelUrl, QString currentChannel, int currentBuild); void checkForUpdate(QString updateChannel, bool notifyNoUpdate); /*! @@ -78,7 +78,7 @@ private: NetJobPtr chanListJob; QByteArray chanlistData; - QString m_channelListUrl; + QString m_channelUrl; QList<ChannelListEntry> m_channels; |