diff --git a/CHANGELOG.md b/CHANGELOG.md index 36505727d..445033467 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Minor: Delete all but the last 5 crashdumps on application start. (#4392) - Minor: Added `/banid` command that allows banning by user ID. (#4411) +- Bugfix: Fixed FrankerFaceZ emotes/badges not loading due to API change. (#4432) - Bugfix: Fixed uploaded AppImage not being able most web requests. (#4400) - Bugfix: Fixed a potential race condition due to using the wrong lock when loading 7TV badges. (#4402) - Dev: Add capability to build Chatterino with Qt6. (#4393) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fd705c125..0c53153b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -225,6 +225,8 @@ set(SOURCE_FILES providers/ffz/FfzBadges.hpp providers/ffz/FfzEmotes.cpp providers/ffz/FfzEmotes.hpp + providers/ffz/FfzUtil.cpp + providers/ffz/FfzUtil.hpp providers/irc/AbstractIrcServer.cpp providers/irc/AbstractIrcServer.hpp diff --git a/src/providers/ffz/FfzBadges.cpp b/src/providers/ffz/FfzBadges.cpp index 7407c8603..ebeaabf16 100644 --- a/src/providers/ffz/FfzBadges.cpp +++ b/src/providers/ffz/FfzBadges.cpp @@ -4,6 +4,7 @@ #include "common/NetworkResult.hpp" #include "common/Outcome.hpp" #include "messages/Emote.hpp" +#include "providers/ffz/FfzUtil.hpp" #include #include @@ -67,14 +68,12 @@ void FfzBadges::load() auto jsonBadge = jsonBadge_.toObject(); auto jsonUrls = jsonBadge.value("urls").toObject(); - auto emote = Emote{ - EmoteName{}, - ImageSet{ - Url{QString("https:") + jsonUrls.value("1").toString()}, - Url{QString("https:") + jsonUrls.value("2").toString()}, - Url{QString("https:") + - jsonUrls.value("4").toString()}}, - Tooltip{jsonBadge.value("title").toString()}, Url{}}; + auto emote = + Emote{EmoteName{}, + ImageSet{parseFfzUrl(jsonUrls.value("1").toString()), + parseFfzUrl(jsonUrls.value("2").toString()), + parseFfzUrl(jsonUrls.value("4").toString())}, + Tooltip{jsonBadge.value("title").toString()}, Url{}}; Badge badge; diff --git a/src/providers/ffz/FfzEmotes.cpp b/src/providers/ffz/FfzEmotes.cpp index 0cf533e5b..5591f9d51 100644 --- a/src/providers/ffz/FfzEmotes.cpp +++ b/src/providers/ffz/FfzEmotes.cpp @@ -7,6 +7,7 @@ #include "messages/Emote.hpp" #include "messages/Image.hpp" #include "messages/MessageBuilder.hpp" +#include "providers/ffz/FfzUtil.hpp" #include "providers/twitch/TwitchChannel.hpp" #include "singletons/Settings.hpp" @@ -26,8 +27,9 @@ namespace { assert(emote.isString()); - return {"https:" + emote.toString()}; + return parseFfzUrl(emote.toString()); } + void fillInEmoteData(const QJsonObject &urls, const EmoteName &name, const QString &tooltip, Emote &emoteData) { diff --git a/src/providers/ffz/FfzUtil.cpp b/src/providers/ffz/FfzUtil.cpp new file mode 100644 index 000000000..762683a28 --- /dev/null +++ b/src/providers/ffz/FfzUtil.cpp @@ -0,0 +1,12 @@ +#include "providers/ffz/FfzUtil.hpp" + +namespace chatterino { + +Url parseFfzUrl(const QString &ffzUrl) +{ + QUrl asURL(ffzUrl); + asURL.setScheme("https"); + return {asURL.toString()}; +} + +} // namespace chatterino diff --git a/src/providers/ffz/FfzUtil.hpp b/src/providers/ffz/FfzUtil.hpp new file mode 100644 index 000000000..1d4ef65c3 --- /dev/null +++ b/src/providers/ffz/FfzUtil.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include "common/Aliases.hpp" + +#include +#include + +namespace chatterino { + +Url parseFfzUrl(const QString &ffzUrl); + +} // namespace chatterino