When auth is down, launch into offline mode (#5647)
Some checks failed
Nix / Build (aarch64-darwin) (push) Has been cancelled
Nix / Build (x86_64-linux) (push) Has been cancelled
Nix / Build (aarch64-linux) (push) Has been cancelled

This commit is contained in:
Alexandru Ionut Tripon 2026-06-26 13:23:39 +00:00 committed by GitHub
commit d2fa7cf7f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 38 additions and 9 deletions

View file

@ -41,6 +41,7 @@
#include <QDateTime>
#include <QMap>
#include <QNetworkReply>
#include <QVariantMap>
enum class Validity { None, Assumed, Certain };
@ -118,5 +119,6 @@ struct AccountData {
// runtime only information (not saved with the account)
QString internalId;
QString errorString;
QNetworkReply::NetworkError networkError = QNetworkReply::NoError;
AccountState accountState = AccountState::Unchecked;
};

View file

@ -56,10 +56,11 @@ void LauncherLoginStep::onRequestDone(QByteArray* response)
qCDebug(authCredentials()) << *response;
if (m_request->error() != QNetworkReply::NoError) {
qWarning() << "Reply error:" << m_request->error();
if (Net::isApplicationError(m_request->error())) {
if (Net::isApplicationError(m_request->error()) && !Net::isServerError(m_request->error())) {
emit finished(AccountTaskState::STATE_FAILED_SOFT,
tr("Failed to get Minecraft access token: %1").arg(m_request->errorString()));
} else {
m_data->networkError = m_request->error();
emit finished(AccountTaskState::STATE_OFFLINE, tr("Failed to get Minecraft access token: %1").arg(m_request->errorString()));
}
return;

View file

@ -52,10 +52,11 @@ void MinecraftProfileStep::onRequestDone(QByteArray* response)
qWarning() << " Response:";
qWarning() << QString::fromUtf8(*response);
if (Net::isApplicationError(m_request->error())) {
if (Net::isApplicationError(m_request->error()) && !Net::isServerError(m_request->error())) {
emit finished(AccountTaskState::STATE_FAILED_SOFT,
tr("Minecraft Java profile acquisition failed: %1").arg(m_request->errorString()));
} else {
m_data->networkError = m_request->error();
emit finished(AccountTaskState::STATE_OFFLINE,
tr("Minecraft Java profile acquisition failed: %1").arg(m_request->errorString()));
}

View file

@ -60,13 +60,14 @@ void XboxAuthorizationStep::onRequestDone(QByteArray* response)
qCDebug(authCredentials()) << *response;
if (m_request->error() != QNetworkReply::NoError) {
qWarning() << "Reply error:" << m_request->error();
if (Net::isApplicationError(m_request->error())) {
if (Net::isApplicationError(m_request->error()) && !Net::isServerError(m_request->error())) {
if (processSTSError(*response)) {
return;
}
emit finished(AccountTaskState::STATE_FAILED_SOFT,
tr("Unknown STS error for %1 services: %2").arg(m_authorizationKind, m_request->errorString()));
} else {
m_data->networkError = m_request->error();
emit finished(AccountTaskState::STATE_OFFLINE,
tr("Failed to get authorization for %1 services: %2").arg(m_authorizationKind, m_request->errorString()));
}

View file

@ -56,9 +56,10 @@ void XboxUserStep::onRequestDone(QByteArray* response)
{
if (m_request->error() != QNetworkReply::NoError) {
qWarning() << "Reply error:" << m_request->error();
if (Net::isApplicationError(m_request->error())) {
if (Net::isApplicationError(m_request->error()) && !Net::isServerError(m_request->error())) {
emit finished(AccountTaskState::STATE_FAILED_SOFT, tr("Xbox user authentication failed: %1").arg(m_request->errorString()));
} else {
m_data->networkError = m_request->error();
emit finished(AccountTaskState::STATE_OFFLINE, tr("Xbox user authentication failed: %1").arg(m_request->errorString()));
}
return;