mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
When auth is down, launch into offline mode (#5647)
This commit is contained in:
commit
d2fa7cf7f7
8 changed files with 38 additions and 9 deletions
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue