From a6c91afde46e27c0c67f59274d34c62912aadbc0 Mon Sep 17 00:00:00 2001 From: DatGuy1 Date: Fri, 3 Jan 2020 22:11:00 +0200 Subject: [PATCH] Remove support for CBenni's Logviewer (#1458) --- src/widgets/dialogs/LogsPopup.cpp | 57 ++----------------------------- src/widgets/dialogs/LogsPopup.hpp | 1 - 2 files changed, 3 insertions(+), 55 deletions(-) diff --git a/src/widgets/dialogs/LogsPopup.cpp b/src/widgets/dialogs/LogsPopup.cpp index 695b4e567..18e1f1a04 100644 --- a/src/widgets/dialogs/LogsPopup.cpp +++ b/src/widgets/dialogs/LogsPopup.cpp @@ -54,7 +54,7 @@ void LogsPopup::getLogs() dynamic_cast(this->channel_.get())) { this->channelName_ = twitchChannel->getName(); - this->getLogviewerLogs(twitchChannel->roomId()); + this->getOverrustleLogs(); return; } @@ -62,10 +62,7 @@ void LogsPopup::getLogs() if (!this->channelName_.isEmpty()) { - PartialTwitchUser::byName(this->channelName_) - .getId( - [=](const QString &roomID) { this->getLogviewerLogs(roomID); }, - this); + this->getOverrustleLogs(); return; } @@ -80,57 +77,9 @@ void LogsPopup::setMessages(std::vector &messages) SearchPopup::setChannel(logsChannel); } -void LogsPopup::getLogviewerLogs(const QString &roomID) -{ - auto url = QString("https://cbenni.com/api/logs/%1/?nick=%2&before=500") - .arg(this->channelName_, this->userName_); - - NetworkRequest(url) - .caller(this) - .onError([this](NetworkResult) { this->getOverrustleLogs(); }) - .onSuccess([this, roomID](auto result) -> Outcome { - auto data = result.parseJson(); - std::vector messages; - - QJsonValue before = data.value("before"); - - for (auto i : before.toArray()) - { - auto messageObject = i.toObject(); - QString message = messageObject.value("text").toString(); - - // Hacky way to fix the timestamp - message.insert(1, "historical=1;"); - message.insert(1, QString("tmi-sent-ts=%10000;") - .arg(messageObject["time"].toInt())); - message.insert(1, QString("room-id=%1;").arg(roomID)); - - MessageParseArgs args; - auto ircMessage = - Communi::IrcMessage::fromData(message.toUtf8(), nullptr); - auto privMsg = - static_cast(ircMessage); - TwitchMessageBuilder builder(this->channel_.get(), privMsg, - args); - builder.message().searchText = message; - - messages.push_back(builder.build()); - } - - messages.push_back( - MessageBuilder(systemMessage, - "Logs provided by https://cbenni.com") - .release()); - this->setMessages(messages); - - return Success; - }) - .execute(); -} - void LogsPopup::getOverrustleLogs() { - QString url = + auto url = QString("https://overrustlelogs.net/api/v1/stalk/%1/%2.json?limit=500") .arg(this->channelName_, this->userName_); diff --git a/src/widgets/dialogs/LogsPopup.hpp b/src/widgets/dialogs/LogsPopup.hpp index 66bf19acc..ab29ae431 100644 --- a/src/widgets/dialogs/LogsPopup.hpp +++ b/src/widgets/dialogs/LogsPopup.hpp @@ -26,7 +26,6 @@ private: void setMessages(std::vector &messages); void getOverrustleLogs(); - void getLogviewerLogs(const QString &roomID); }; } // namespace chatterino