mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Fix invalid channel selections leading to event sub disconnect
Repeated invalid POSTs to /helix/eventsub/subscriptions will lead to a disconnect of the event sub websocket connection. Thus one single invalid channel selection could tear down any existing subscriptions with it.
This commit is contained in:
parent
d20a975c4f
commit
4cac4584f3
|
|
@ -197,7 +197,7 @@ void TwitchChannel::ResolveVariables()
|
|||
_name.ResolveVariables();
|
||||
}
|
||||
|
||||
bool TwitchChannel::IsValid(const std::string &id) const
|
||||
bool TwitchChannel::IsValid(const std::string &id)
|
||||
{
|
||||
return id != "invalid" && !id.empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ struct TwitchChannel {
|
|||
void SetName(const StringVariable &name) { _name = name; }
|
||||
StringVariable GetName() const { return _name; }
|
||||
std::string GetUserID(const TwitchToken &token) const;
|
||||
bool IsValid(const std::string &id) const;
|
||||
static bool IsValid(const std::string &id);
|
||||
std::optional<ChannelLiveInfo> GetLiveInfo(const TwitchToken &) const;
|
||||
std::optional<ChannelInfo> GetInfo(const TwitchToken &) const;
|
||||
void ResolveVariables();
|
||||
|
|
|
|||
|
|
@ -1096,6 +1096,13 @@ void MacroConditionTwitch::AddChannelGenericEventSubscription(
|
|||
return;
|
||||
}
|
||||
|
||||
const auto channelID = _channel.GetUserID(*token);
|
||||
if (!TwitchChannel::IsValid(channelID)) {
|
||||
vblog(LOG_INFO, "skip %s because of invalid channel selection",
|
||||
__func__);
|
||||
return;
|
||||
}
|
||||
|
||||
OBSDataAutoRelease temp = obs_data_create();
|
||||
Subscription subscription{temp.Get()};
|
||||
obs_data_set_string(subscription.data, "type",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user