diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-11-21 23:21:12 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-11-21 23:21:12 +0100 |
commit | 69213b1206e97f7d4db4270a4b3b0af41dc9e6fc (patch) | |
tree | b53ca69422ce22cceee9e648171a678679075c1a /launcher/minecraft/auth | |
parent | c2c56a2f6ceaedb8a3fa88c848b345db0fec7f9c (diff) | |
download | PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.tar.gz PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.tar.bz2 PrismLauncher-69213b1206e97f7d4db4270a4b3b0af41dc9e6fc.zip |
NOISSUE continue refactoring things to make tests pass
Diffstat (limited to 'launcher/minecraft/auth')
-rw-r--r-- | launcher/minecraft/auth/flows/AuthContext.cpp | 4 | ||||
-rw-r--r-- | launcher/minecraft/auth/flows/AuthRequest.cpp | 7 | ||||
-rw-r--r-- | launcher/minecraft/auth/flows/Yggdrasil.cpp | 5 |
3 files changed, 7 insertions, 9 deletions
diff --git a/launcher/minecraft/auth/flows/AuthContext.cpp b/launcher/minecraft/auth/flows/AuthContext.cpp index 32ee4cbd..34e2bea8 100644 --- a/launcher/minecraft/auth/flows/AuthContext.cpp +++ b/launcher/minecraft/auth/flows/AuthContext.cpp @@ -17,7 +17,6 @@ #include "Parsers.h" #include <Application.h> -#include <Env.h> using OAuth2 = Katabasis::OAuth2; using Activity = Katabasis::Activity; @@ -58,7 +57,8 @@ void AuthContext::initMSA() { opts.accessTokenUrl = "https://login.microsoftonline.com/consumers/oauth2/v2.0/token"; opts.listenerPorts = {28562, 28563, 28564, 28565, 28566}; - m_oauth2 = new OAuth2(opts, m_data->msaToken, this, &ENV->network()); + // FIXME: OAuth2 is not aware of our fancy shared pointers + m_oauth2 = new OAuth2(opts, m_data->msaToken, this, APPLICATION->network().get()); m_oauth2->setGrantFlow(Katabasis::OAuth2::GrantFlowDevice); connect(m_oauth2, &OAuth2::linkingFailed, this, &AuthContext::onOAuthLinkingFailed); diff --git a/launcher/minecraft/auth/flows/AuthRequest.cpp b/launcher/minecraft/auth/flows/AuthRequest.cpp index 751b079d..82dba591 100644 --- a/launcher/minecraft/auth/flows/AuthRequest.cpp +++ b/launcher/minecraft/auth/flows/AuthRequest.cpp @@ -5,11 +5,10 @@ #include <QBuffer> #include <QUrlQuery> +#include "Application.h" #include "AuthRequest.h" #include "katabasis/Globals.h" -#include <Env.h> - AuthRequest::AuthRequest(QObject *parent): QObject(parent) { } @@ -18,7 +17,7 @@ AuthRequest::~AuthRequest() { void AuthRequest::get(const QNetworkRequest &req, int timeout/* = 60*1000*/) { setup(req, QNetworkAccessManager::GetOperation); - reply_ = ENV->network().get(request_); + reply_ = APPLICATION->network()->get(request_); status_ = Requesting; timedReplies_.add(new Katabasis::Reply(reply_, timeout)); connect(reply_, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError(QNetworkReply::NetworkError))); @@ -30,7 +29,7 @@ void AuthRequest::post(const QNetworkRequest &req, const QByteArray &data, int t setup(req, QNetworkAccessManager::PostOperation); data_ = data; status_ = Requesting; - reply_ = ENV->network().post(request_, data_); + reply_ = APPLICATION->network()->post(request_, data_); timedReplies_.add(new Katabasis::Reply(reply_, timeout)); connect(reply_, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(onRequestError(QNetworkReply::NetworkError))); connect(reply_, SIGNAL(finished()), this, SLOT(onRequestFinished())); diff --git a/launcher/minecraft/auth/flows/Yggdrasil.cpp b/launcher/minecraft/auth/flows/Yggdrasil.cpp index fc0b18bf..f5622418 100644 --- a/launcher/minecraft/auth/flows/Yggdrasil.cpp +++ b/launcher/minecraft/auth/flows/Yggdrasil.cpp @@ -22,10 +22,9 @@ #include <QJsonDocument> #include <QNetworkReply> #include <QByteArray> - #include <QDebug> -#include <Env.h> +#include "Application.h" Yggdrasil::Yggdrasil(AccountData *data, QObject *parent) : AccountTask(data, parent) @@ -38,7 +37,7 @@ void Yggdrasil::sendRequest(QUrl endpoint, QByteArray content) { QNetworkRequest netRequest(endpoint); netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); - m_netReply = ENV->network().post(netRequest, content); + m_netReply = APPLICATION->network()->post(netRequest, content); connect(m_netReply, &QNetworkReply::finished, this, &Yggdrasil::processReply); connect(m_netReply, &QNetworkReply::uploadProgress, this, &Yggdrasil::refreshTimers); connect(m_netReply, &QNetworkReply::downloadProgress, this, &Yggdrasil::refreshTimers); |