diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-03-05 18:21:24 +0000 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2023-03-05 18:21:24 +0000 |
commit | 76f66148db09b6110d2d916da5c9f9f4dae139b8 (patch) | |
tree | 0987270634eae726ed9b99d3f313f3cc79717282 /launcher | |
parent | 4efbf22089bc1fc49409cb31bfffe26cdb9b6b36 (diff) | |
download | PrismLauncher-76f66148db09b6110d2d916da5c9f9f4dae139b8.tar.gz PrismLauncher-76f66148db09b6110d2d916da5c9f9f4dae139b8.tar.bz2 PrismLauncher-76f66148db09b6110d2d916da5c9f9f4dae139b8.zip |
Apply flowln's suggestion
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/net/Download.cpp | 8 | ||||
-rw-r--r-- | launcher/net/Upload.cpp | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index f199c0b2..e8a1d0b0 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -114,11 +114,11 @@ void Download::executeTask() } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); - // TODO remove duplication and use constant - if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host() == "api.curseforge.com") { + // TODO remove duplication + if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host() == "api.modrinth.com") { + } 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()) request.setRawHeader("Authorization", token.toUtf8()); diff --git a/launcher/net/Upload.cpp b/launcher/net/Upload.cpp index b90c71ba..ccf43c2d 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -217,11 +217,11 @@ namespace Net { } request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); - // TODO remove duplication and use constant - if (APPLICATION->capabilities() & Application::SupportsFlame - && request.url().host() == "api.curseforge.com") { + // TODO remove duplication + if (APPLICATION->capabilities() & Application::SupportsFlame && request.url().host() == QUrl(BuildConfig.FLAME_BASE_URL).host()) { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host() == "api.modrinth.com") { + } 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()) request.setRawHeader("Authorization", token.toUtf8()); |