diff options
author | TheKodeToad <TheKodeToad@proton.me> | 2023-03-02 09:26:00 +0000 |
---|---|---|
committer | TheKodeToad <TheKodeToad@proton.me> | 2023-03-02 09:26:00 +0000 |
commit | 1f3d18ec12bb7a971962101570cbad8e18788614 (patch) | |
tree | 52d7917eedbd4096b221d42d8c69eced291f5a3b /launcher | |
parent | a7b80922967744efa6c9ffba457ac6850d4f660a (diff) | |
download | PrismLauncher-1f3d18ec12bb7a971962101570cbad8e18788614.tar.gz PrismLauncher-1f3d18ec12bb7a971962101570cbad8e18788614.tar.bz2 PrismLauncher-1f3d18ec12bb7a971962101570cbad8e18788614.zip |
Replace with exact match and add TODO to improve
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/net/Download.cpp | 5 | ||||
-rw-r--r-- | launcher/net/Upload.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp index 0816e926..adb3d6fa 100644 --- a/launcher/net/Download.cpp +++ b/launcher/net/Download.cpp @@ -114,10 +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().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { 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 36d50c1e..cd0de945 100644 --- a/launcher/net/Upload.cpp +++ b/launcher/net/Upload.cpp @@ -217,10 +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().contains("api.curseforge.com")) { + && request.url().host() == "api.curseforge.com") { request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8()); - } else if (request.url().host().contains("api.modrinth.com")) { + } else if (request.url().host() == "api.modrinth.com") { QString token = APPLICATION->getModrinthAPIToken(); if (!token.isNull()) request.setRawHeader("Authorization", token.toUtf8()); |