From 5c95f10f64a5d1c7e5064f73bf63258f920df709 Mon Sep 17 00:00:00 2001 From: BatteredBunny Date: Thu, 18 Jan 2024 23:48:39 +0200 Subject: [PATCH] Add auth server column to account list Signed-off-by: BatteredBunny --- launcher/minecraft/auth/AccountList.cpp | 16 ++++++++++++++++ launcher/minecraft/auth/AccountList.h | 1 + 2 files changed, 17 insertions(+) diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp index 3e9150554..7d6f02121 100644 --- a/launcher/minecraft/auth/AccountList.cpp +++ b/launcher/minecraft/auth/AccountList.cpp @@ -51,6 +51,7 @@ #include #include +#include #include @@ -333,6 +334,17 @@ QVariant AccountList::data(const QModelIndex& index, int role) const } } + case AuthServerColumn: { + QString suffix = "/authlib-injector/authserver"; + QString server = account->authServerUrl(); + if (server.endsWith(suffix)) { + server.chop(suffix.length()); + return server; + } else { + return server; + } + } + case MigrationColumn: { if (!account->isMojang()) { return tr("N/A", "Can Migrate"); @@ -379,6 +391,8 @@ QVariant AccountList::headerData(int section, [[maybe_unused]] Qt::Orientation o return tr("Type"); case StatusColumn: return tr("Status"); + case AuthServerColumn: + return tr("Server"); default: return QVariant(); } @@ -393,6 +407,8 @@ QVariant AccountList::headerData(int section, [[maybe_unused]] Qt::Orientation o return tr("Type of the account (MSA or Offline)"); case StatusColumn: return tr("Current status of the account."); + case AuthServerColumn: + return tr("Auth server the account is using."); default: return QVariant(); } diff --git a/launcher/minecraft/auth/AccountList.h b/launcher/minecraft/auth/AccountList.h index ea301a6c7..cb06ec743 100644 --- a/launcher/minecraft/auth/AccountList.h +++ b/launcher/minecraft/auth/AccountList.h @@ -58,6 +58,7 @@ class AccountList : public QAbstractListModel { MigrationColumn, TypeColumn, StatusColumn, + AuthServerColumn, NUM_COLUMNS };