feat(eventsub): reconnect (#6035)
This commit is contained in:
@@ -140,6 +140,12 @@ Args::Args(const QApplication &app, const Paths &paths)
|
||||
"specified, Twitch is assumed.",
|
||||
"t:channel");
|
||||
|
||||
#ifndef NDEBUG
|
||||
QCommandLineOption useLocalEventsubOption(
|
||||
"use-local-eventsub",
|
||||
"Use the local eventsub server at 127.0.0.1:3012.");
|
||||
#endif
|
||||
|
||||
parser.addOptions({
|
||||
{{"V", "version"}, "Displays version information."},
|
||||
crashRecoveryOption,
|
||||
@@ -152,6 +158,9 @@ Args::Args(const QApplication &app, const Paths &paths)
|
||||
loginOption,
|
||||
channelLayout,
|
||||
activateOption,
|
||||
#ifndef NDEBUG
|
||||
useLocalEventsubOption,
|
||||
#endif
|
||||
});
|
||||
|
||||
if (!parser.parse(app.arguments()))
|
||||
@@ -216,6 +225,13 @@ Args::Args(const QApplication &app, const Paths &paths)
|
||||
parseActivateOption(parser.value(activateOption));
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (parser.isSet(useLocalEventsubOption))
|
||||
{
|
||||
this->useLocalEventsub = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
this->currentArguments_ = extractCommandLine(parser, {
|
||||
verboseOption,
|
||||
safeModeOption,
|
||||
|
||||
@@ -64,6 +64,11 @@ public:
|
||||
bool verbose{};
|
||||
bool safeMode{};
|
||||
|
||||
#ifndef NDEBUG
|
||||
// twitch event websocket start-server --ssl --port 3012
|
||||
bool useLocalEventsub = false;
|
||||
#endif
|
||||
|
||||
QStringList currentArguments() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -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