From 2113df5d8d1553e9df58c4115496bb4e1a6b27fb Mon Sep 17 00:00:00 2001 From: ZhiYi Date: Sat, 14 Sep 2024 17:44:20 +0800 Subject: [PATCH 1/3] MultiProfile Login issue workaround for now --- launcher/minecraft/auth/Yggdrasil.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/launcher/minecraft/auth/Yggdrasil.cpp b/launcher/minecraft/auth/Yggdrasil.cpp index 9cb67c96b..a5fd3fe79 100644 --- a/launcher/minecraft/auth/Yggdrasil.cpp +++ b/launcher/minecraft/auth/Yggdrasil.cpp @@ -216,10 +216,22 @@ void Yggdrasil::processResponse(QJsonObject responseData) m_data->yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc(); // Get UUID here since we need it for later + // FIXME: Here is a simple workaround for now,, which uses the first available profile when selectedProfile is not provided. auto profile = responseData.value("selectedProfile"); if (!profile.isObject()) { - changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send a selected profile.")); - return; + auto profiles = responseData.value("availableProfiles"); + if (!profiles.isArray()) { + changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send available profiles.")); + return; + } else { + if(profiles.toArray().isEmpty()) { + changeState(AccountTaskState::STATE_FAILED_HARD, tr("Account has no available profile.")); + return; + } else { + profile = profiles.toArray().first(); + } + } + } auto profileObj = profile.toObject(); From 5d803ccc86300bc0d76c5f56f06837ba9ee3747f Mon Sep 17 00:00:00 2001 From: ZhiYi Date: Sat, 14 Sep 2024 17:48:37 +0800 Subject: [PATCH 2/3] MultiProfile Login issue workaround for now Signed-off-by: ZhiYi --- launcher/minecraft/auth/Yggdrasil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/minecraft/auth/Yggdrasil.cpp b/launcher/minecraft/auth/Yggdrasil.cpp index a5fd3fe79..d550635bc 100644 --- a/launcher/minecraft/auth/Yggdrasil.cpp +++ b/launcher/minecraft/auth/Yggdrasil.cpp @@ -216,7 +216,7 @@ void Yggdrasil::processResponse(QJsonObject responseData) m_data->yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc(); // Get UUID here since we need it for later - // FIXME: Here is a simple workaround for now,, which uses the first available profile when selectedProfile is not provided. + // FIXME: Here is a simple workaround for now,, which uses the first available profile when selectedProfile is not provided auto profile = responseData.value("selectedProfile"); if (!profile.isObject()) { auto profiles = responseData.value("availableProfiles"); From dffe14bdabb417685481ddc71d543449492fa129 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Thu, 19 Sep 2024 13:50:30 -0400 Subject: [PATCH 3/3] clang-format Signed-off-by: Evan Goode --- launcher/minecraft/auth/Yggdrasil.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/launcher/minecraft/auth/Yggdrasil.cpp b/launcher/minecraft/auth/Yggdrasil.cpp index d550635bc..dc0e1855c 100644 --- a/launcher/minecraft/auth/Yggdrasil.cpp +++ b/launcher/minecraft/auth/Yggdrasil.cpp @@ -224,14 +224,13 @@ void Yggdrasil::processResponse(QJsonObject responseData) changeState(AccountTaskState::STATE_FAILED_HARD, tr("Authentication server didn't send available profiles.")); return; } else { - if(profiles.toArray().isEmpty()) { + if (profiles.toArray().isEmpty()) { changeState(AccountTaskState::STATE_FAILED_HARD, tr("Account has no available profile.")); return; } else { profile = profiles.toArray().first(); } } - } auto profileObj = profile.toObject();