aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft')
-rw-r--r--launcher/minecraft/auth/AccountData.cpp10
-rw-r--r--launcher/minecraft/auth/AccountData.h3
-rw-r--r--launcher/minecraft/auth/AccountList.cpp2
-rw-r--r--launcher/minecraft/auth/AuthRequest.cpp2
-rw-r--r--launcher/minecraft/auth/MinecraftAccount.cpp31
-rw-r--r--launcher/minecraft/auth/MinecraftAccount.h12
-rw-r--r--launcher/minecraft/auth/Parsers.cpp2
-rw-r--r--launcher/minecraft/auth/flows/Offline.cpp17
-rw-r--r--launcher/minecraft/auth/flows/Offline.h22
-rw-r--r--launcher/minecraft/auth/steps/MinecraftProfileStep.cpp8
-rw-r--r--launcher/minecraft/auth/steps/OfflineStep.cpp18
-rw-r--r--launcher/minecraft/auth/steps/OfflineStep.h20
12 files changed, 13 insertions, 134 deletions
diff --git a/launcher/minecraft/auth/AccountData.cpp b/launcher/minecraft/auth/AccountData.cpp
index 9b84fe1a..7526c951 100644
--- a/launcher/minecraft/auth/AccountData.cpp
+++ b/launcher/minecraft/auth/AccountData.cpp
@@ -314,8 +314,6 @@ bool AccountData::resumeStateFromV3(QJsonObject data) {
type = AccountType::MSA;
} else if (typeS == "Mojang") {
type = AccountType::Mojang;
- } else if (typeS == "Offline") {
- type = AccountType::Offline;
} else {
qWarning() << "Failed to parse account data: type is not recognized.";
return false;
@@ -365,9 +363,6 @@ QJsonObject AccountData::saveState() const {
tokenToJSONV3(output, xboxApiToken, "xrp-main");
tokenToJSONV3(output, mojangservicesToken, "xrp-mc");
}
- else if (type == AccountType::Offline) {
- output["type"] = "Offline";
- }
tokenToJSONV3(output, yggdrasilToken, "ygg");
profileToJSONV3(output, minecraftProfile, "profile");
@@ -376,7 +371,7 @@ QJsonObject AccountData::saveState() const {
}
QString AccountData::userName() const {
- if(type == AccountType::MSA) {
+ if(type != AccountType::Mojang) {
return QString();
}
return yggdrasilToken.extra["userName"].toString();
@@ -432,9 +427,6 @@ QString AccountData::accountDisplayString() const {
case AccountType::Mojang: {
return userName();
}
- case AccountType::Offline: {
- return userName();
- }
case AccountType::MSA: {
if(xboxApiToken.extra.contains("gtg")) {
return xboxApiToken.extra["gtg"].toString();
diff --git a/launcher/minecraft/auth/AccountData.h b/launcher/minecraft/auth/AccountData.h
index 606c1ad1..abf84e43 100644
--- a/launcher/minecraft/auth/AccountData.h
+++ b/launcher/minecraft/auth/AccountData.h
@@ -38,8 +38,7 @@ struct MinecraftProfile {
enum class AccountType {
MSA,
- Mojang,
- Offline
+ Mojang
};
enum class AccountState {
diff --git a/launcher/minecraft/auth/AccountList.cpp b/launcher/minecraft/auth/AccountList.cpp
index 04470e1c..ef8b435d 100644
--- a/launcher/minecraft/auth/AccountList.cpp
+++ b/launcher/minecraft/auth/AccountList.cpp
@@ -302,7 +302,7 @@ QVariant AccountList::data(const QModelIndex &index, int role) const
}
case MigrationColumn: {
- if(account->isMSA() || account->isOffline()) {
+ if(account->isMSA()) {
return tr("N/A", "Can Migrate?");
}
if (account->canMigrate()) {
diff --git a/launcher/minecraft/auth/AuthRequest.cpp b/launcher/minecraft/auth/AuthRequest.cpp
index 459d2354..feface80 100644
--- a/launcher/minecraft/auth/AuthRequest.cpp
+++ b/launcher/minecraft/auth/AuthRequest.cpp
@@ -44,7 +44,7 @@ void AuthRequest::onRequestFinished() {
if (reply_ != qobject_cast<QNetworkReply *>(sender())) {
return;
}
- httpStatus_ = 200;
+ httpStatus_ = reply_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
finish();
}
diff --git a/launcher/minecraft/auth/MinecraftAccount.cpp b/launcher/minecraft/auth/MinecraftAccount.cpp
index 6592be0f..ed9e945e 100644
--- a/launcher/minecraft/auth/MinecraftAccount.cpp
+++ b/launcher/minecraft/auth/MinecraftAccount.cpp
@@ -30,7 +30,6 @@
#include "flows/MSA.h"
#include "flows/Mojang.h"
-#include "flows/Offline.h"
MinecraftAccount::MinecraftAccount(QObject* parent) : QObject(parent) {
data.internalId = QUuid::createUuid().toString().remove(QRegExp("[{}-]"));
@@ -69,23 +68,6 @@ MinecraftAccountPtr MinecraftAccount::createBlankMSA()
return account;
}
-MinecraftAccountPtr MinecraftAccount::createOffline(const QString &username)
-{
- MinecraftAccountPtr account = new MinecraftAccount();
- account->data.type = AccountType::Offline;
- account->data.yggdrasilToken.token = "offline";
- account->data.yggdrasilToken.validity = Katabasis::Validity::Certain;
- account->data.yggdrasilToken.issueInstant = QDateTime::currentDateTimeUtc();
- account->data.yggdrasilToken.extra["userName"] = username;
- account->data.yggdrasilToken.extra["clientToken"] = QUuid::createUuid().toString().remove(QRegExp("[{}-]"));
- account->data.minecraftEntitlement.ownsMinecraft = true;
- account->data.minecraftEntitlement.canPlayMinecraft = true;
- account->data.minecraftProfile.id = QUuid::createUuid().toString().remove(QRegExp("[{}-]"));
- account->data.minecraftProfile.name = username;
- account->data.minecraftProfile.validity = Katabasis::Validity::Certain;
- return account;
-}
-
QJsonObject MinecraftAccount::saveToJson() const
{
@@ -129,16 +111,6 @@ shared_qobject_ptr<AccountTask> MinecraftAccount::loginMSA() {
return m_currentTask;
}
-shared_qobject_ptr<AccountTask> MinecraftAccount::loginOffline() {
- Q_ASSERT(m_currentTask.get() == nullptr);
-
- m_currentTask.reset(new OfflineLogin(&data));
- connect(m_currentTask.get(), SIGNAL(succeeded()), SLOT(authSucceeded()));
- connect(m_currentTask.get(), SIGNAL(failed(QString)), SLOT(authFailed(QString)));
- emit activityChanged(true);
- return m_currentTask;
-}
-
shared_qobject_ptr<AccountTask> MinecraftAccount::refresh() {
if(m_currentTask) {
return m_currentTask;
@@ -147,9 +119,6 @@ shared_qobject_ptr<AccountTask> MinecraftAccount::refresh() {
if(data.type == AccountType::MSA) {
m_currentTask.reset(new MSASilent(&data));
}
- if(data.type == AccountType::Offline) {
- m_currentTask.reset(new OfflineRefresh(&data));
- }
else {
m_currentTask.reset(new MojangRefresh(&data));
}
diff --git a/launcher/minecraft/auth/MinecraftAccount.h b/launcher/minecraft/auth/MinecraftAccount.h
index 6592f9c0..7ab3c746 100644
--- a/launcher/minecraft/auth/MinecraftAccount.h
+++ b/launcher/minecraft/auth/MinecraftAccount.h
@@ -73,8 +73,6 @@ public: /* construction */
static MinecraftAccountPtr createBlankMSA();
- static MinecraftAccountPtr createOffline(const QString &username);
-
static MinecraftAccountPtr loadFromJsonV2(const QJsonObject &json);
static MinecraftAccountPtr loadFromJsonV3(const QJsonObject &json);
@@ -91,8 +89,6 @@ public: /* manipulation */
shared_qobject_ptr<AccountTask> loginMSA();
- shared_qobject_ptr<AccountTask> loginOffline();
-
shared_qobject_ptr<AccountTask> refresh();
shared_qobject_ptr<AccountTask> currentTask();
@@ -132,10 +128,6 @@ public: /* queries */
return data.type == AccountType::MSA;
}
- bool isOffline() const {
- return data.type == AccountType::Offline;
- }
-
bool ownsMinecraft() const {
return data.minecraftEntitlement.ownsMinecraft;
}
@@ -157,10 +149,6 @@ public: /* queries */
return "msa";
}
break;
- case AccountType::Offline: {
- return "offline";
- }
- break;
default: {
return "unknown";
}
diff --git a/launcher/minecraft/auth/Parsers.cpp b/launcher/minecraft/auth/Parsers.cpp
index ed31e934..2dd36562 100644
--- a/launcher/minecraft/auth/Parsers.cpp
+++ b/launcher/minecraft/auth/Parsers.cpp
@@ -94,7 +94,7 @@ bool parseXTokenResponse(QByteArray & data, Katabasis::Token &output, QString na
return false;
}
if(!getString(obj.value("Token"), output.token)) {
- qWarning() << "User Token is not a timestamp";
+ qWarning() << "User Token is not a string";
return false;
}
auto arrayVal = obj.value("DisplayClaims").toObject().value("xui");
diff --git a/launcher/minecraft/auth/flows/Offline.cpp b/launcher/minecraft/auth/flows/Offline.cpp
deleted file mode 100644
index fc614a8c..00000000
--- a/launcher/minecraft/auth/flows/Offline.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "Offline.h"
-
-#include "minecraft/auth/steps/OfflineStep.h"
-
-OfflineRefresh::OfflineRefresh(
- AccountData *data,
- QObject *parent
-) : AuthFlow(data, parent) {
- m_steps.append(new OfflineStep(m_data));
-}
-
-OfflineLogin::OfflineLogin(
- AccountData *data,
- QObject *parent
-) : AuthFlow(data, parent) {
- m_steps.append(new OfflineStep(m_data));
-}
diff --git a/launcher/minecraft/auth/flows/Offline.h b/launcher/minecraft/auth/flows/Offline.h
deleted file mode 100644
index 5d1f83a4..00000000
--- a/launcher/minecraft/auth/flows/Offline.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-#include "AuthFlow.h"
-
-class OfflineRefresh : public AuthFlow
-{
- Q_OBJECT
-public:
- explicit OfflineRefresh(
- AccountData *data,
- QObject *parent = 0
- );
-};
-
-class OfflineLogin : public AuthFlow
-{
- Q_OBJECT
-public:
- explicit OfflineLogin(
- AccountData *data,
- QObject *parent = 0
- );
-};
diff --git a/launcher/minecraft/auth/steps/MinecraftProfileStep.cpp b/launcher/minecraft/auth/steps/MinecraftProfileStep.cpp
index 9fef99b0..add91659 100644
--- a/launcher/minecraft/auth/steps/MinecraftProfileStep.cpp
+++ b/launcher/minecraft/auth/steps/MinecraftProfileStep.cpp
@@ -56,6 +56,14 @@ void MinecraftProfileStep::onRequestDone(
return;
}
if (error != QNetworkReply::NoError) {
+ qWarning() << "Error getting profile:";
+ qWarning() << " HTTP Status: " << requestor->httpStatus_;
+ qWarning() << " Internal error no.: " << error;
+ qWarning() << " Error string: " << requestor->errorString_;
+
+ qWarning() << " Response:";
+ qWarning() << QString::fromUtf8(data);
+
emit finished(
AccountTaskState::STATE_FAILED_SOFT,
tr("Minecraft Java profile acquisition failed.")
diff --git a/launcher/minecraft/auth/steps/OfflineStep.cpp b/launcher/minecraft/auth/steps/OfflineStep.cpp
deleted file mode 100644
index dc092bfd..00000000
--- a/launcher/minecraft/auth/steps/OfflineStep.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "OfflineStep.h"
-
-#include "Application.h"
-
-OfflineStep::OfflineStep(AccountData* data) : AuthStep(data) {}
-OfflineStep::~OfflineStep() noexcept = default;
-
-QString OfflineStep::describe() {
- return tr("Creating offline account.");
-}
-
-void OfflineStep::rehydrate() {
- // NOOP
-}
-
-void OfflineStep::perform() {
- emit finished(AccountTaskState::STATE_WORKING, tr("Created offline account."));
-}
diff --git a/launcher/minecraft/auth/steps/OfflineStep.h b/launcher/minecraft/auth/steps/OfflineStep.h
deleted file mode 100644
index 62addb1f..00000000
--- a/launcher/minecraft/auth/steps/OfflineStep.h
+++ /dev/null
@@ -1,20 +0,0 @@
-
-#pragma once
-#include <QObject>
-
-#include "QObjectPtr.h"
-#include "minecraft/auth/AuthStep.h"
-
-#include <katabasis/DeviceFlow.h>
-
-class OfflineStep : public AuthStep {
- Q_OBJECT
-public:
- explicit OfflineStep(AccountData *data);
- virtual ~OfflineStep() noexcept;
-
- void perform() override;
- void rehydrate() override;
-
- QString describe() override;
-};