fix: enable Twitch EventSub by default (#6040)

this should let us get some more eyes on the implementation and make
sure it doesn't misbehave
This commit is contained in:
pajlada
2025-03-08 12:13:58 +01:00
committed by GitHub
parent 266dc8d202
commit 0835064375
3 changed files with 49 additions and 12 deletions
+1 -1
View File
@@ -38,7 +38,7 @@
- Bugfix: Fixed color input thinking blue is also red. (#5982)
- Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011)
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036)
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040)
- Dev: Remove unneeded platform specifier for toasts. (#5914)
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
- Dev: Removed unused PubSub whisper code. (#5898)
+1 -1
View File
@@ -659,7 +659,7 @@ public:
};
BoolSetting enableExperimentalEventSub = {
"/eventsub/enableExperimental",
false,
true,
};
QStringSetting additionalExtensionIDs{"/misc/additionalExtensionIDs", ""};
+47 -10
View File
@@ -1,3 +1,4 @@
#include "mocks/BaseApplication.hpp"
#include "providers/twitch/PubSubActions.hpp"
#include "providers/twitch/PubSubClient.hpp"
#include "providers/twitch/PubSubManager.hpp"
@@ -73,6 +74,14 @@ public:
}
};
const QString TEST_SETTINGS = R"(
{
"eventsub": {
"enableExperimental": false
}
}
)";
class FTest : public PubSub
{
public:
@@ -86,9 +95,28 @@ public:
}
};
class MockApplication : public mock::BaseApplication
{
public:
MockApplication(const char *path, std::chrono::seconds pingInterval,
QString token = "token")
: mock::BaseApplication(TEST_SETTINGS)
, pubSub(path, pingInterval, token)
{
}
PubSub *getTwitchPubSub() override
{
return &this->pubSub;
}
FTest pubSub;
};
TEST(TwitchPubSubClient, ServerRespondsToPings)
{
FTest pubSub("", 1s);
MockApplication a("", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -127,7 +155,8 @@ TEST(TwitchPubSubClient, ServerRespondsToPings)
TEST(TwitchPubSubClient, ServerDoesntRespondToPings)
{
FTest pubSub("/dont-respond-to-ping", 1s);
MockApplication a("/dont-respond-to-ping", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
pubSub.listenToChannelModerationActions("123456");
@@ -156,7 +185,8 @@ TEST(TwitchPubSubClient, ServerDoesntRespondToPings)
TEST(TwitchPubSubClient, DisconnectedAfter1s)
{
FTest pubSub("/disconnect-client-after-1s", 10s);
MockApplication a("/disconnect-client-after-1s", 10s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -191,7 +221,8 @@ TEST(TwitchPubSubClient, DisconnectedAfter1s)
TEST(TwitchPubSubClient, ExceedTopicLimit)
{
FTest pubSub("", 1s);
MockApplication a("", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -231,7 +262,8 @@ TEST(TwitchPubSubClient, ExceedTopicLimit)
TEST(TwitchPubSubClient, ExceedTopicLimitSingleStep)
{
FTest pubSub("", 1s);
MockApplication a("", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -260,7 +292,8 @@ TEST(TwitchPubSubClient, ExceedTopicLimitSingleStep)
TEST(TwitchPubSubClient, ModeratorActionsUserBanned)
{
FTest pubSub("/moderator-actions-user-banned", 1s);
MockApplication a("/moderator-actions-user-banned", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -303,7 +336,8 @@ TEST(TwitchPubSubClient, ModeratorActionsUserBanned)
TEST(TwitchPubSubClient, MissingToken)
{
// The token that's required is "xD"
FTest pubSub("/authentication-required", 1s, "");
MockApplication a("/authentication-required", 1s, "");
auto &pubSub = a.pubSub;
pubSub.start();
@@ -328,7 +362,8 @@ TEST(TwitchPubSubClient, MissingToken)
TEST(TwitchPubSubClient, WrongToken)
{
// The token that's required is "xD"
FTest pubSub("/authentication-required", 1s);
MockApplication a("/authentication-required", 1s);
auto &pubSub = a.pubSub;
pubSub.start();
@@ -353,7 +388,8 @@ TEST(TwitchPubSubClient, WrongToken)
TEST(TwitchPubSubClient, CorrectToken)
{
// The token that's required is "xD"
FTest pubSub("/authentication-required", 1s, "xD");
MockApplication a("/authentication-required", 1s, "xD");
auto &pubSub = a.pubSub;
pubSub.start();
@@ -377,7 +413,8 @@ TEST(TwitchPubSubClient, CorrectToken)
TEST(TwitchPubSubClient, AutoModMessageHeld)
{
FTest pubSub("/automod-held", 1s);
MockApplication a("/automod-held", 1s);
auto &pubSub = a.pubSub;
pubSub.start();