From de4bc02b66288601d3c9656614f197efdc27fd19 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 13 Apr 2019 19:23:11 +0200 Subject: [PATCH] Add ability to easily swap out the recent messages API with your own Environment variable: CHATTERINO2_RECENT_MESSAGES_URL For now, the API structure of the recent messages API is undocumented, but once it's released it will have some documentation that describes how to run it yourself, and it should be easy enough to just make your own API that fits --- src/providers/twitch/TwitchChannel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index c32fb138..027d4213 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -604,8 +604,17 @@ Outcome TwitchChannel::parseLiveStatus(const rapidjson::Document &document) void TwitchChannel::loadRecentMessages() { - static QString genericURL = "https://recent-messages.robotty.de/api/v2/" - "recent-messages/%1?clearchatToNotice=true"; + static QString genericURL = [] { + QString url("https://recent-messages.robotty.de/api/v2/recent-messages/" + "%1?clearchatToNotice=true"); + auto envString = std::getenv("CHATTERINO2_RECENT_MESSAGES_URL"); + if (envString != nullptr) + { + url = envString; + } + + return url; + }(); NetworkRequest request(genericURL.arg(this->getName())); request.setCaller(QThread::currentThread());