From 5c8bdf99cdc04d984ed0d10a2a920a5265c30b98 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Sun, 27 Oct 2024 13:19:33 -0400 Subject: [PATCH] Gray out "Manage Skins" button for authlib-injector accounts Support for this is blocked by https://github.com/unmojang/FjordLauncher/issues/37, which we can get to after the 9.0 release. --- launcher/minecraft/auth/AccountData.cpp | 5 +++++ launcher/minecraft/auth/AccountData.h | 1 + launcher/minecraft/auth/MinecraftAccount.h | 2 ++ launcher/minecraft/auth/Parsers.cpp | 1 + launcher/ui/pages/global/AccountListPage.cpp | 4 +++- 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/launcher/minecraft/auth/AccountData.cpp b/launcher/minecraft/auth/AccountData.cpp index 2f9d36dbf..8b0ac18a4 100644 --- a/launcher/minecraft/auth/AccountData.cpp +++ b/launcher/minecraft/auth/AccountData.cpp @@ -398,6 +398,11 @@ bool AccountData::usesCustomApiServers() const return type == AccountType::AuthlibInjector; } +bool AccountData::supportsSkinManagement() const +{ + return type == AccountType::MSA; +} + QString AccountData::authServerUrl() const { if (usesCustomApiServers()) { diff --git a/launcher/minecraft/auth/AccountData.h b/launcher/minecraft/auth/AccountData.h index 836265927..3ae23c30f 100644 --- a/launcher/minecraft/auth/AccountData.h +++ b/launcher/minecraft/auth/AccountData.h @@ -96,6 +96,7 @@ struct AccountData { QJsonObject saveState() const; bool resumeStateFromV3(QJsonObject data); + bool supportsSkinManagement() const; bool usesCustomApiServers() const; QString authServerUrl() const; QString accountServerUrl() const; diff --git a/launcher/minecraft/auth/MinecraftAccount.h b/launcher/minecraft/auth/MinecraftAccount.h index 5b479f7a1..d1889dfb2 100644 --- a/launcher/minecraft/auth/MinecraftAccount.h +++ b/launcher/minecraft/auth/MinecraftAccount.h @@ -119,6 +119,8 @@ class MinecraftAccount : public QObject, public Usable { bool usesCustomApiServers() const { return data.usesCustomApiServers(); } + bool supportsSkinManagement() const { return data.supportsSkinManagement(); } + QString accountDisplayString() const { return data.accountDisplayString(); } QString accessToken() const { return data.accessToken(); } diff --git a/launcher/minecraft/auth/Parsers.cpp b/launcher/minecraft/auth/Parsers.cpp index f9d89baa2..f61c05c5d 100644 --- a/launcher/minecraft/auth/Parsers.cpp +++ b/launcher/minecraft/auth/Parsers.cpp @@ -379,6 +379,7 @@ bool parseMinecraftProfileMojang(QByteArray& data, MinecraftProfile& output) // we don't know the cape ID as it is not returned from the session server // so just fake it - changing capes is probably locked anyway :( capeOut.alias = "cape"; + capeOut.id = "00000000-0000-0000-0000-000000000000"; } } } diff --git a/launcher/ui/pages/global/AccountListPage.cpp b/launcher/ui/pages/global/AccountListPage.cpp index 4d489fa98..384af07fe 100644 --- a/launcher/ui/pages/global/AccountListPage.cpp +++ b/launcher/ui/pages/global/AccountListPage.cpp @@ -238,15 +238,17 @@ void AccountListPage::updateButtonStates() bool hasSelection = !selection.empty(); bool accountIsReady = false; bool accountIsOnline = false; + bool accountSupportsSkinManagement = false; if (hasSelection) { QModelIndex selected = selection.first(); MinecraftAccountPtr account = selected.data(AccountList::PointerRole).value(); accountIsReady = !account->isActive(); accountIsOnline = account->accountType() != AccountType::Offline; + accountSupportsSkinManagement = account->supportsSkinManagement(); } ui->actionRemove->setEnabled(accountIsReady); ui->actionSetDefault->setEnabled(accountIsReady); - ui->actionManageSkins->setEnabled(accountIsReady && accountIsOnline); + ui->actionManageSkins->setEnabled(accountIsReady && accountIsOnline && accountSupportsSkinManagement); ui->actionRefresh->setEnabled(accountIsReady && accountIsOnline); if (m_accounts->defaultAccount().get() == nullptr) {