mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Remove support for CBenni's Logviewer (#1458)
This commit is contained in:
parent
7f4b7564da
commit
a6c91afde4
2 changed files with 3 additions and 55 deletions
|
@ -54,7 +54,7 @@ void LogsPopup::getLogs()
|
||||||
dynamic_cast<TwitchChannel *>(this->channel_.get()))
|
dynamic_cast<TwitchChannel *>(this->channel_.get()))
|
||||||
{
|
{
|
||||||
this->channelName_ = twitchChannel->getName();
|
this->channelName_ = twitchChannel->getName();
|
||||||
this->getLogviewerLogs(twitchChannel->roomId());
|
this->getOverrustleLogs();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,7 @@ void LogsPopup::getLogs()
|
||||||
|
|
||||||
if (!this->channelName_.isEmpty())
|
if (!this->channelName_.isEmpty())
|
||||||
{
|
{
|
||||||
PartialTwitchUser::byName(this->channelName_)
|
this->getOverrustleLogs();
|
||||||
.getId(
|
|
||||||
[=](const QString &roomID) { this->getLogviewerLogs(roomID); },
|
|
||||||
this);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,57 +77,9 @@ void LogsPopup::setMessages(std::vector<MessagePtr> &messages)
|
||||||
SearchPopup::setChannel(logsChannel);
|
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<MessagePtr> 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<Communi::IrcPrivateMessage *>(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()
|
void LogsPopup::getOverrustleLogs()
|
||||||
{
|
{
|
||||||
QString url =
|
auto url =
|
||||||
QString("https://overrustlelogs.net/api/v1/stalk/%1/%2.json?limit=500")
|
QString("https://overrustlelogs.net/api/v1/stalk/%1/%2.json?limit=500")
|
||||||
.arg(this->channelName_, this->userName_);
|
.arg(this->channelName_, this->userName_);
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ private:
|
||||||
|
|
||||||
void setMessages(std::vector<MessagePtr> &messages);
|
void setMessages(std::vector<MessagePtr> &messages);
|
||||||
void getOverrustleLogs();
|
void getOverrustleLogs();
|
||||||
void getLogviewerLogs(const QString &roomID);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
Loading…
Reference in a new issue