feat: custom user-agent

This commit is contained in:
Ryan Cao
2022-06-04 15:33:17 +08:00
parent 04a3669fc4
commit 25ab121e42
9 changed files with 60 additions and 7 deletions

View File

@ -78,6 +78,7 @@ APIPage::APIPage(QWidget *parent) :
ui->tabWidget->tabBar()->hide();
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT);
loadSettings();
@ -139,6 +140,8 @@ void APIPage::loadSettings()
ui->metaURL->setText(metaURL);
QString curseKey = s->get("CFKeyOverride").toString();
ui->curseKey->setText(curseKey);
QString customUserAgent = s->get("UserAgentOverride").toString();
ui->userAgentLineEdit->setText(customUserAgent);
}
void APIPage::applySettings()
@ -167,6 +170,7 @@ void APIPage::applySettings()
s->set("MetaURLOverride", metaURL);
QString curseKey = ui->curseKey->text();
s->set("CFKeyOverride", curseKey);
s->set("UserAgentOverride", ui->userAgentLineEdit->text());
}
bool APIPage::apply()

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<height>702</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@ -220,6 +220,31 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_ua">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>User Agent</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLineEdit" name="userAgentLineEdit"/>
</item>
<item>
<widget class="QLabel" name="userAgentLabel">
<property name="text">
<string>Enter a custom User Agent here. The special string ${launcher_version} will be replaced with the version of the launcher.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">