aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/CMakeLists.txt23
-rw-r--r--launcher/MultiMC.cpp49
-rw-r--r--launcher/minecraft/auth/flows/AuthContext.cpp14
-rw-r--r--launcher/pages/global/AccountListPage.cpp21
-rw-r--r--launcher/pages/global/MultiMCPage.cpp3
-rw-r--r--launcher/updater/DownloadTask.cpp2
-rw-r--r--launcher/updater/UpdateChecker.cpp40
-rw-r--r--launcher/updater/UpdateChecker.h4
8 files changed, 123 insertions, 33 deletions
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 7a5e4173..c29ee3e1 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -949,9 +949,7 @@ install(TARGETS MultiMC
RUNTIME DESTINATION ${BINARY_DEST_DIR} COMPONENT Runtime
)
-if(MultiMC_EMBED_SECRETS)
- target_link_libraries(MultiMC_logic secrets)
-endif()
+target_link_libraries(MultiMC_logic secrets)
#### The MultiMC bundle mess! ####
# Bundle utilities are used to complete the portable packages - they add all the libraries that would otherwise be missing on the target system.
@@ -985,6 +983,14 @@ if(INSTALL_BUNDLE STREQUAL "full")
COMPONENT Runtime
REGEX "minimal|linuxfb|offscreen" EXCLUDE
)
+ # Style plugins
+ if(EXISTS "${QT_PLUGINS_DIR}/styles")
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ )
+ endif()
else()
# Image formats
install(
@@ -1016,6 +1022,17 @@ if(INSTALL_BUNDLE STREQUAL "full")
REGEX "_debug\\." EXCLUDE
REGEX "\\.dSYM" EXCLUDE
)
+ # Style plugins
+ if(EXISTS "${QT_PLUGINS_DIR}/styles")
+ install(
+ DIRECTORY "${QT_PLUGINS_DIR}/styles"
+ DESTINATION ${PLUGIN_DEST_DIR}
+ COMPONENT Runtime
+ REGEX "d\\." EXCLUDE
+ REGEX "_debug\\." EXCLUDE
+ REGEX "\\.dSYM" EXCLUDE
+ )
+ endif()
endif()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/install_prereqs.cmake.in"
diff --git a/launcher/MultiMC.cpp b/launcher/MultiMC.cpp
index 5961a45d..c532ce82 100644
--- a/launcher/MultiMC.cpp
+++ b/launcher/MultiMC.cpp
@@ -91,7 +91,8 @@ using namespace Commandline;
"This usually fixes the problem and you can move the application elsewhere afterwards.\n"\
"\n"
-static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
+namespace {
+void appDebugOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
const char *levels = "DWCFIS";
const QString format("%1 %2 %3\n");
@@ -111,6 +112,47 @@ static void appDebugOutput(QtMsgType type, const QMessageLogContext &context, co
fflush(stderr);
}
+QString getIdealPlatform(QString currentPlatform) {
+ auto info = Sys::getKernelInfo();
+ switch(info.kernelType) {
+ case Sys::KernelType::Darwin: {
+ if(info.kernelMajor >= 17) {
+ // macOS 10.13 or newer
+ return "osx64-5.15.2";
+ }
+ else {
+ // macOS 10.12 or older
+ return "osx64";
+ }
+ }
+ case Sys::KernelType::Windows: {
+ // FIXME: 5.15.2 is not stable on Windows, due to a large number of completely unpredictable and hard to reproduce issues
+ break;
+/*
+ if(info.kernelMajor == 6 && info.kernelMinor >= 1) {
+ // Windows 7
+ return "win32-5.15.2";
+ }
+ else if (info.kernelMajor > 6) {
+ // Above Windows 7
+ return "win32-5.15.2";
+ }
+ else {
+ // Below Windows 7
+ return "win32";
+ }
+*/
+ }
+ case Sys::KernelType::Undetermined:
+ case Sys::KernelType::Linux: {
+ break;
+ }
+ }
+ return currentPlatform;
+}
+
+}
+
MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
{
#if defined Q_OS_WIN32
@@ -678,7 +720,10 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
// initialize the updater
if(BuildConfig.UPDATER_ENABLED)
{
- m_updateChecker.reset(new UpdateChecker(BuildConfig.CHANLIST_URL, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
+ auto platform = getIdealPlatform(BuildConfig.BUILD_PLATFORM);
+ auto channelUrl = BuildConfig.UPDATER_BASE + platform + "/channels.json";
+ qDebug() << "Initializing updater with platform: " << platform << " -- " << channelUrl;
+ m_updateChecker.reset(new UpdateChecker(channelUrl, BuildConfig.VERSION_CHANNEL, BuildConfig.VERSION_BUILD));
qDebug() << "<> Updater started.";
}
diff --git a/launcher/minecraft/auth/flows/AuthContext.cpp b/launcher/minecraft/auth/flows/AuthContext.cpp
index 1203dc5f..b4db6c2d 100644
--- a/launcher/minecraft/auth/flows/AuthContext.cpp
+++ b/launcher/minecraft/auth/flows/AuthContext.cpp
@@ -18,9 +18,7 @@
#include "katabasis/Globals.h"
#include "AuthRequest.h"
-#ifdef EMBED_SECRETS
#include "Secrets.h"
-#endif
#include "Env.h"
@@ -53,13 +51,18 @@ void AuthContext::finishActivity() {
}
void AuthContext::initMSA() {
-#ifdef EMBED_SECRETS
if(m_oauth2) {
return;
}
+
+ auto clientId = Secrets::getMSAClientID('-');
+ if(clientId.isEmpty()) {
+ return;
+ }
+
Katabasis::OAuth2::Options opts;
opts.scope = "XboxLive.signin offline_access";
- opts.clientIdentifier = Secrets::getMSAClientID('-');
+ opts.clientIdentifier = clientId;
opts.authorizationUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode";
opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
opts.listenerPorts = {28562, 28563, 28564, 28565, 28566};
@@ -71,7 +74,6 @@ void AuthContext::initMSA() {
connect(m_oauth2, &OAuth2::linkingSucceeded, this, &AuthContext::onOAuthLinkingSucceeded);
connect(m_oauth2, &OAuth2::showVerificationUriAndCode, this, &AuthContext::showVerificationUriAndCode);
connect(m_oauth2, &OAuth2::activityChanged, this, &AuthContext::onOAuthActivityChanged);
-#endif
}
void AuthContext::initMojang() {
@@ -538,7 +540,7 @@ void AuthContext::onSTSAuthGenericDone(
}
Katabasis::Token temp;
- if(!parseXTokenResponse(replyData, temp, "STSAuthGaneric")) {
+ if(!parseXTokenResponse(replyData, temp, "STSAuthGeneric")) {
qWarning() << "Could not parse authorization response for access to xbox API...";
failResult(m_xboxProfileSucceeded);
return;
diff --git a/launcher/pages/global/AccountListPage.cpp b/launcher/pages/global/AccountListPage.cpp
index 6bb07b22..74537712 100644
--- a/launcher/pages/global/AccountListPage.cpp
+++ b/launcher/pages/global/AccountListPage.cpp
@@ -37,6 +37,8 @@
#include "BuildConfig.h"
#include <dialogs/MSALoginDialog.h>
+#include "Secrets.h"
+
AccountListPage::AccountListPage(QWidget *parent)
: QMainWindow(parent), ui(new Ui::AccountListPage)
{
@@ -70,11 +72,8 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
- // Xbox authentication won't work without a client identifier, so disable the button
- // if the build didn't specify one (GH-4012)
-#ifndef EMBED_SECRETS
- ui->actionAddMicrosoft->setVisible(false);
-#endif
+ // Xbox authentication won't work without a client identifier, so disable the button if it is missing
+ ui->actionAddMicrosoft->setVisible(Secrets::hasMSAClientID());
}
AccountListPage::~AccountListPage()
@@ -129,6 +128,18 @@ void AccountListPage::on_actionAddMojang_triggered()
void AccountListPage::on_actionAddMicrosoft_triggered()
{
+ if(BuildConfig.BUILD_PLATFORM == "osx64") {
+ CustomMessageBox::selectable(
+ this,
+ tr("Microsoft Accounts not available"),
+ tr(
+ "Microsoft accounts are only usable on macOS 10.13 or newer, with fully updated MultiMC.\n\n"
+ "Please update both your operating system and MultiMC."
+ ),
+ QMessageBox::Warning
+ )->exec();
+ return;
+ }
MinecraftAccountPtr account = MSALoginDialog::newAccount(
this,
tr("Please enter your Mojang account email and password to add your account.")
diff --git a/launcher/pages/global/MultiMCPage.cpp b/launcher/pages/global/MultiMCPage.cpp
index d383e6ed..5d43b187 100644
--- a/launcher/pages/global/MultiMCPage.cpp
+++ b/launcher/pages/global/MultiMCPage.cpp
@@ -58,8 +58,7 @@ MultiMCPage::MultiMCPage(QWidget *parent) : QWidget(parent), ui(new Ui::MultiMCP
if(BuildConfig.UPDATER_ENABLED)
{
- QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this,
- &MultiMCPage::refreshUpdateChannelList);
+ QObject::connect(MMC->updateChecker().get(), &UpdateChecker::channelListLoaded, this, &MultiMCPage::refreshUpdateChannelList);
if (MMC->updateChecker()->hasChannels())
{
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;