Delete remaining Mojang cruft

This commit is contained in:
Evan Goode 2024-10-28 22:07:15 -04:00
parent 5c8bdf99cd
commit 04703d83ee
6 changed files with 7 additions and 52 deletions

View File

@ -290,8 +290,6 @@ bool AccountData::resumeStateFromV3(QJsonObject data)
bool needsElyByMigration = false; bool needsElyByMigration = false;
if (typeS == "MSA") { if (typeS == "MSA") {
type = AccountType::MSA; type = AccountType::MSA;
} else if (typeS == "Mojang") {
type = AccountType::Mojang;
} else if (typeS == "AuthlibInjector") { } else if (typeS == "AuthlibInjector") {
type = AccountType::AuthlibInjector; type = AccountType::AuthlibInjector;
} else if (typeS == "Elyby") { } else if (typeS == "Elyby") {
@ -305,11 +303,6 @@ bool AccountData::resumeStateFromV3(QJsonObject data)
return false; return false;
} }
if (type == AccountType::Mojang) {
legacy = data.value("legacy").toBool(false);
canMigrateToMSA = data.value("canMigrateToMSA").toBool(false);
}
if (type == AccountType::AuthlibInjector) { if (type == AccountType::AuthlibInjector) {
if (needsElyByMigration) { if (needsElyByMigration) {
customAuthServerUrl = "https://authserver.ely.by/api/authlib-injector/authserver"; customAuthServerUrl = "https://authserver.ely.by/api/authlib-injector/authserver";
@ -369,14 +362,6 @@ QJsonObject AccountData::saveState() const
tokenToJSONV3(output, mojangservicesToken, "xrp-mc"); tokenToJSONV3(output, mojangservicesToken, "xrp-mc");
} else if (type == AccountType::Offline) { } else if (type == AccountType::Offline) {
output["type"] = "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) { } else if (type == AccountType::AuthlibInjector) {
output["type"] = "AuthlibInjector"; output["type"] = "AuthlibInjector";
output["customAuthServerUrl"] = customAuthServerUrl; output["customAuthServerUrl"] = customAuthServerUrl;
@ -463,7 +448,7 @@ QString AccountData::accessToken() const
QString AccountData::clientToken() const QString AccountData::clientToken() const
{ {
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) { if (type != AccountType::AuthlibInjector) {
return QString(); return QString();
} }
return yggdrasilToken.extra["clientToken"].toString(); return yggdrasilToken.extra["clientToken"].toString();
@ -471,7 +456,7 @@ QString AccountData::clientToken() const
void AccountData::setClientToken(QString clientToken) void AccountData::setClientToken(QString clientToken)
{ {
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) { if (type != AccountType::AuthlibInjector) {
return; return;
} }
yggdrasilToken.extra["clientToken"] = clientToken; yggdrasilToken.extra["clientToken"] = clientToken;
@ -487,7 +472,7 @@ void AccountData::generateClientTokenIfMissing()
void AccountData::invalidateClientToken() void AccountData::invalidateClientToken()
{ {
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) { if (type != AccountType::AuthlibInjector) {
return; return;
} }
yggdrasilToken.extra["clientToken"] = QUuid::createUuid().toString().remove(QRegularExpression("[{-}]")); yggdrasilToken.extra["clientToken"] = QUuid::createUuid().toString().remove(QRegularExpression("[{-}]"));
@ -510,7 +495,6 @@ QString AccountData::profileName() const
QString AccountData::accountDisplayString() const QString AccountData::accountDisplayString() const
{ {
switch (type) { switch (type) {
case AccountType::Mojang:
case AccountType::AuthlibInjector: { case AccountType::AuthlibInjector: {
return userName(); return userName();
} }

View File

@ -88,7 +88,7 @@ struct MinecraftProfile {
Validity validity = Validity::None; 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 }; enum class AccountState { Unchecked, Offline, Working, Online, Disabled, Errored, Expired, Gone };
@ -104,13 +104,13 @@ struct AccountData {
QString servicesServerUrl() const; QString servicesServerUrl() const;
QString authlibInjectorUrl() const; QString authlibInjectorUrl() const;
//! userName for Mojang accounts, gamertag for MSA //! userName for authlib-injector accounts, gamertag for MSA
QString accountDisplayString() const; 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; QString userName() const;
//! Only valid for Mojang accounts. //! Only valid for authlib-injector accounts.
QString clientToken() const; QString clientToken() const;
void setClientToken(QString clientToken); void setClientToken(QString clientToken);
void invalidateClientToken(); void invalidateClientToken();
@ -125,8 +125,6 @@ struct AccountData {
QString lastError() const; QString lastError() const;
AccountType type = AccountType::MSA; AccountType type = AccountType::MSA;
bool legacy = false;
bool canMigrateToMSA = false;
QString customAuthServerUrl; QString customAuthServerUrl;
QString customAccountServerUrl; QString customAccountServerUrl;

View File

@ -336,17 +336,6 @@ QVariant AccountList::data(const QModelIndex& index, int role) const
return account->authlibInjectorUrl(); 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: default:
return QVariant(); return QVariant();
} }

View File

@ -56,7 +56,6 @@ class AccountList : public QAbstractListModel {
// TODO: Add icon column. // TODO: Add icon column.
ProfileNameColumn = 0, ProfileNameColumn = 0,
NameColumn, NameColumn,
MigrationColumn,
TypeColumn, TypeColumn,
StatusColumn, StatusColumn,
AuthServerColumn, AuthServerColumn,

View File

@ -131,8 +131,6 @@ class MinecraftAccount : public QObject, public Usable {
bool isActive() const; bool isActive() const;
bool canMigrate() const { return data.canMigrateToMSA; }
[[nodiscard]] AccountType accountType() const noexcept { return data.type; } [[nodiscard]] AccountType accountType() const noexcept { return data.type; }
bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; } bool ownsMinecraft() const { return data.type != AccountType::Offline && data.minecraftEntitlement.ownsMinecraft; }
@ -142,12 +140,6 @@ class MinecraftAccount : public QObject, public Usable {
QString typeDisplayName() const QString typeDisplayName() const
{ {
switch (data.type) { switch (data.type) {
case AccountType::Mojang: {
if (data.legacy) {
return tr("Legacy", "Account type");
}
return tr("Mojang", "Account type");
} break;
case AccountType::AuthlibInjector: { case AccountType::AuthlibInjector: {
return tr("authlib-injector", "Account type"); return tr("authlib-injector", "Account type");
} break; } break;
@ -166,12 +158,6 @@ class MinecraftAccount : public QObject, public Usable {
QString typeString() const QString typeString() const
{ {
switch (data.type) { switch (data.type) {
case AccountType::Mojang: {
if (data.legacy) {
return "legacy";
}
return "mojang";
} break;
case AccountType::AuthlibInjector: { case AccountType::AuthlibInjector: {
// This typeString gets passed to Minecraft; any Yggdrasil // This typeString gets passed to Minecraft; any Yggdrasil
// account should have the "mojang" type regardless of which // account should have the "mojang" type regardless of which

View File

@ -39,7 +39,6 @@
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
#include <QSaveFile>
#include <QStringList> #include <QStringList>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QTextStream> #include <QTextStream>