diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-06-01 20:31:23 -0700 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-06-25 11:09:26 -0700 |
commit | 6db906d62378a040e55c35f196d208bed7aebbef (patch) | |
tree | 15553bfad84a024c87cc9ee8874a615068a5bf7c | |
parent | 418677ef310ebde9e2ce6fa98e224b6d4d1aa9f4 (diff) | |
download | PrismLauncher-6db906d62378a040e55c35f196d208bed7aebbef.tar.gz PrismLauncher-6db906d62378a040e55c35f196d208bed7aebbef.tar.bz2 PrismLauncher-6db906d62378a040e55c35f196d208bed7aebbef.zip |
chore: format
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r-- | launcher/net/ApiDownload.cpp | 3 | ||||
-rw-r--r-- | launcher/net/ApiDownload.h | 1 | ||||
-rw-r--r-- | launcher/net/ApiHeaderProxy.h | 26 | ||||
-rw-r--r-- | launcher/net/HeaderProxy.h | 5 |
4 files changed, 17 insertions, 18 deletions
diff --git a/launcher/net/ApiDownload.cpp b/launcher/net/ApiDownload.cpp index 69b39c4a..df476ce8 100644 --- a/launcher/net/ApiDownload.cpp +++ b/launcher/net/ApiDownload.cpp @@ -17,10 +17,10 @@ * */ +#include "net/ApiDownload.h" #include "ByteArraySink.h" #include "ChecksumValidator.h" #include "MetaCacheSink.h" -#include "net/ApiDownload.h" #include "net/NetAction.h" namespace Net { @@ -57,7 +57,6 @@ auto ApiDownload::makeFile(QUrl url, QString path, Options options) -> Download: return dl; } - void ApiDownload::init() { qDebug() << "Setting up api download"; diff --git a/launcher/net/ApiDownload.h b/launcher/net/ApiDownload.h index 7a1f2e92..4d0a3292 100644 --- a/launcher/net/ApiDownload.h +++ b/launcher/net/ApiDownload.h @@ -33,7 +33,6 @@ class ApiDownload : public Download { static auto makeFile(QUrl url, QString path, Options options = Option::NoOptions) -> Download::Ptr; void init() override; - }; } // namespace Net diff --git a/launcher/net/ApiHeaderProxy.h b/launcher/net/ApiHeaderProxy.h index 5de503a6..6fd3e4c1 100644 --- a/launcher/net/ApiHeaderProxy.h +++ b/launcher/net/ApiHeaderProxy.h @@ -19,9 +19,9 @@ #pragma once -#include "net/HeaderProxy.h" #include "Application.h" #include "BuildConfig.h" +#include "net/HeaderProxy.h" namespace Net { @@ -31,19 +31,19 @@ class ApiHeaderProxy : public HeaderProxy { virtual ~ApiHeaderProxy() = default; public: - virtual QList<HeaderPair> headers(const QNetworkRequest& request) const override { - QList<HeaderPair> hdrs; - if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { - hdrs.append({ "x-api-key", APPLICATION->getFlameAPIKey().toUtf8() }); - } else if (request.url().host() == QUrl(BuildConfig.MODRINTH_PROD_URL).host() || - request.url().host() == QUrl(BuildConfig.MODRINTH_STAGING_URL).host()) { - QString token = APPLICATION->getModrinthAPIToken(); - if (!token.isNull()) - hdrs.append({ "Authorization", token.toUtf8() }); - } - return hdrs; + virtual QList<HeaderPair> headers(const QNetworkRequest& request) const override + { + QList<HeaderPair> hdrs; + if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { + hdrs.append({ "x-api-key", APPLICATION->getFlameAPIKey().toUtf8() }); + } else if (request.url().host() == QUrl(BuildConfig.MODRINTH_PROD_URL).host() || + request.url().host() == QUrl(BuildConfig.MODRINTH_STAGING_URL).host()) { + QString token = APPLICATION->getModrinthAPIToken(); + if (!token.isNull()) + hdrs.append({ "Authorization", token.toUtf8() }); + } + return hdrs; }; - }; } // namespace Net diff --git a/launcher/net/HeaderProxy.h b/launcher/net/HeaderProxy.h index bb3c8b03..308455e4 100644 --- a/launcher/net/HeaderProxy.h +++ b/launcher/net/HeaderProxy.h @@ -19,8 +19,8 @@ #pragma once -#include <QNetworkRequest> #include <QDebug> +#include <QNetworkRequest> namespace Net { @@ -38,7 +38,8 @@ class HeaderProxy { virtual QList<HeaderPair> headers(const QNetworkRequest& request) const = 0; public: - void writeHeaders(QNetworkRequest& request) { + void writeHeaders(QNetworkRequest& request) + { for (auto header : headers(request)) { request.setRawHeader(header.headerName, header.headerValue); } |