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;
if (typeS == "MSA") {
type = AccountType::MSA;
} else if (typeS == "Mojang") {
type = AccountType::Mojang;
} else if (typeS == "AuthlibInjector") {
type = AccountType::AuthlibInjector;
} else if (typeS == "Elyby") {
@ -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";
@ -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;
@ -463,7 +448,7 @@ 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();
@ -471,7 +456,7 @@ QString AccountData::clientToken() const
void AccountData::setClientToken(QString clientToken)
{
if (type != AccountType::Mojang && type != AccountType::AuthlibInjector) {
if (type != AccountType::AuthlibInjector) {
return;
}
yggdrasilToken.extra["clientToken"] = clientToken;
@ -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("[{-}]"));
@ -510,7 +495,6 @@ QString AccountData::profileName() const
QString AccountData::accountDisplayString() const
{
switch (type) {
case AccountType::Mojang:
case AccountType::AuthlibInjector: {
return userName();
}

View File

@ -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 };
@ -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();
@ -125,8 +125,6 @@ struct AccountData {
QString lastError() const;
AccountType type = AccountType::MSA;
bool legacy = false;
bool canMigrateToMSA = false;
QString customAuthServerUrl;
QString customAccountServerUrl;

View File

@ -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();
}

View File

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

View File

@ -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; }
@ -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;
@ -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

View File

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