Skip to content

Commit

Permalink
Delete remaining Mojang cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-goode committed Oct 29, 2024
1 parent 5c8bdf9 commit 04703d8
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 52 deletions.
22 changes: 3 additions & 19 deletions launcher/minecraft/auth/AccountData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,6 @@ bool AccountData::resumeStateFromV3(QJsonObject data)
bool needsElyByMigration = false;
if (typeS == "MSA") {
type = AccountType::MSA;
} else if (typeS == "Mojang") {
type = AccountType::Mojang;
} else if (typeS == "AuthlibInjector") {
type = AccountType::AuthlibInjector;
} else if (typeS == "Elyby") {
Expand All @@ -305,11 +303,6 @@ bool AccountData::resumeStateFromV3(QJsonObject data)
return false;
}

if (type == AccountType::Mojang) {
legacy = data.value("legacy").toBool(false);
canMigrateToMSA = data.value("canMigrateToMSA").toBool(false);
}

if (type == AccountType::AuthlibInjector) {
if (needsElyByMigration) {
customAuthServerUrl = "https://authserver.ely.by/api/authlib-injector/authserver";
Expand Down Expand Up @@ -369,14 +362,6 @@ QJsonObject AccountData::saveState() const
tokenToJSONV3(output, mojangservicesToken, "xrp-mc");
} else if (type == AccountType::Offline) {
output["type"] = "Offline";
} else if (type == AccountType::Mojang) {
if (legacy) {
output["legacy"] = true;
}
if (canMigrateToMSA) {
output["canMigrateToMSA"] = true;
}
output["type"] = "Mojang";
} else if (type == AccountType::AuthlibInjector) {
output["type"] = "AuthlibInjector";
output["customAuthServerUrl"] = customAuthServerUrl;
Expand Down Expand Up @@ -463,15 +448,15 @@ QString AccountData::accessToken() const

QString AccountData::clientToken() const
{
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) {
if (type != AccountType::AuthlibInjector) {
return QString();
}
return yggdrasilToken.extra["clientToken"].toString();
}

void AccountData::setClientToken(QString clientToken)
{
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) {
if (type != AccountType::AuthlibInjector) {
return;
}
yggdrasilToken.extra["clientToken"] = clientToken;
Expand All @@ -487,7 +472,7 @@ void AccountData::generateClientTokenIfMissing()

void AccountData::invalidateClientToken()
{
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) {
if (type != AccountType::AuthlibInjector) {
return;
}
yggdrasilToken.extra["clientToken"] = QUuid::createUuid().toString().remove(QRegularExpression("[{-}]"));
Expand All @@ -510,7 +495,6 @@ QString AccountData::profileName() const
QString AccountData::accountDisplayString() const
{
switch (type) {
case AccountType::Mojang:
case AccountType::AuthlibInjector: {
return userName();
}
Expand Down
10 changes: 4 additions & 6 deletions launcher/minecraft/auth/AccountData.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct MinecraftProfile {
Validity validity = Validity::None;
};

enum class AccountType { MSA, Mojang, AuthlibInjector, Offline };
enum class AccountType { MSA, AuthlibInjector, Offline };

enum class AccountState { Unchecked, Offline, Working, Online, Disabled, Errored, Expired, Gone };

Expand All @@ -104,13 +104,13 @@ struct AccountData {
QString servicesServerUrl() const;
QString authlibInjectorUrl() const;

//! userName for Mojang accounts, gamertag for MSA
//! userName for authlib-injector accounts, gamertag for MSA
QString accountDisplayString() const;

//! Only valid for Mojang accounts. MSA does not preserve this information
//! Only valid for authlib-injector accounts. MSA does not preserve this information
QString userName() const;

//! Only valid for Mojang accounts.
//! Only valid for authlib-injector accounts.
QString clientToken() const;
void setClientToken(QString clientToken);
void invalidateClientToken();
Expand All @@ -125,8 +125,6 @@ struct AccountData {
QString lastError() const;

AccountType type = AccountType::MSA;
bool legacy = false;
bool canMigrateToMSA = false;

QString customAuthServerUrl;
QString customAccountServerUrl;
Expand Down
11 changes: 0 additions & 11 deletions launcher/minecraft/auth/AccountList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,6 @@ QVariant AccountList::data(const QModelIndex& index, int role) const
return account->authlibInjectorUrl();
}

case MigrationColumn: {
if (account->accountType() != AccountType::Mojang) {
return tr("N/A", "Can Migrate");
}
if (account->canMigrate()) {
return tr("Yes", "Can Migrate");
} else {
return tr("No", "Can Migrate");
}
}

default:
return QVariant();
}
Expand Down
1 change: 0 additions & 1 deletion launcher/minecraft/auth/AccountList.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class AccountList : public QAbstractListModel {
// TODO: Add icon column.
ProfileNameColumn = 0,
NameColumn,
MigrationColumn,
TypeColumn,
StatusColumn,
AuthServerColumn,
Expand Down
14 changes: 0 additions & 14 deletions launcher/minecraft/auth/MinecraftAccount.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ class MinecraftAccount : public QObject, public Usable {

bool isActive() const;

bool canMigrate() const { return data.canMigrateToMSA; }

[[nodiscard]] AccountType accountType() const noexcept { return data.type; }

bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; }
Expand All @@ -142,12 +140,6 @@ class MinecraftAccount : public QObject, public Usable {
QString typeDisplayName() const
{
switch (data.type) {
case AccountType::Mojang: {
if (data.legacy) {
return tr("Legacy", "Account type");
}
return tr("Mojang", "Account type");
} break;
case AccountType::AuthlibInjector: {
return tr("authlib-injector", "Account type");
} break;
Expand All @@ -166,12 +158,6 @@ class MinecraftAccount : public QObject, public Usable {
QString typeString() const
{
switch (data.type) {
case AccountType::Mojang: {
if (data.legacy) {
return "legacy";
}
return "mojang";
} break;
case AccountType::AuthlibInjector: {
// This typeString gets passed to Minecraft; any Yggdrasil
// account should have the "mojang" type regardless of which
Expand Down
1 change: 0 additions & 1 deletion launcher/settings/INIFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

#include <QDebug>
#include <QFile>
#include <QSaveFile>
#include <QStringList>
#include <QTemporaryFile>
#include <QTextStream>
Expand Down

0 comments on commit 04703d8

Please sign in to comment.