Yacht icon indicating copy to clipboard operation
Yacht copied to clipboard

[Feature Request/Issue] Capability to unregister service worker from within the app via url

Open pedroCX486 opened this issue 3 years ago • 2 comments

  • Is your feature request related to a problem? Please describe.

Currently there is no way to unregister the service worker (or disable it entirely) for the PWA, which causes problems with situations like (some) updates not loading and instead loading the previous UI version (it will always load from cache first) and situations where Yacht is behind an gateway like Cloudflare Access, it will always load the app but ignore things like the Access Gateway cookie expiring, requiring a redirect to re-login. In this last situation the app loads and makes an infinite loop (especially on iOS, where deleting Site Data is currently broken on Chrome based browsers, it doesn't unregister the service worker), locking up the tab.

A great example of the issue for me is, I took yacht down and on MS Edge and Chrome (both iOS), I can still see the login screen and type on it instead of seeing the usual error from CloudFlare. And if you were already logged in, you can even see the dashboard homepage, but incapable of being interacted because of an infinite loop in the requests (why incessantly try again and again if there was an error? Asking the user to reload after, say 2 retries, is best.) that locks up the tab.

  • Describe the solution you'd like

An web endpoint like the Misskey project does, hostname.example/flush (live example here: http://misskey.cf/flush, page source is not obfuscated), where you can access at anytime without being authenticated (and isn't behind the service worker) that will unregister the service worker and clean localstorage/any cache it can programatically.

  • Describe alternatives you've considered

Removing service workers entirely for the app. It's somewhat unnecessary for this type of application.

  • Additional context

Have none at the moment.

pedroCX486 avatar Jan 03 '23 02:01 pedroCX486

I actually have disabled PWA functionality in the devel image due to widespread caching issues. I’ll take a look at adding that functionality back in and utilizing this.

SelfhostedPro avatar Jan 03 '23 04:01 SelfhostedPro

@SelfhostedPro Thanks for the reply! In my case, since I started with a non-devel image, and later tried to switch, I was still having issues with the PWA persisting and not updating the local version. I should try starting from scratch with the devel image, since I had to fully reinstall the browsers on my phone to be even able to access the URL again through there.

pedroCX486 avatar Jan 03 '23 05:01 pedroCX486