Merge pull request #607 from dada513/curse_set
This commit is contained in:
commit
88a93945d4
@ -679,6 +679,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
|
|
||||||
// Custom MSA credentials
|
// Custom MSA credentials
|
||||||
m_settings->registerSetting("MSAClientIDOverride", "");
|
m_settings->registerSetting("MSAClientIDOverride", "");
|
||||||
|
m_settings->registerSetting("CFKeyOverride", "");
|
||||||
|
|
||||||
// Init page provider
|
// Init page provider
|
||||||
{
|
{
|
||||||
@ -1508,3 +1509,13 @@ QString Application::getMSAClientID()
|
|||||||
|
|
||||||
return BuildConfig.MSA_CLIENT_ID;
|
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;
|
||||||
|
}
|
||||||
|
@ -155,6 +155,7 @@ public:
|
|||||||
QString getJarsPath();
|
QString getJarsPath();
|
||||||
|
|
||||||
QString getMSAClientID();
|
QString getMSAClientID();
|
||||||
|
QString getCurseKey();
|
||||||
|
|
||||||
/// this is the root of the 'installation'. Used for automatic updates
|
/// this is the root of the 'installation'. Used for automatic updates
|
||||||
const QString &root() {
|
const QString &root() {
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "MetaCacheSink.h"
|
#include "MetaCacheSink.h"
|
||||||
|
|
||||||
#include "BuildConfig.h"
|
#include "BuildConfig.h"
|
||||||
|
#include "Application.h"
|
||||||
|
|
||||||
namespace Net {
|
namespace Net {
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ void Download::startImpl()
|
|||||||
|
|
||||||
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
|
request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT);
|
||||||
if (request.url().host().contains("api.curseforge.com")) {
|
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);
|
QNetworkReply* rep = m_network->get(request);
|
||||||
|
@ -70,6 +70,8 @@ void APIPage::loadSettings()
|
|||||||
ui->urlChoices->setCurrentText(pastebinURL);
|
ui->urlChoices->setCurrentText(pastebinURL);
|
||||||
QString msaClientID = s->get("MSAClientIDOverride").toString();
|
QString msaClientID = s->get("MSAClientIDOverride").toString();
|
||||||
ui->msaClientID->setText(msaClientID);
|
ui->msaClientID->setText(msaClientID);
|
||||||
|
QString curseKey = s->get("CFKeyOverride").toString();
|
||||||
|
ui->curseKey->setText(curseKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void APIPage::applySettings()
|
void APIPage::applySettings()
|
||||||
@ -79,6 +81,8 @@ void APIPage::applySettings()
|
|||||||
s->set("PastebinURL", pastebinURL);
|
s->set("PastebinURL", pastebinURL);
|
||||||
QString msaClientID = ui->msaClientID->text();
|
QString msaClientID = ui->msaClientID->text();
|
||||||
s->set("MSAClientIDOverride", msaClientID);
|
s->set("MSAClientIDOverride", msaClientID);
|
||||||
|
QString curseKey = ui->curseKey->text();
|
||||||
|
s->set("CFKeyOverride", curseKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool APIPage::apply()
|
bool APIPage::apply()
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>491</width>
|
<width>603</width>
|
||||||
<height>474</height>
|
<height>530</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -148,17 +148,56 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<widget class="QGroupBox" name="groupBox_curse">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>&CurseForge Core API</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
</item>
|
||||||
<width>20</width>
|
<item>
|
||||||
<height>40</height>
|
<widget class="QLabel" name="label_6">
|
||||||
</size>
|
<property name="text">
|
||||||
|
<string>Note: you probably don't need to set this if CurseForge already works.</string>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="curseKey">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>(Default)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enter a custom API Key for CurseForge here. </string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -166,9 +205,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
|
||||||
<tabstop>tabWidget</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
Loading…
Reference in New Issue
Block a user