theshoregroup / digital-signage

A powerful, extensible digital signage solution by The Shore Group, written in ReactJS, wrapped in Electron for some system-level integration not possible with a PWA, and styled with TailwindCSS.
digital-signage-smoky.vercel.app
MIT License
11 stars 3 forks source link

News Feed (port away from NewsAPI) #49

Closed limegorilla closed 2 years ago

limegorilla commented 2 years ago

Originally this was an issue for adding in custom news feeds for each office - it now is porting over to a new one seeing as https://newsapi.org no longer returns results.

The fix? Another service! At some point an RSS feed may not be a bad idea - the rate limit for this is 200/day which, with 10 offices is just 20/req per day (although that's still enough for 1/h)

Implementation plan

In the short term - as DS is on the wall right now - hardcoding is okay. I just need a news feed with ~10 stories to display.

In the long term though?

  1. I'd like to cache responses, for the hour. This would allow me to do multiple requests and have all offices show them (or a scoped list) without each instance having to perform the request.
  2. I'd like scoping. I think the best way to do this is for the first request each hour to revalidate the cache, and all of the queries are run through for that first request. The responses are then saved and displayed on the client. NOTE: To make that work (on the revalidate) I'll need to asynchronously return the last hours content and instruct the client to re-request in 5 min (for example) as the lead time is going to be pretty heavy for 5/6 requests (like 2+s) which would be fine I suppose? Either way - something to tackle later.