aboutsummaryrefslogtreecommitdiff
path: root/launcher/net/Download.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/net/Download.cpp')
-rw-r--r--launcher/net/Download.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp
index d93eb088..e6a6adcc 100644
--- a/launcher/net/Download.cpp
+++ b/launcher/net/Download.cpp
@@ -2,6 +2,7 @@
/*
* PolyMC - Minecraft Launcher
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -117,8 +118,9 @@ void Download::executeTask()
}
request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8());
- if (request.url().host().contains("api.curseforge.com")) {
- request.setRawHeader("x-api-key", APPLICATION->getCurseKey().toUtf8());
+ if (APPLICATION->currentCapabilities() & Application::SupportsFlame
+ && request.url().host().contains("api.curseforge.com")) {
+ request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8());
};
QNetworkReply* rep = m_network->get(request);
@@ -126,7 +128,11 @@ void Download::executeTask()
m_reply.reset(rep);
connect(rep, &QNetworkReply::downloadProgress, this, &Download::downloadProgress);
connect(rep, &QNetworkReply::finished, this, &Download::downloadFinished);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ connect(rep, SIGNAL(errorOccurred(QNetworkReply::NetworkError)), SLOT(downloadError(QNetworkReply::NetworkError)));
+#else
connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(downloadError(QNetworkReply::NetworkError)));
+#endif
connect(rep, &QNetworkReply::sslErrors, this, &Download::sslErrors);
connect(rep, &QNetworkReply::readyRead, this, &Download::downloadReadyRead);
}