refactor: rename references to CurseForge to Flame

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-05-29 21:29:07 +02:00
parent f1902a4471
commit 8a1a583afe
No known key found for this signature in database
GPG Key ID: C10411294912A422
9 changed files with 29 additions and 18 deletions

View File

@ -131,7 +131,7 @@ set(Launcher_MSA_CLIENT_ID "549033b2-1532-4d4e-ae77-1bbaa46f9d74" CACHE STRING "
# By using this key in your builds you accept the terms and conditions laid down in # By using this key in your builds you accept the terms and conditions laid down in
# https://support.curseforge.com/en/support/solutions/articles/9000207405-curse-forge-3rd-party-api-terms-and-conditions # https://support.curseforge.com/en/support/solutions/articles/9000207405-curse-forge-3rd-party-api-terms-and-conditions
# NOTE: CurseForge requires you to change this if you make any kind of derivative work. # NOTE: CurseForge requires you to change this if you make any kind of derivative work.
set(Launcher_CURSEFORGE_API_KEY "$2a$10$1Oqr2MX3O4n/ilhFGc597u8tfI3L2Hyr9/rtWDAMRjghSQV2QUuxq" CACHE STRING "CurseForge API Key") set(Launcher_CURSEFORGE_API_KEY "$2a$10$1Oqr2MX3O4n/ilhFGc597u8tfI3L2Hyr9/rtWDAMRjghSQV2QUuxq" CACHE STRING "API key for the CurseForge platform")
#### Check the current Git commit and branch #### Check the current Git commit and branch

View File

@ -90,7 +90,7 @@ Config::Config()
HELP_URL = "@Launcher_HELP_URL@"; HELP_URL = "@Launcher_HELP_URL@";
IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@"; IMGUR_CLIENT_ID = "@Launcher_IMGUR_CLIENT_ID@";
MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@"; MSA_CLIENT_ID = "@Launcher_MSA_CLIENT_ID@";
CURSEFORGE_API_KEY = "@Launcher_CURSEFORGE_API_KEY@"; FLAME_API_KEY = "@Launcher_CURSEFORGE_API_KEY@";
META_URL = "@Launcher_META_URL@"; META_URL = "@Launcher_META_URL@";
BUG_TRACKER_URL = "@Launcher_BUG_TRACKER_URL@"; BUG_TRACKER_URL = "@Launcher_BUG_TRACKER_URL@";

View File

@ -118,7 +118,7 @@ class Config {
/** /**
* Client API key for CurseForge * Client API key for CurseForge
*/ */
QString CURSEFORGE_API_KEY; QString FLAME_API_KEY;
/** /**
* Metadata repository URL prefix * Metadata repository URL prefix

View File

@ -712,9 +712,20 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
m_settings->registerSetting("CloseAfterLaunch", false); m_settings->registerSetting("CloseAfterLaunch", false);
m_settings->registerSetting("QuitAfterGameStop", false); m_settings->registerSetting("QuitAfterGameStop", false);
// Custom MSA credentials // Custom Microsoft Authentication Client ID
m_settings->registerSetting("MSAClientIDOverride", ""); m_settings->registerSetting("MSAClientIDOverride", "");
m_settings->registerSetting("CFKeyOverride", "");
// Custom Flame API Key
{
m_settings->registerSetting("CFKeyOverride", "");
m_settings->registerSetting("FlameKeyOverride", "");
QString flameKey = m_settings->get("CFKeyOverride").toString();
if (!flameKey.isEmpty())
m_settings->set("FlameKeyOverride", flameKey);
m_settings->reset("CFKeyOverride");
}
m_settings->registerSetting("UserAgentOverride", ""); m_settings->registerSetting("UserAgentOverride", "");
// Init page provider // Init page provider
@ -1586,14 +1597,14 @@ QString Application::getMSAClientID()
return BuildConfig.MSA_CLIENT_ID; return BuildConfig.MSA_CLIENT_ID;
} }
QString Application::getCurseKey() QString Application::getFlameAPIKey()
{ {
QString keyOverride = m_settings->get("CFKeyOverride").toString(); QString keyOverride = m_settings->get("FlameKeyOverride").toString();
if (!keyOverride.isEmpty()) { if (!keyOverride.isEmpty()) {
return keyOverride; return keyOverride;
} }
return BuildConfig.CURSEFORGE_API_KEY; return BuildConfig.FLAME_API_KEY;
} }
QString Application::getUserAgent() QString Application::getUserAgent()

View File

@ -164,7 +164,7 @@ public:
QString getJarPath(QString jarFile); QString getJarPath(QString jarFile);
QString getMSAClientID(); QString getMSAClientID();
QString getCurseKey(); QString getFlameAPIKey();
QString getUserAgent(); QString getUserAgent();
QString getUserAgentUncached(); QString getUserAgentUncached();

View File

@ -118,7 +118,7 @@ void Download::executeTask()
request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8());
if (request.url().host().contains("api.curseforge.com")) { if (request.url().host().contains("api.curseforge.com")) {
request.setRawHeader("x-api-key", APPLICATION->getCurseKey().toUtf8()); request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8());
}; };
QNetworkReply* rep = m_network->get(request); QNetworkReply* rep = m_network->get(request);

View File

@ -175,7 +175,7 @@ namespace Net {
request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8()); request.setHeader(QNetworkRequest::UserAgentHeader, APPLICATION->getUserAgent().toUtf8());
if (request.url().host().contains("api.curseforge.com")) { if (request.url().host().contains("api.curseforge.com")) {
request.setRawHeader("x-api-key", APPLICATION->getCurseKey().toUtf8()); request.setRawHeader("x-api-key", APPLICATION->getFlameAPIKey().toUtf8());
} }
//TODO other types of post requests ? //TODO other types of post requests ?
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

View File

@ -137,8 +137,8 @@ void APIPage::loadSettings()
ui->msaClientID->setText(msaClientID); ui->msaClientID->setText(msaClientID);
QString metaURL = s->get("MetaURLOverride").toString(); QString metaURL = s->get("MetaURLOverride").toString();
ui->metaURL->setText(metaURL); ui->metaURL->setText(metaURL);
QString curseKey = s->get("CFKeyOverride").toString(); QString flameKey = s->get("FlameKeyOverride").toString();
ui->curseKey->setText(curseKey); ui->flameKey->setText(flameKey);
QString customUserAgent = s->get("UserAgentOverride").toString(); QString customUserAgent = s->get("UserAgentOverride").toString();
ui->userAgentLineEdit->setText(customUserAgent); ui->userAgentLineEdit->setText(customUserAgent);
} }
@ -167,8 +167,8 @@ void APIPage::applySettings()
} }
s->set("MetaURLOverride", metaURL); s->set("MetaURLOverride", metaURL);
QString curseKey = ui->curseKey->text(); QString flameKey = ui->flameKey->text();
s->set("CFKeyOverride", curseKey); s->set("FlameKeyOverride", flameKey);
s->set("UserAgentOverride", ui->userAgentLineEdit->text()); s->set("UserAgentOverride", ui->userAgentLineEdit->text());
} }

View File

@ -196,7 +196,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_curse"> <widget class="QGroupBox" name="groupBox_flame">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -214,7 +214,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Enter a custom API Key for CurseForge here. </string> <string>Enter a custom API Key for CurseForge here.</string>
</property> </property>
<property name="textFormat"> <property name="textFormat">
<enum>Qt::RichText</enum> <enum>Qt::RichText</enum>
@ -228,7 +228,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLineEdit" name="curseKey"> <widget class="QLineEdit" name="flameKey">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>