I propose we add support for ?uri= which would decode passed URI and return HTTP 301 redirect to proper /ipfs/ or /ipns/ path.
This is pretty trivial to add, but wanted to agree on ?url= (or other means) before I submit PR.
cc @autonome @gozala @aschmahmann @achingbrain
Now that Chromium 86 safelisted ipfs://,ipns:// and dweb: we should support requests produced by navigator.registerProtocolHandler on gateways.
Namely, if someone registers dweb.link as URI handler for ipfs://:
navigator.registerProtocolHandler('ipfs', 'https://dweb.link/?uri=%s', 'ipfs resolver')
Then opening ipfs://QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR Chromium will produce HTTP GET with URI-encoded URI:
https://dweb.link/?uri=ipfs%3A%2F%2FQmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
Using URL parameter ?uri= seems safer than /uri/%s because it does not clash with path-based logic already present in gateway code, but I am open for suggestions, if there is a better way to represent this.
Hi @lidel
I would like to make my first contribution. Do you think this issue is ready to be implemented?
I've already had look around the codebase and saw that prometheus has already registered a handler for the top level root / path - metrics.go:L91. Registering another handler for / would result in a panic. Now two ways forward come to my mind:
uri query parameterregisterProtocolHandler for every protocol (ipfs, ipns, etc.) we could use the URLs https://dweb.link/ipfs/?uri=%s and https://dweb.link/ipns/?uri=%s. Doing it this way would make it possible to implement the logic in gateway_handler.go which has already registered the paths /ipfs and /ipns.Let me know what you think.
Hi @dennis-tra, yes, its ok for you to take a stab at this!
I think the approach you proposed in (2) is sensible (fair point that ipfs:// and ipns:// will require separate registration anyway) – ping me when you have a PR :)
@lidel I just filed the PR #7802 it would be great if you could take a look :)
Most helpful comment
@lidel I just filed the PR #7802 it would be great if you could take a look :)