Skip to content

Commit

Permalink
Gray out "Manage Skins" button for authlib-injector accounts
Browse files Browse the repository at this point in the history
Support for this is blocked by
#37, which we can get to
after the 9.0 release.
  • Loading branch information
evan-goode committed Oct 27, 2024
1 parent fab399c commit 5c8bdf9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions launcher/minecraft/auth/AccountData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
1 change: 1 addition & 0 deletions launcher/minecraft/auth/AccountData.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions launcher/minecraft/auth/MinecraftAccount.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(); }
Expand Down
1 change: 1 addition & 0 deletions launcher/minecraft/auth/Parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion launcher/ui/pages/global/AccountListPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<MinecraftAccountPtr>();
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) {
Expand Down

0 comments on commit 5c8bdf9

Please sign in to comment.