Merge pull request #425 from dada513/dynamic_meta
This commit is contained in:
commit
f24cdd6564
@ -699,6 +699,8 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
m_settings->reset("PastebinCustomAPIBase");
|
m_settings->reset("PastebinCustomAPIBase");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// meta URL
|
||||||
|
m_settings->registerSetting("MetaURLOverride", "");
|
||||||
|
|
||||||
m_settings->registerSetting("CloseAfterLaunch", false);
|
m_settings->registerSetting("CloseAfterLaunch", false);
|
||||||
m_settings->registerSetting("QuitAfterGameStop", false);
|
m_settings->registerSetting("QuitAfterGameStop", false);
|
||||||
|
@ -75,7 +75,16 @@ Meta::BaseEntity::~BaseEntity()
|
|||||||
|
|
||||||
QUrl Meta::BaseEntity::url() const
|
QUrl Meta::BaseEntity::url() const
|
||||||
{
|
{
|
||||||
return QUrl(BuildConfig.META_URL).resolved(localFilename());
|
auto s = APPLICATION->settings();
|
||||||
|
QString metaOverride = s->get("MetaURLOverride").toString();
|
||||||
|
if(metaOverride.isEmpty())
|
||||||
|
{
|
||||||
|
return QUrl(BuildConfig.META_URL).resolved(localFilename());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return QUrl(metaOverride).resolved(localFilename());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Meta::BaseEntity::loadLocalFile()
|
bool Meta::BaseEntity::loadLocalFile()
|
||||||
|
@ -132,6 +132,8 @@ void APIPage::loadSettings()
|
|||||||
|
|
||||||
QString msaClientID = s->get("MSAClientIDOverride").toString();
|
QString msaClientID = s->get("MSAClientIDOverride").toString();
|
||||||
ui->msaClientID->setText(msaClientID);
|
ui->msaClientID->setText(msaClientID);
|
||||||
|
QString metaURL = s->get("MetaURLOverride").toString();
|
||||||
|
ui->metaURL->setText(metaURL);
|
||||||
QString curseKey = s->get("CFKeyOverride").toString();
|
QString curseKey = s->get("CFKeyOverride").toString();
|
||||||
ui->curseKey->setText(curseKey);
|
ui->curseKey->setText(curseKey);
|
||||||
}
|
}
|
||||||
@ -145,6 +147,21 @@ void APIPage::applySettings()
|
|||||||
|
|
||||||
QString msaClientID = ui->msaClientID->text();
|
QString msaClientID = ui->msaClientID->text();
|
||||||
s->set("MSAClientIDOverride", msaClientID);
|
s->set("MSAClientIDOverride", msaClientID);
|
||||||
|
QUrl metaURL = ui->metaURL->text();
|
||||||
|
// Add required trailing slash
|
||||||
|
if (!metaURL.isEmpty() && !metaURL.path().endsWith('/'))
|
||||||
|
{
|
||||||
|
QString path = metaURL.path();
|
||||||
|
path.append('/');
|
||||||
|
metaURL.setPath(path);
|
||||||
|
}
|
||||||
|
// Don't allow HTTP, since meta is basically RCE with all the jar files.
|
||||||
|
if(!metaURL.isEmpty() && metaURL.scheme() == "http")
|
||||||
|
{
|
||||||
|
metaURL.setScheme("https");
|
||||||
|
}
|
||||||
|
|
||||||
|
s->set("MetaURLOverride", metaURL);
|
||||||
QString curseKey = ui->curseKey->text();
|
QString curseKey = ui->curseKey->text();
|
||||||
s->set("CFKeyOverride", curseKey);
|
s->set("CFKeyOverride", curseKey);
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>512</width>
|
<width>800</width>
|
||||||
<height>538</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@ -124,6 +124,51 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_meta">
|
||||||
|
<property name="title">
|
||||||
|
<string>Meta&data Server</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>You can set this to a third-party metadata server to use patched libraries or other hacks.</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="metaURL">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>(Default)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enter a custom URL for meta 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>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_curse">
|
<widget class="QGroupBox" name="groupBox_curse">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -132,16 +177,9 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&CurseForge Core API</string>
|
<string>&CurseForge Core API</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line_3">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Note: you probably don't need to set this if CurseForge already works.</string>
|
<string>Note: you probably don't need to set this if CurseForge already works.</string>
|
||||||
</property>
|
</property>
|
||||||
@ -158,7 +196,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_5">
|
<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>
|
||||||
@ -176,6 +214,19 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
Loading…
Reference in New Issue
Block a user