service-worker-gateway icon indicating copy to clipboard operation
service-worker-gateway copied to clipboard

feat: service worker awareness of registered subdomains

Open SgtPooki opened this issue 8 months ago • 1 comments

When using the service-worker gateway, everything is client-side except the distribution of the service worker and assets to handle configuration and UI.

I have been thinking for a while that it would be cool to keep a list on the root domain of all subdomains that have been registered, so non-technical users don't need to clear their entire browser cache, or go into service worker config, etc.. to clear things out. Also, it would be cool to be reminded of pages you have cached.

The UI would be something like:

  1. visit inbrowser.link/#ipfs-sw-subdomains (or show on config page.., but we use that when loading subdomains so i dont like that idea)
  2. see a list of subdomains that have been registered. You can click a little gear icon or something to deregister a subdomain service worker (just link to subdomain and ?ipfs-sw-deregister, see #506), or clear it's cache (#507) or just link to subdomains of cached sites you have..

Then you only ever have to remember one URL: inbrowser.link or whatever domain is hosting the sw-gateway you use.

The functionality for knowing what subdomains are registered would be:

  • when loading a subdomain, we load the config page in an iframe to pull the root config.
  • When doing this, we would write to indexDB or similar with the subdomain

What do you think? @lidel @2color @aschmahmann

SgtPooki avatar May 14 '25 18:05 SgtPooki

This hits the same problem space as ipfs pin ls or ipfs refs local – without human-readable, meaningful pet names you end up with thousands of CIDs that cant be reasoned about.

If the CID is a website, then we could read window.document.title and store that as a name, but for images and videos we will only be able to store content type (at best).

I'd say this is P3 – makes sense as a developer/debugging feature, but will not bring meaningful value for end users, unless we show "Recent CIDs" with ability to "Pin them" and users provides a mandatory label so it is not a CID.

lidel avatar May 16 '25 14:05 lidel