diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index dc8a7b0d..ce62c41a 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -679,6 +679,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
// Custom MSA credentials
m_settings->registerSetting("MSAClientIDOverride", "");
+ m_settings->registerSetting("CFKeyOverride", "");
// Init page provider
{
@@ -1508,3 +1509,13 @@ QString Application::getMSAClientID()
return BuildConfig.MSA_CLIENT_ID;
}
+
+QString Application::getCurseKey()
+{
+ QString keyOverride = m_settings->get("CFKeyOverride").toString();
+ if (!keyOverride.isEmpty()) {
+ return keyOverride;
+ }
+
+ return BuildConfig.CURSEFORGE_API_KEY;
+}
diff --git a/launcher/Application.h b/launcher/Application.h
index 172321c0..3129b4fb 100644
--- a/launcher/Application.h
+++ b/launcher/Application.h
@@ -155,6 +155,7 @@ public:
QString getJarsPath();
QString getMSAClientID();
+ QString getCurseKey();
/// this is the root of the 'installation'. Used for automatic updates
const QString &root() {
diff --git a/launcher/net/Download.cpp b/launcher/net/Download.cpp
index 65cc8f67..7a401609 100644
--- a/launcher/net/Download.cpp
+++ b/launcher/net/Download.cpp
@@ -25,6 +25,7 @@
#include "MetaCacheSink.h"
#include "BuildConfig.h"
+#include "Application.h"
namespace Net {
@@ -96,7 +97,7 @@ void Download::startImpl()
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
if (request.url().host().contains("api.curseforge.com")) {
- request.setRawHeader("x-api-key", BuildConfig.CURSEFORGE_API_KEY.toUtf8());
+ request.setRawHeader("x-api-key", APPLICATION->getCurseKey().toUtf8());
};
QNetworkReply* rep = m_network->get(request);
diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp
index 287eb74f..8b806bcf 100644
--- a/launcher/ui/pages/global/APIPage.cpp
+++ b/launcher/ui/pages/global/APIPage.cpp
@@ -70,6 +70,8 @@ void APIPage::loadSettings()
ui->urlChoices->setCurrentText(pastebinURL);
QString msaClientID = s->get("MSAClientIDOverride").toString();
ui->msaClientID->setText(msaClientID);
+ QString curseKey = s->get("CFKeyOverride").toString();
+ ui->curseKey->setText(curseKey);
}
void APIPage::applySettings()
@@ -79,6 +81,8 @@ void APIPage::applySettings()
s->set("PastebinURL", pastebinURL);
QString msaClientID = ui->msaClientID->text();
s->set("MSAClientIDOverride", msaClientID);
+ QString curseKey = ui->curseKey->text();
+ s->set("CFKeyOverride", curseKey);
}
bool APIPage::apply()
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index acde9aef..eaa44c88 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -6,8 +6,8 @@
0
0
- 491
- 474
+ 603
+ 530
@@ -148,17 +148,56 @@
-
-
-
- Qt::Vertical
+
+
+ true
-
-
- 20
- 40
-
+
+ &CurseForge Core API
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+ Note: you probably don't need to set this if CurseForge already works.
+
+
+
+ -
+
+
+ true
+
+
+ (Default)
+
+
+
+ -
+
+
+ Enter a custom API Key for CurseForge here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+
+
@@ -166,9 +205,6 @@
-
- tabWidget
-