Skip to content

Commit

Permalink
Add time constraint to twitch plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianusIV committed Jul 7, 2023
1 parent bf557d7 commit 2fee6b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions DefaultPlugins/TwitchConsumer/TwitchConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ public Response HandlePost(Lease lease, Request request)
if (notifPayload is null)
return new Response() { ReturnStatus = HttpStatusCode.InternalServerError };

if (DateTime.Parse(request.Headers["twitch-eventsub-message-signature"]) < DateTime.Now - TimeSpan.FromMinutes(10))
return new Response() { ReturnStatus = HttpStatusCode.BadRequest };

return new Response()
{
ItemUrl = $"https://www.twitch.tv/{notifPayload.Event.BroadcasterUserName}",
Expand Down

0 comments on commit 2fee6b9

Please sign in to comment.