diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c23d71dd..8f29536b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - 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) +- Dev: Add logging for HTTP requests (#2991) ## 2.3.3 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 05ecacbf3..15716d86e 100644 --- a/resources/resources_autogenerated.qrc +++ b/resources/resources_autogenerated.qrc @@ -15,7 +15,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; 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); 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) {