aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2022-02-12 20:20:51 +0100
committerSefa Eyeoglu <contact@scrumplex.net>2022-02-12 21:27:32 +0100
commit0854e83ce48cb30b28bd05986970e506c1106e4e (patch)
tree96c708b11b854a9eaffd59f80faece8f9366ca66 /launcher
parentbb02226870a21c08ec534295ea0dcb8dd4c542cf (diff)
downloadPrismLauncher-0854e83ce48cb30b28bd05986970e506c1106e4e.tar.gz
PrismLauncher-0854e83ce48cb30b28bd05986970e506c1106e4e.tar.bz2
PrismLauncher-0854e83ce48cb30b28bd05986970e506c1106e4e.zip
feat: implement MSA client id override
Closes #11
Diffstat (limited to 'launcher')
-rw-r--r--launcher/Application.cpp10
-rw-r--r--launcher/Application.h2
-rw-r--r--launcher/minecraft/auth/steps/MSAStep.cpp2
-rw-r--r--launcher/ui/pages/global/AccountListPage.cpp2
4 files changed, 14 insertions, 2 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index 5e70c729..a3d6216e 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -1519,3 +1519,13 @@ QString Application::getJarsPath()
}
return m_jarsPath;
}
+
+QString Application::getMSAClientID()
+{
+ QString clientIDOverride = m_settings->get("MSAClientIDOverride").toString();
+ if (!clientIDOverride.isEmpty()) {
+ return clientIDOverride;
+ }
+
+ return BuildConfig.MSA_CLIENT_ID;
+}
diff --git a/launcher/Application.h b/launcher/Application.h
index c1cd8224..fb41d647 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -117,6 +117,8 @@ public:
QString getJarsPath();
+ QString getMSAClientID();
+
/// this is the root of the 'installation'. Used for automatic updates
const QString &root() {
return m_rootPath;
diff --git a/launcher/minecraft/auth/steps/MSAStep.cpp b/launcher/minecraft/auth/steps/MSAStep.cpp
index bc10aa4e..779aee43 100644
--- a/launcher/minecraft/auth/steps/MSAStep.cpp
+++ b/launcher/minecraft/auth/steps/MSAStep.cpp
@@ -14,7 +14,7 @@ using Activity = Katabasis::Activity;
MSAStep::MSAStep(AccountData* data, Action action) : AuthStep(data), m_action(action) {
OAuth2::Options opts;
opts.scope = "XboxLive.signin offline_access";
- opts.clientIdentifier = BuildConfig.MSA_CLIENT_ID;
+ opts.clientIdentifier = APPLICATION->getMSAClientID();
opts.authorizationUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode";
opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token";
diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp
index 396d320f..ea310acd 100644
--- a/launcher/ui/pages/global/AccountListPage.cpp
+++ b/launcher/ui/pages/global/AccountListPage.cpp
@@ -73,7 +73,7 @@ AccountListPage::AccountListPage(QWidget *parent)
updateButtonStates();
// Xbox authentication won't work without a client identifier, so disable the button if it is missing
- ui->actionAddMicrosoft->setVisible(BuildConfig.MSA_CLIENT_ID.size() != 0);
+ ui->actionAddMicrosoft->setVisible(!APPLICATION->getMSAClientID().isEmpty());
}
AccountListPage::~AccountListPage()