From 706605c99e30bc95f0fac1b668b36729795bd586 Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sat, 24 Jul 2021 12:52:00 +0200 Subject: [PATCH 1/3] Remove copyDarkTheme.png which was an unused SVG file. (#3056) Co-authored-by: pajlada --- resources/buttons/copyDarkTheme.png | 124 ------------------------- resources/resources_autogenerated.qrc | 1 - src/autogenerated/ResourcesAutogen.cpp | 1 - src/autogenerated/ResourcesAutogen.hpp | 1 - 4 files changed, 127 deletions(-) delete mode 100644 resources/buttons/copyDarkTheme.png diff --git a/resources/buttons/copyDarkTheme.png b/resources/buttons/copyDarkTheme.png deleted file mode 100644 index e225ee4ea..000000000 --- a/resources/buttons/copyDarkTheme.png +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - Trashcan top - - - - - - - diff --git a/resources/resources_autogenerated.qrc b/resources/resources_autogenerated.qrc index e84cf6320..c40edc973 100644 --- a/resources/resources_autogenerated.qrc +++ b/resources/resources_autogenerated.qrc @@ -14,7 +14,6 @@ buttons/banRed.png buttons/copyDark.png buttons/copyDark.svg - buttons/copyDarkTheme.png buttons/copyLight.png buttons/copyLight.svg buttons/emote.svg diff --git a/src/autogenerated/ResourcesAutogen.cpp b/src/autogenerated/ResourcesAutogen.cpp index 7298a9f76..d4b48b970 100644 --- a/src/autogenerated/ResourcesAutogen.cpp +++ b/src/autogenerated/ResourcesAutogen.cpp @@ -15,7 +15,6 @@ Resources2::Resources2() this->buttons.ban = QPixmap(":/buttons/ban.png"); this->buttons.banRed = QPixmap(":/buttons/banRed.png"); this->buttons.copyDark = QPixmap(":/buttons/copyDark.png"); - this->buttons.copyDarkTheme = QPixmap(":/buttons/copyDarkTheme.png"); this->buttons.copyLight = QPixmap(":/buttons/copyLight.png"); this->buttons.menuDark = QPixmap(":/buttons/menuDark.png"); this->buttons.menuLight = QPixmap(":/buttons/menuLight.png"); diff --git a/src/autogenerated/ResourcesAutogen.hpp b/src/autogenerated/ResourcesAutogen.hpp index f832981ea..7277cc681 100644 --- a/src/autogenerated/ResourcesAutogen.hpp +++ b/src/autogenerated/ResourcesAutogen.hpp @@ -22,7 +22,6 @@ public: QPixmap ban; QPixmap banRed; QPixmap copyDark; - QPixmap copyDarkTheme; QPixmap copyLight; QPixmap menuDark; QPixmap menuLight; From b8bd0a587d034b97a61515c2a2e25ed7a1a014e3 Mon Sep 17 00:00:00 2001 From: ilyazzz Date: Sat, 24 Jul 2021 14:30:21 +0300 Subject: [PATCH 2/3] Disable update checker on Flatpak (#3051) Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/singletons/Updates.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c23d71dd..e57bba73a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Bugfix: Fixed "smiley" emotes being unable to be "Tabbed" with autocompletion, introduced in v2.3.3. (#3010) - Bugfix: Fixed comma appended to username completion when not at the beginning of the message. (#3060) - Dev: Ubuntu packages are now available (#2936) +- Dev: Disabled update checker on Flatpak. (#3051) ## 2.3.3 diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index 75e9275e1..5751b59cc 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -240,6 +240,12 @@ void Updates::checkForUpdates() return; } + // Disable updates on Flatpak + if (QFileInfo::exists("/.flatpak-info")) + { + return; + } + // Disable updates if on nightly if (Modes::instance().isNightly) { From f949d6d1540bcc0a8707aea79020a59f71b9fe7c Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Sun, 25 Jul 2021 00:52:34 +0200 Subject: [PATCH 3/3] Add HTTP logging (#2991) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Paweł Co-authored-by: pajlada --- CHANGELOG.md | 1 + src/common/NetworkCommon.hpp | 7 +++++ src/common/NetworkPrivate.cpp | 50 +++++++++++++++++++++++++++++++++++ src/common/QLogging.cpp | 1 + src/common/QLogging.hpp | 1 + 5 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e57bba73a..8f29536b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Bugfix: Fixed comma appended to username completion when not at the beginning of the message. (#3060) - Dev: Ubuntu packages are now available (#2936) - Dev: Disabled update checker on Flatpak. (#3051) +- Dev: Add logging for HTTP requests (#2991) ## 2.3.3 diff --git a/src/common/NetworkCommon.hpp b/src/common/NetworkCommon.hpp index 5f90a95a0..cb37cf43d 100644 --- a/src/common/NetworkCommon.hpp +++ b/src/common/NetworkCommon.hpp @@ -24,6 +24,13 @@ enum class NetworkRequestType { Delete, Patch, }; +const static std::vector networkRequestTypes{ + "GET", // + "POST", // + "PUT", // + "DELETE", // + "PATCH", // +}; // parseHeaderList takes a list of headers in string form, // where each header pair is separated by semicolons (;) and the header name and value is divided by a colon (:) diff --git a/src/common/NetworkPrivate.cpp b/src/common/NetworkPrivate.cpp index b141cd853..c49fcff97 100644 --- a/src/common/NetworkPrivate.cpp +++ b/src/common/NetworkPrivate.cpp @@ -145,6 +145,11 @@ void loadUncached(const std::shared_ptr &data) data->timer_, &QTimer::timeout, worker, [reply, data]() { qCDebug(chatterinoCommon) << "Aborted!"; reply->abort(); + qCDebug(chatterinoHTTP) + << QString("%1 [timed out] %2") + .arg(networkRequestTypes.at( + int(data->requestType_)), + data->request_.url().toString()); if (data->onError_) { @@ -181,6 +186,11 @@ void loadUncached(const std::shared_ptr &data) QNetworkReply::NetworkError::OperationCanceledError) { // Operation cancelled, most likely timed out + qCDebug(chatterinoHTTP) + << QString("%1 [cancelled] %2") + .arg(networkRequestTypes.at( + int(data->requestType_)), + data->request_.url().toString()); return; } @@ -188,6 +198,25 @@ void loadUncached(const std::shared_ptr &data) { auto status = reply->attribute( QNetworkRequest::HttpStatusCodeAttribute); + if (data->requestType_ == NetworkRequestType::Get) + { + qCDebug(chatterinoHTTP) + << QString("%1 %2 %3") + .arg(networkRequestTypes.at( + int(data->requestType_)), + QString::number(status.toInt()), + data->request_.url().toString()); + } + else + { + qCDebug(chatterinoHTTP) + << QString("%1 %2 %3 %4") + .arg(networkRequestTypes.at( + int(data->requestType_)), + QString::number(status.toInt()), + data->request_.url().toString(), + QString(data->payload_)); + } // TODO: Should this always be run on the GUI thread? postToThread([data, code = status.toInt()] { data->onError_(NetworkResult({}, code)); @@ -227,6 +256,23 @@ void loadUncached(const std::shared_ptr &data) reply->deleteLater(); + if (data->requestType_ == NetworkRequestType::Get) + { + qCDebug(chatterinoHTTP) + << QString("%1 %2 %3") + .arg(networkRequestTypes.at(int(data->requestType_)), + QString::number(status.toInt()), + data->request_.url().toString()); + } + else + { + qCDebug(chatterinoHTTP) + << QString("%1 %3 %2 %4") + .arg(networkRequestTypes.at(int(data->requestType_)), + data->request_.url().toString(), + QString::number(status.toInt()), + QString(data->payload_)); + } if (data->finally_) { if (data->executeConcurrently_) @@ -286,6 +332,10 @@ void loadCached(const std::shared_ptr &data) QByteArray bytes = cachedFile.readAll(); NetworkResult result(bytes, 200); + qCDebug(chatterinoHTTP) + << QString("%1 [CACHED] 200 %2") + .arg(networkRequestTypes.at(int(data->requestType_)), + data->request_.url().toString()); if (data->onSuccess_) { if (data->executeConcurrently_ || isGuiThread()) diff --git a/src/common/QLogging.cpp b/src/common/QLogging.cpp index 742cbe243..a54b3296c 100644 --- a/src/common/QLogging.cpp +++ b/src/common/QLogging.cpp @@ -15,6 +15,7 @@ Q_LOGGING_CATEGORY(chatterinoCommon, "chatterino.common", logThreshold); Q_LOGGING_CATEGORY(chatterinoEmoji, "chatterino.emoji", logThreshold); Q_LOGGING_CATEGORY(chatterinoFfzemotes, "chatterino.ffzemotes", logThreshold); Q_LOGGING_CATEGORY(chatterinoHelper, "chatterino.helper", logThreshold); +Q_LOGGING_CATEGORY(chatterinoHTTP, "chatterino.http", logThreshold); Q_LOGGING_CATEGORY(chatterinoImage, "chatterino.image", logThreshold); Q_LOGGING_CATEGORY(chatterinoIrc, "chatterino.irc", logThreshold); Q_LOGGING_CATEGORY(chatterinoIvr, "chatterino.ivr", logThreshold); diff --git a/src/common/QLogging.hpp b/src/common/QLogging.hpp index b157d79a6..e588ad48a 100644 --- a/src/common/QLogging.hpp +++ b/src/common/QLogging.hpp @@ -11,6 +11,7 @@ Q_DECLARE_LOGGING_CATEGORY(chatterinoCommon); Q_DECLARE_LOGGING_CATEGORY(chatterinoEmoji); Q_DECLARE_LOGGING_CATEGORY(chatterinoFfzemotes); Q_DECLARE_LOGGING_CATEGORY(chatterinoHelper); +Q_DECLARE_LOGGING_CATEGORY(chatterinoHTTP); Q_DECLARE_LOGGING_CATEGORY(chatterinoImage); Q_DECLARE_LOGGING_CATEGORY(chatterinoIrc); Q_DECLARE_LOGGING_CATEGORY(chatterinoIvr);