UniversityRadioYork / WebStudio

Even a pandemic can't keep us quiet! URY's new Work From Home Playout System
https://ury.org.uk/webstudio
7 stars 3 forks source link

Audio caching (ServiceWorker) #107

Open markspolakovs opened 4 years ago

markspolakovs commented 4 years ago

WebStudio is currently hosted at /webstudio//webstudio-dev. This poses an issue when we want to intercept NIPSWeb requests, which are to /myradio/NIPSWeb/{secure,managed}_play. To get this to work we have to scope the service worker to / (done in 47b3c7ed01293760cb60b52b56fa3d0272a63774), which works, but has two problems:

  1. we need to send a Service-Worker-Allow: / header, to even let this work
  2. The service worker controls all requests on ury.org.uk, which means that if we screw up the config we can break the entire site (I did do this once, by accidentally turning all of ury.org.uk into /webstudio dev - fixed in b11de69b0a2d6ad14341e7ed14e7271557955ad9 but the point remains)

Consider possible solutions:

mstratford commented 3 years ago

This is still borked, it currently overrides the webstudio stateserver API urls, and often with an older cached version too. Given the RAM issues we were having, I don't think doing this is suitable anywho.

markspolakovs commented 3 years ago

urg - I suspect some tweaking to the regex in b11de69b0a2d6ad14341e7ed14e7271557955ad9 may be needed