ipfs / service-worker-gateway

[WIP EXPERIMENT] IPFS Gateway implemented in Service Worker
https://inbrowser.dev
Other
17 stars 8 forks source link

URI router for registerProtocolHandler #214

Open lidel opened 2 months ago

lidel commented 2 months ago

Down the road we will need ?uri router from subdomain specs. It is similar to ?helia-sw we already have, but accepts percent-encoded URIs as value, and can be registered via registerProtocolHandler:

navigator.registerProtocolHandler('ipfs', 'https://inbrowser.link/ipfs/?uri=%s', 'IPFS resolver')

Implementing URI router will allow us to use inbrowser.link as drop-in replacement for dweb.link in ipfs-companion and also use it in discussions with standards bodies and browser vendors on the path towards https://github.com/ipfs/in-web-browsers/issues/212 (redirect-based handler is step 1, sw-based one wis step 2. if we can show we have sw ready, and also provide a way of using it with step 1, this makes conversations more conductive).

Ref.

SgtPooki commented 2 months ago

I believe this is a part of specs.ipfs.tech and should live in verified-fetch, yes?

lidel commented 1 month ago

This is specific to subdomain gateway, so does not benefit users who use veirfied-fetch directly, but yes, implementation-wise, it would be the easiest if it lived in verified-fetch and returned HTTP 301: