From 973b43ca7a12cdcb6891d069b3bb6782eda6f28a Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 13 Sep 2024 20:01:45 +0300 Subject: [PATCH 1/4] Add techinc client ID Signed-off-by: Trial97 --- launcher/Application.cpp | 3 ++ launcher/ui/pages/global/APIPage.cpp | 2 ++ launcher/ui/pages/global/APIPage.ui | 34 +++++++++++++++++-- .../modplatform/technic/TechnicModel.cpp | 4 +++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 9cd0445e6..ba9a9caa9 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -777,6 +777,9 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // FTBApp instances m_settings->registerSetting("FTBAppInstancesPath", ""); + // Custom Techinc Client ID + m_settings->registerSetting("TechincClientID", ""); + // Init page provider { m_globalSettingsProvider = std::make_shared(tr("Settings")); diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 82aa76a4f..4beb0b886 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,6 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); + ui->techicClientID->setText(s->get("TechincClientID").toString()); } void APIPage::applySettings() @@ -172,6 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); + s->set("TechincClientID", ui->techicClientID->text()); } bool APIPage::apply() diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index a7f3f3f72..f52d41d23 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -6,8 +6,8 @@ 0 0 - 800 - 600 + 841 + 620 @@ -288,6 +288,36 @@ + + + + Techinc Client ID + + + + + + <html><head/><body><p>Note: you only need to set this to access private data.</p></body></html> + + + + + + + (None) + + + + + + + Enter a custom GUID client ID for Techinc here. + + + + + + diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp index 4181edab6..55a8b254c 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp +++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp @@ -154,6 +154,10 @@ void Technic::ListModel::performSearch() QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm); searchMode = List; } + auto clientId = APPLICATION->settings()->get("TechincClientID").toString(); + if (!clientId.isEmpty()) { + searchUrl += "?cid=" + clientId; + } netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl), response)); jobPtr = netJob; jobPtr->start(); From d20f24d96fa35311935b58aa6cbae5623f437c6a Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Fri, 13 Sep 2024 21:13:21 +0300 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: seth Signed-off-by: Alexandru Ionut Tripon --- launcher/Application.cpp | 4 ++-- launcher/ui/pages/global/APIPage.cpp | 4 ++-- launcher/ui/pages/global/APIPage.ui | 6 +++--- launcher/ui/pages/modplatform/technic/TechnicModel.cpp | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/launcher/Application.cpp b/launcher/Application.cpp index ba9a9caa9..815f842c5 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -777,8 +777,8 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv) // FTBApp instances m_settings->registerSetting("FTBAppInstancesPath", ""); - // Custom Techinc Client ID - m_settings->registerSetting("TechincClientID", ""); + // Custom Technic Client ID + m_settings->registerSetting("TechnicClientID", ""); // Init page provider { diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 4beb0b886..0af34bcd6 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,7 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); - ui->techicClientID->setText(s->get("TechincClientID").toString()); + ui->techicClientID->setText(s->get("TechnicClientID").toString()); } void APIPage::applySettings() @@ -173,7 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); - s->set("TechincClientID", ui->techicClientID->text()); + s->set("TechincClientID", ui->technicClientID->text()); } bool APIPage::apply() diff --git a/launcher/ui/pages/global/APIPage.ui b/launcher/ui/pages/global/APIPage.ui index f52d41d23..9c713aa79 100644 --- a/launcher/ui/pages/global/APIPage.ui +++ b/launcher/ui/pages/global/APIPage.ui @@ -291,7 +291,7 @@ - Techinc Client ID + Technic Client ID @@ -302,7 +302,7 @@ - + (None) @@ -311,7 +311,7 @@ - Enter a custom GUID client ID for Techinc here. + Enter a custom GUID client ID for Technic here. diff --git a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp index 55a8b254c..f7e7f4433 100644 --- a/launcher/ui/pages/modplatform/technic/TechnicModel.cpp +++ b/launcher/ui/pages/modplatform/technic/TechnicModel.cpp @@ -154,7 +154,7 @@ void Technic::ListModel::performSearch() QString("%1search?build=%2&q=%3").arg(BuildConfig.TECHNIC_API_BASE_URL, BuildConfig.TECHNIC_API_BUILD, currentSearchTerm); searchMode = List; } - auto clientId = APPLICATION->settings()->get("TechincClientID").toString(); + auto clientId = APPLICATION->settings()->get("TechnicClientID").toString(); if (!clientId.isEmpty()) { searchUrl += "?cid=" + clientId; } From 1db122f1a29b90f2b556aeaddb7336233c0c4769 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 13 Sep 2024 21:37:50 +0300 Subject: [PATCH 3/4] fix typo Signed-off-by: Trial97 --- launcher/ui/pages/global/APIPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 0af34bcd6..5ec6fbce5 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -143,7 +143,7 @@ void APIPage::loadSettings() ui->modrinthToken->setText(modrinthToken); QString customUserAgent = s->get("UserAgentOverride").toString(); ui->userAgentLineEdit->setText(customUserAgent); - ui->techicClientID->setText(s->get("TechnicClientID").toString()); + ui->technicClientID->setText(s->get("TechnicClientID").toString()); } void APIPage::applySettings() From e59f90eca8db7f60328ee2ca93c6b20053572ea6 Mon Sep 17 00:00:00 2001 From: Alexandru Ionut Tripon Date: Sat, 14 Sep 2024 00:19:48 +0300 Subject: [PATCH 4/4] Update launcher/ui/pages/global/APIPage.cpp Co-authored-by: TheKodeToad Signed-off-by: Alexandru Ionut Tripon --- launcher/ui/pages/global/APIPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/ui/pages/global/APIPage.cpp b/launcher/ui/pages/global/APIPage.cpp index 5ec6fbce5..a137c4cde 100644 --- a/launcher/ui/pages/global/APIPage.cpp +++ b/launcher/ui/pages/global/APIPage.cpp @@ -173,7 +173,7 @@ void APIPage::applySettings() QString modrinthToken = ui->modrinthToken->text(); s->set("ModrinthToken", modrinthToken); s->set("UserAgentOverride", ui->userAgentLineEdit->text()); - s->set("TechincClientID", ui->technicClientID->text()); + s->set("TechnicClientID", ui->technicClientID->text()); } bool APIPage::apply()