From 20c393321c894adb4cb938a3f865f331c985cda9 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Thu, 1 Jul 2021 19:24:29 +0100 Subject: [PATCH 1/5] NOISSUE Use constants for user agents Here lies yet another early-stage move to debrand the MultiMC codebase, as well as reducing the burden of updating strings across the codebase for a future MultiMC6. --- api/logic/net/Download.cpp | 3 ++- api/logic/net/PasteUpload.cpp | 3 ++- api/logic/screenshots/ImgurAlbumCreation.cpp | 2 +- api/logic/screenshots/ImgurUpload.cpp | 2 +- buildconfig/BuildConfig.h | 5 +++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api/logic/net/Download.cpp b/api/logic/net/Download.cpp index 340f86579..3f183b7d2 100644 --- a/api/logic/net/Download.cpp +++ b/api/logic/net/Download.cpp @@ -15,6 +15,7 @@ #include "Download.h" +#include "BuildConfig.h" #include #include #include @@ -94,7 +95,7 @@ void Download::start() return; } - request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0"); + request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT); QNetworkReply *rep = ENV.qnam().get(request); diff --git a/api/logic/net/PasteUpload.cpp b/api/logic/net/PasteUpload.cpp index 3526e2075..cb470c49a 100644 --- a/api/logic/net/PasteUpload.cpp +++ b/api/logic/net/PasteUpload.cpp @@ -5,6 +5,7 @@ #include #include #include +#include PasteUpload::PasteUpload(QWidget *window, QString text, QString key) : m_window(window) { @@ -34,7 +35,7 @@ bool PasteUpload::validateText() void PasteUpload::executeTask() { QNetworkRequest request(QUrl("https://api.paste.ee/v1/pastes")); - request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); + request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); request.setRawHeader("Content-Type", "application/json"); request.setRawHeader("Content-Length", QByteArray::number(m_jsonContent.size())); diff --git a/api/logic/screenshots/ImgurAlbumCreation.cpp b/api/logic/screenshots/ImgurAlbumCreation.cpp index ff9ec6fde..07ae6fe16 100644 --- a/api/logic/screenshots/ImgurAlbumCreation.cpp +++ b/api/logic/screenshots/ImgurAlbumCreation.cpp @@ -20,7 +20,7 @@ void ImgurAlbumCreation::start() { m_status = Job_InProgress; QNetworkRequest request(m_url); - request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); + request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); request.setRawHeader("Accept", "application/json"); diff --git a/api/logic/screenshots/ImgurUpload.cpp b/api/logic/screenshots/ImgurUpload.cpp index 1585b0615..062c589fa 100644 --- a/api/logic/screenshots/ImgurUpload.cpp +++ b/api/logic/screenshots/ImgurUpload.cpp @@ -23,7 +23,7 @@ void ImgurUpload::start() finished = false; m_status = Job_InProgress; QNetworkRequest request(m_url); - request.setHeader(QNetworkRequest::UserAgentHeader, "MultiMC/5.0 (Uncached)"); + request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); request.setRawHeader("Accept", "application/json"); diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h index 66d05ae09..07d7a23a3 100644 --- a/buildconfig/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -31,6 +31,11 @@ public: /// URL for the updater's channel QString CHANLIST_URL; + /// User-Agent to use. + QString USER_AGENT = "MultiMC/5.0"; + /// User-Agent to use for uncached requests. + QString USER_AGENT_UNCACHED = "MultiMC/5.0 (Uncached)"; + /// Google analytics ID QString ANALYTICS_ID; From 4401b9e137a92effb566a82cbe4b904b545f0cdf Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Thu, 1 Jul 2021 19:49:38 +0100 Subject: [PATCH 2/5] NOISSUE Specify Imgur client ID at build time --- CMakeLists.txt | 3 +++ api/logic/screenshots/ImgurAlbumCreation.cpp | 2 +- api/logic/screenshots/ImgurUpload.cpp | 2 +- buildconfig/BuildConfig.cpp.in | 1 + buildconfig/BuildConfig.h | 5 +++++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bcf931c0e..5e3d6cea0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,9 @@ set(MultiMC_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch M # paste.ee API key set(MultiMC_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account") +# Imgur API Client ID +set(MultiMC_IMGUR_CLIENT_ID "5b97b0713fba4a3" CACHE STRING "Client ID you can get from Imgur when you register an application") + # Google analytics ID set(MultiMC_ANALYTICS_ID "UA-87731965-2" CACHE STRING "ID you can get from Google analytics") diff --git a/api/logic/screenshots/ImgurAlbumCreation.cpp b/api/logic/screenshots/ImgurAlbumCreation.cpp index 07ae6fe16..1f195f004 100644 --- a/api/logic/screenshots/ImgurAlbumCreation.cpp +++ b/api/logic/screenshots/ImgurAlbumCreation.cpp @@ -22,7 +22,7 @@ void ImgurAlbumCreation::start() QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); - request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); + request.setRawHeader("Authorization", QString("Client-ID %1").arg(BuildConfig.IMGUR_CLIENT_ID).toStdString().c_str()); request.setRawHeader("Accept", "application/json"); QStringList hashes; diff --git a/api/logic/screenshots/ImgurUpload.cpp b/api/logic/screenshots/ImgurUpload.cpp index 062c589fa..7e95d5ca2 100644 --- a/api/logic/screenshots/ImgurUpload.cpp +++ b/api/logic/screenshots/ImgurUpload.cpp @@ -24,7 +24,7 @@ void ImgurUpload::start() m_status = Job_InProgress; QNetworkRequest request(m_url); request.setHeader(QNetworkRequest::UserAgentHeader, BuildConfig.USER_AGENT_UNCACHED); - request.setRawHeader("Authorization", "Client-ID 5b97b0713fba4a3"); + request.setRawHeader("Authorization", QString("Client-ID %1").arg(BuildConfig.IMGUR_CLIENT_ID).toStdString().c_str()); request.setRawHeader("Accept", "application/json"); QFile f(m_shot->m_file.absoluteFilePath()); diff --git a/buildconfig/BuildConfig.cpp.in b/buildconfig/BuildConfig.cpp.in index 577bdcb26..60d417a6e 100644 --- a/buildconfig/BuildConfig.cpp.in +++ b/buildconfig/BuildConfig.cpp.in @@ -33,6 +33,7 @@ Config::Config() VERSION_STR = "@MultiMC_VERSION_STRING@"; NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@"; PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@"; + IMGUR_CLIENT_ID = "@MultiMC_IMGUR_CLIENT_ID@"; META_URL = "@MultiMC_META_URL@"; BUG_TRACKER_URL = "@MultiMC_BUG_TRACKER_URL@"; diff --git a/buildconfig/BuildConfig.h b/buildconfig/BuildConfig.h index 07d7a23a3..185bebadf 100644 --- a/buildconfig/BuildConfig.h +++ b/buildconfig/BuildConfig.h @@ -65,6 +65,11 @@ public: */ QString PASTE_EE_KEY; + /** + * Client ID you can get from Imgur when you register an application + */ + QString IMGUR_CLIENT_ID; + /** * MultiMC Metadata repository URL prefix */ From 66fde9e6b7cfb9fe7cdf30b0aa0432cd892b6a7a Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 13 Jul 2021 15:42:44 +0100 Subject: [PATCH 3/5] NOISSUE Correct trending URL string for Technic packs This seems to have just been an inadvertent mistake when copy-pasting. This commit just removes an annoying warning. --- application/pages/modplatform/technic/TechnicModel.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/application/pages/modplatform/technic/TechnicModel.cpp b/application/pages/modplatform/technic/TechnicModel.cpp index a240a94a4..def307830 100644 --- a/application/pages/modplatform/technic/TechnicModel.cpp +++ b/application/pages/modplatform/technic/TechnicModel.cpp @@ -95,9 +95,7 @@ void Technic::ListModel::performSearch() NetJob *netJob = new NetJob("Technic::Search"); QString searchUrl = ""; if (currentSearchTerm.isEmpty()) { - searchUrl = QString( - "https://api.technicpack.net/trending?build=multimc" - ).arg(currentSearchTerm); + searchUrl = "https://api.technicpack.net/trending?build=multimc"; } else { From d63ef939bec200f9c510cbc2ae50531802ff7bfc Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 13 Jul 2021 16:02:04 +0100 Subject: [PATCH 4/5] NOISSUE Update Patreon logo The logo was taken from Patreon's brand assets [1] archive, and shrunk to size with KolourPaint. [1] https://www.patreon.com/brand --- .../resources/multimc/16x16/patreon.png | Bin 682 -> 840 bytes .../resources/multimc/22x22/patreon.png | Bin 976 -> 939 bytes .../resources/multimc/24x24/patreon.png | Bin 1034 -> 977 bytes .../resources/multimc/32x32/patreon.png | Bin 1450 -> 1086 bytes .../resources/multimc/48x48/patreon.png | Bin 2317 -> 1390 bytes .../resources/multimc/64x64/patreon.png | Bin 3212 -> 1667 bytes 6 files changed, 0 insertions(+), 0 deletions(-) diff --git a/application/resources/multimc/16x16/patreon.png b/application/resources/multimc/16x16/patreon.png index cde2b326d1ad6d8e36a4e1ca0ba189cfea87d04f..9150c478fae1b5da24d9c6c4921413e186571b1b 100644 GIT binary patch delta 817 zcmV-11J3-a1;_@FB!A&)Lqkw=Qb$4n02q~HU|>AW00c}93=Fw>B}GB*P6`o`Q3?!5 zAThbPfB`pPWMKGq4MZ|9T-FUNVdcl878~F!0$K>9KLD{vI+)GK0%9jY*b*Ric}YPD zkgWq^Cl?ff*gzLE@DzmvIRn`~K(<0U5<3ZroswFd3}oj3*?;i}zva(oV6gbYz`#5a zA(k|afnj?)1B1jJgqX@g1_u6C28L~y5n`YH!Tx0wJ5-WdQ34Y2(|2SjNGwVOOEZH4 zG%byR;nQ*k2Hr>p2H^_~3|!F=cYpzFF)*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H+@y*G?#K&N2_#ha{X=Y)q&BS?suv|fRB`Pf zA&?Rp1tAht;f7Ek0+n$0@T~r@9*O+i-9DIL1q8CE=@yFw7Ut_)3Fv$;<$tVH$Ss7@ zx{(k{9nelDrz1jyM$%g;+<1noW+gm2Jz7UbXOQ>j9SCIL4qGI!_c}mZ*=f1UkjGQmgYn zt)mr@zUo*Z(+@H+q3Co5R0ucbRwKaX#l@5mYE%O8y!PtEyQ(9(=!+4V^mHOZ#c;!^ zYDz@7#HZSQzhaAB2!Ekk2*lQLw?KxNg-jVC$T%UK+EnEe)9)|I=3`wxtNJk42NNVo zoT0G@#CD$Q3Sou>lJqg5z6Xa&T@5sJF>&frzNvdiZ-~$o1d7)7V`d#bDN=jNK2!Zh z_ujvqq!Y&I(LUJX6B1ml6(j5j0Nq}}D zzndAhsZS$mi_bhV%_k(FncG*tMyQ1VDnxk1zg4n!JBP0r)tm=>f+;?SFyt>qi_>;G zLoEcTl*l0$pY|Wmk72|;?e&`M>QNCiaXocCFFsG#n@5kvCy;_W0^fd~xl?wRT7{>p zOJxl10kqlix_=lO^3PR1DFNSz_G~%=+lxCd&##$U`MqIW;ymyl0-B2eJ73LtYQ+Zb z@FlSO`?&l62L#?<8*XdyTB&uAFqGfL`@8D_{$s$7B!E=XZPE+H>!e1bxM-G7E`g?L z7k51%{O+iQ0N+okp7mj^E1H3 zM|6`o%b%e5Cd8efzFI-ploQU^ bTD15OnQqQ+%qp!500000NkvXXu0mjfT>Vs> diff --git a/application/resources/multimc/64x64/patreon.png b/application/resources/multimc/64x64/patreon.png index 7b4814ec6d654099277a0e157ac5e145e65aa5b6..ef5d690ebf9e4dd895df66a08203c90271a5634d 100644 GIT binary patch delta 1650 zcmV-&295cQ8G{XwB!A&)Lqkw=Qb$4n02q~HU|>AW00c}93=Fw>B}GB*P6`o`Q3?!5 zAThbPfB`pPWMKGq4MZ|9T-FUNVdcl878~F!0$K>9KLD{vI+)GK0%9jY*b*Ric}YPD zkgWq^Cl?ff*gz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8mC?>oM6AQ4OW13#{{zOH$L_9F^ZEb)002ovPDHLkU;%;x%N()* From 74f5255eef8b14455ca741c5004a97cd00fed667 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Tue, 13 Jul 2021 16:59:33 +0100 Subject: [PATCH 5/5] GH-3930 Track duration of previous game sessions --- api/logic/BaseInstance.cpp | 17 ++++++++++++++++- api/logic/BaseInstance.h | 1 + api/logic/minecraft/MinecraftInstance.cpp | 10 ++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/api/logic/BaseInstance.cpp b/api/logic/BaseInstance.cpp index cff166314..46b458271 100644 --- a/api/logic/BaseInstance.cpp +++ b/api/logic/BaseInstance.cpp @@ -37,6 +37,7 @@ BaseInstance::BaseInstance(SettingsObjectPtr globalSettings, SettingsObjectPtr s m_settings->registerSetting("notes", ""); m_settings->registerSetting("lastLaunchTime", 0); m_settings->registerSetting("totalTimePlayed", 0); + m_settings->registerSetting("lastTimePlayed", 0); // Custom Commands auto commandSetting = m_settings->registerSetting({"OverrideCommands","OverrideLaunchCmd"}, false); @@ -146,9 +147,12 @@ void BaseInstance::setRunning(bool running) } else { - qint64 current = settings()->get("totalTimePlayed").toLongLong(); QDateTime timeEnded = QDateTime::currentDateTime(); + + qint64 current = settings()->get("totalTimePlayed").toLongLong(); settings()->set("totalTimePlayed", current + m_timeStarted.secsTo(timeEnded)); + settings()->set("lastTimePlayed", m_timeStarted.secsTo(timeEnded)); + emit propertiesChanged(this); } @@ -166,9 +170,20 @@ int64_t BaseInstance::totalTimePlayed() const return current; } +int64_t BaseInstance::lastTimePlayed() const +{ + if(m_isRunning) + { + QDateTime timeNow = QDateTime::currentDateTime(); + return m_timeStarted.secsTo(timeNow); + } + return settings()->get("lastTimePlayed").toLongLong(); +} + void BaseInstance::resetTimePlayed() { settings()->reset("totalTimePlayed"); + settings()->reset("lastTimePlayed"); } QString BaseInstance::instanceType() const diff --git a/api/logic/BaseInstance.h b/api/logic/BaseInstance.h index 64de4bb3d..d250e03e0 100644 --- a/api/logic/BaseInstance.h +++ b/api/logic/BaseInstance.h @@ -87,6 +87,7 @@ public: void setRunning(bool running); bool isRunning() const; int64_t totalTimePlayed() const; + int64_t lastTimePlayed() const; void resetTimePlayed(); /// get the type of this instance diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index ea1e47b6c..dbf9f8166 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -798,9 +798,15 @@ QString MinecraftInstance::getStatusbarDescription() QString description; description.append(tr("Minecraft %1 (%2)").arg(m_components->getComponentVersion("net.minecraft")).arg(typeName())); - if(m_settings->get("ShowGameTime").toBool() && totalTimePlayed() > 0) + if(m_settings->get("ShowGameTime").toBool()) { - description.append(tr(", played for %1").arg(prettifyTimeDuration(totalTimePlayed()))); + if (lastTimePlayed() > 0) { + description.append(tr(", last played for %1").arg(prettifyTimeDuration(lastTimePlayed()))); + } + + if (totalTimePlayed() > 0) { + description.append(tr(", total played for %1").arg(prettifyTimeDuration(totalTimePlayed()))); + } } if(hasCrashed()) {