feat(eventsub): reconnect (#6035)

This commit is contained in:
nerix
2025-03-06 22:41:35 +01:00
committed by GitHub
parent 9d1f930e85
commit 914257d537
18 changed files with 305 additions and 45 deletions
+3
View File
@@ -53,6 +53,9 @@ public:
/// By default, there's no explicit timeout for the request.
/// To set a timeout, use NetworkRequest's timeout method
std::optional<std::chrono::milliseconds> timeout{};
#ifndef NDEBUG
bool ignoreSslErrors = false; // for local eventsub
#endif
QString getHash();
+8
View File
@@ -215,4 +215,12 @@ NetworkRequest NetworkRequest::json(const QByteArray &payload) &&
.header("Accept", "application/json");
}
#ifndef NDEBUG
NetworkRequest NetworkRequest::ignoreSslErrors(bool ignore) &&
{
this->data->ignoreSslErrors = ignore;
return std::move(*this);
}
#endif
} // namespace chatterino
+4
View File
@@ -76,6 +76,10 @@ public:
NetworkRequest json(const QJsonDocument &document) &&;
NetworkRequest json(const QByteArray &payload) &&;
#ifndef NDEBUG
NetworkRequest ignoreSslErrors(bool ignore) &&;
#endif
void execute();
private:
+10
View File
@@ -61,6 +61,16 @@ void NetworkTask::run()
QObject::connect(this->reply_, &QNetworkReply::finished, this,
&NetworkTask::finished);
#ifndef NDEBUG
if (this->data_->ignoreSslErrors)
{
QObject::connect(this->reply_, &QNetworkReply::sslErrors, this,
[this](const auto &errors) {
this->reply_->ignoreSslErrors(errors);
});
}
#endif
}
QNetworkReply *NetworkTask::createReply()