feat(eventsub): reconnect (#6035)
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user