Skip to content

Commit

Permalink
Updated Youtube plugin to check published field
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianusIV committed Sep 23, 2023
1 parent 2fee6b9 commit 801df48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 0 additions & 2 deletions DefaultPlugins/TwitchConsumer/TwitchConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ public Response HandleGet(Lease lease, Request request)

public Response HandlePost(Lease lease, Request request)
{
Logger!.LogWarning("Incoming POST request for twitch plugin\nRequest:\n{}", request);

var data = lease.GetObjectFromConsumerString<DefaultTwitchConsPluginData>();
if (data is null)
return new Response() { ReturnStatus = HttpStatusCode.InternalServerError };
Expand Down
7 changes: 7 additions & 0 deletions DefaultPlugins/YouTubeConsumer/YouTubeConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ public Response HandlePost(Lease lease, Request request)
response.ReturnStatus = HttpStatusCode.InternalServerError;
return response;
}

if (xml.entry.published < DateTime.Now - TimeSpan.FromHours(3))
{
response.ReturnStatus = HttpStatusCode.Conflict;
return response;
}

//set properties to pass to publisher
response.ItemUrl = xml.entry.link.href;
response.Username = xml.entry.author.name;
Expand Down

0 comments on commit 801df48

Please sign in to comment.