From 25ab121e42f624352bb4f32faa29e9e455328f09 Mon Sep 17 00:00:00 2001
From: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Date: Sat, 4 Jun 2022 15:33:17 +0800
Subject: feat: custom user-agent
---
launcher/ui/pages/global/APIPage.cpp | 4 ++++
launcher/ui/pages/global/APIPage.ui | 27 ++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletion(-)
(limited to 'launcher/ui/pages')
diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp
index 5d812d07..0c1d7ca2 100644
--- a/launcher/ui/pages/global/APIPage.cpp
+++ b/launcher/ui/pages/global/APIPage.cpp
@@ -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()
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index 5c927391..0981c700 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -7,7 +7,7 @@
0
0
800
- 600
+ 702
@@ -220,6 +220,31 @@
+ -
+
+
+
+ 0
+ 0
+
+
+
+ User Agent
+
+
+
-
+
+
+ -
+
+
+ Enter a custom User Agent here. The special string ${launcher_version} will be replaced with the version of the launcher.
+
+
+
+
+
+
-
--
cgit
From 5930acc41882222e746044b143aae99bd81c4afa Mon Sep 17 00:00:00 2001
From: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Date: Sat, 4 Jun 2022 22:54:05 +0800
Subject: change UI to scroll
let me just say, this does not look right
---
launcher/ui/pages/global/APIPage.ui | 454 +++++++++++++++++++-----------------
1 file changed, 236 insertions(+), 218 deletions(-)
(limited to 'launcher/ui/pages')
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index 0981c700..eb8825b9 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -7,7 +7,7 @@
0
0
800
- 702
+ 712
@@ -34,230 +34,248 @@
-
-
-
- &Pastebin Service
+
+
+ QFrame::NoFrame
-
-
-
-
-
- Paste Service &Type
-
-
- pasteTypeComboBox
-
-
-
- -
-
-
- -
-
-
- Base &URL
-
-
- baseURLEntry
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- -
-
-
- Note: you probably want to change or clear the Base URL after changing the paste service type.
-
-
- true
-
-
-
-
-
-
- -
-
-
- &Microsoft Authentication
-
-
-
-
-
-
- Note: you probably don't need to set this if logging in via Microsoft Authentication already works.
-
-
- Qt::RichText
-
-
- true
-
-
-
- -
-
-
- (Default)
-
-
-
- -
-
-
- Enter a custom client ID for Microsoft Authentication here.
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
-
-
-
-
- -
-
-
- Meta&data Server
-
-
-
-
-
-
- You can set this to a third-party metadata server to use patched libraries or other hacks.
-
-
- Qt::RichText
-
-
- true
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Enter a custom URL for meta here.
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
-
-
-
-
- -
-
-
- true
+
+ QFrame::Plain
-
- &CurseForge Core API
+
+ Qt::ScrollBarAlwaysOff
-
-
-
-
-
- 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
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
+
+ false
-
- User Agent
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
-
-
-
- -
-
-
- Enter a custom User Agent here. The special string ${launcher_version} will be replaced with the version of the launcher.
-
-
-
-
+
+
+
+ 0
+ -73
+ 772
+ 724
+
+
+
+ -
+
+
+ &Pastebin Service
+
+
+
-
+
+
+ Paste Service &Type
+
+
+ pasteTypeComboBox
+
+
+
+ -
+
+
+ -
+
+
+ Base &URL
+
+
+ baseURLEntry
+
+
+
+ -
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Note: you probably want to change or clear the Base URL after changing the paste service type.
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ &Microsoft Authentication
+
+
+
-
+
+
+ Note: you probably don't need to set this if logging in via Microsoft Authentication already works.
+
+
+ Qt::RichText
+
+
+ true
+
+
+
+ -
+
+
+ (Default)
+
+
+
+ -
+
+
+ Enter a custom client ID for Microsoft Authentication here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ Meta&data Server
+
+
+
-
+
+
+ You can set this to a third-party metadata server to use patched libraries or other hacks.
+
+
+ Qt::RichText
+
+
+ true
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Enter a custom URL for meta here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ true
+
+
+ &CurseForge Core API
+
+
+
-
+
+
+ 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
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ User Agent
+
+
+
-
+
+
+ -
+
+
+ Enter a custom User Agent here. The special string ${launcher_version} will be replaced with the version of the launcher.
+
+
+
+
+
+
+
+
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
--
cgit
From 4cecba8787d3c4e9e8d1a0234a1850747b501a2e Mon Sep 17 00:00:00 2001
From: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Date: Sat, 4 Jun 2022 22:59:57 +0800
Subject: make $LAUNCHER_VER actually work
---
launcher/Application.cpp | 12 ++++++------
launcher/ui/pages/global/APIPage.ui | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
(limited to 'launcher/ui/pages')
diff --git a/launcher/Application.cpp b/launcher/Application.cpp
index dd6f8ec6..7143b767 100644
--- a/launcher/Application.cpp
+++ b/launcher/Application.cpp
@@ -1557,9 +1557,9 @@ QString Application::getCurseKey()
QString Application::getUserAgent()
{
- QString keyOverride = m_settings->get("UserAgentOverride").toString();
- if (!keyOverride.isEmpty()) {
- return keyOverride;
+ QString uaOverride = m_settings->get("UserAgentOverride").toString();
+ if (!uaOverride.isEmpty()) {
+ return uaOverride.replace("$LAUNCHER_VER", BuildConfig.printableVersionString());
}
return BuildConfig.USER_AGENT;
@@ -1567,9 +1567,9 @@ QString Application::getUserAgent()
QString Application::getUserAgentUncached()
{
- QString keyOverride = m_settings->get("UserAgentOverride").toString();
- if (!keyOverride.isEmpty()) {
- return keyOverride;
+ QString uaOverride = m_settings->get("UserAgentOverride").toString();
+ if (!uaOverride.isEmpty()) {
+ return uaOverride.replace("$LAUNCHER_VER", BuildConfig.printableVersionString());
}
return BuildConfig.USER_AGENT_UNCACHED;
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index eb8825b9..9524424e 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -265,7 +265,7 @@
-
- Enter a custom User Agent here. The special string ${launcher_version} will be replaced with the version of the launcher.
+ Enter a custom User Agent here. The special string $LAUNCHER_VER will be replaced with the version of the launcher.
--
cgit
From 7a3acc324979704e69a815bfe307aa054d4db8a3 Mon Sep 17 00:00:00 2001
From: Sefa Eyeoglu
Date: Sat, 4 Jun 2022 22:04:30 +0200
Subject: refactor(ui): use tabs for APIPage
---
launcher/ui/pages/global/APIPage.cpp | 1 -
launcher/ui/pages/global/APIPage.ui | 496 ++++++++++++++++++-----------------
2 files changed, 259 insertions(+), 238 deletions(-)
(limited to 'launcher/ui/pages')
diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp
index 0c1d7ca2..b889e6f7 100644
--- a/launcher/ui/pages/global/APIPage.cpp
+++ b/launcher/ui/pages/global/APIPage.cpp
@@ -75,7 +75,6 @@ APIPage::APIPage(QWidget *parent) :
// This function needs to be called even when the ComboBox's index is still in its default state.
updateBaseURLPlaceholder(ui->pasteTypeComboBox->currentIndex());
ui->baseURLEntry->setValidator(new QRegularExpressionValidator(validUrlRegExp, ui->baseURLEntry));
- ui->tabWidget->tabBar()->hide();
ui->metaURL->setPlaceholderText(BuildConfig.META_URL);
ui->userAgentLineEdit->setPlaceholderText(BuildConfig.USER_AGENT);
diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui
index 9524424e..5327771c 100644
--- a/launcher/ui/pages/global/APIPage.ui
+++ b/launcher/ui/pages/global/APIPage.ui
@@ -7,7 +7,7 @@
0
0
800
- 712
+ 600
@@ -30,252 +30,274 @@
- Tab 1
+ Services
-
-
-
- QFrame::NoFrame
+
+
+ &Pastebin Service
-
- QFrame::Plain
+
+
-
+
+
+ Paste Service &Type
+
+
+ pasteTypeComboBox
+
+
+
+ -
+
+
+ -
+
+
+ Base &URL
+
+
+ baseURLEntry
+
+
+
+ -
+
+
+
+
+
+ true
+
+
+
+ -
+
+
+ Note: you probably want to change or clear the Base URL after changing the paste service type.
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ Meta&data Server
+
+
+
-
+
+
+ You can set this to a third-party metadata server to use patched libraries or other hacks.
+
+
+ Qt::RichText
+
+
+ true
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Enter a custom URL for meta here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
+
+
+
+
+ API Keys
+
+
+ -
+
+
+ &Microsoft Authentication
+
+
+
-
+
+
+ Note: you probably don't need to set this if logging in via Microsoft Authentication already works.
+
+
+ Qt::RichText
+
+
+ true
+
+
+
+ -
+
+
+ (Default)
+
+
+
+ -
+
+
+ Enter a custom client ID for Microsoft Authentication here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ true
-
- Qt::ScrollBarAlwaysOff
+
+ &CurseForge Core API
-
- false
+
+
-
+
+
+ Note: you probably don't need to set this if CurseForge already works.
+
+
+
+ -
+
+
+ Enter a custom API Key for CurseForge here.
+
+
+ Qt::RichText
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ true
+
+
+ (Default)
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ 20
+ 40
+
-
-
-
- 0
- -73
- 772
- 724
-
-
-
-
-
-
-
- &Pastebin Service
-
-
-
-
-
-
- Paste Service &Type
-
-
- pasteTypeComboBox
-
-
-
- -
-
-
- -
-
-
- Base &URL
-
-
- baseURLEntry
-
-
-
- -
-
-
-
-
-
- true
-
-
-
- -
-
-
- Note: you probably want to change or clear the Base URL after changing the paste service type.
-
-
- true
-
-
-
-
-
-
- -
-
-
- &Microsoft Authentication
-
-
-
-
-
-
- Note: you probably don't need to set this if logging in via Microsoft Authentication already works.
-
-
- Qt::RichText
-
-
- true
-
-
-
- -
-
-
- (Default)
-
-
-
- -
-
-
- Enter a custom client ID for Microsoft Authentication here.
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
-
-
-
-
- -
-
-
- Meta&data Server
-
-
-
-
-
-
- You can set this to a third-party metadata server to use patched libraries or other hacks.
-
-
- Qt::RichText
-
-
- true
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Enter a custom URL for meta here.
-
-
- Qt::RichText
-
-
- true
-
-
- true
-
-
-
-
-
-
- -
-
-
- true
-
-
- &CurseForge Core API
-
-
-
-
-
-
- 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
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- User Agent
-
-
-
-
-
-
- -
-
-
- Enter a custom User Agent here. The special string $LAUNCHER_VER will be replaced with the version of the launcher.
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Miscellaneous
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ User Agent
+
+
+
-
+
+
+ -
+
+
+ Enter a custom User Agent here. The special string $LAUNCHER_VER will be replaced with the version of the launcher.
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
+
--
cgit