Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point relative paths to documents in ipfs directory #361

Closed
AlbertoElias opened this issue Jan 24, 2018 · 3 comments
Closed

Point relative paths to documents in ipfs directory #361

AlbertoElias opened this issue Jan 24, 2018 · 3 comments
Labels
kind/discussion Topical discussion; usually not changes to codebase

Comments

@AlbertoElias
Copy link

For IPFS websites that have relative links such as /about, it'd be great if the extension modified the links to http://mygateway/ipfs/hash/about.html. Currently, clicking that link takes you to http://mygateway/about.

@lidel lidel added kind/enhancement A net-new feature or improvement to an existing feature help wanted Seeking public contribution on this issue UX good first issue Good issue for new contributors labels Jan 24, 2018
@lidel
Copy link
Member

lidel commented Jan 24, 2018

I think this is quite doable: we already normalize links (href and src) that use custom protocols into HTTP ones[1].

In this case we would inject a similar content script, but only into every page under root of IPFS CID. It would normalize paths in DOM + observe every DOM change (so that it works even with dynamic pages).

[1] contentScripts/normalizeLinksWithUnhandledProtocols.js

@lidel lidel added this to the 2018-Q1 milestone Jan 24, 2018
@olizilla
Copy link
Member

olizilla commented Mar 8, 2018

I think it be surprising if we start rewriting valid, domain-relative links like /about.

It's super nice to be able to deploy an app to ipfs.io/QmHash/index.html and cool.website/index.html and have it all work under both root or an arbitrary mount path, but for that to work the author needs to build their site with location relative links.

If we rewrite them, then to the site author it will look like the site works correctly in both contexts, but it'll be broken for anyone not running the plugin.

It could be argued that lots of things will be published to ipfs with broken, root relative links, but I feel uneasy about companion papering over that issue.

@lidel lidel added kind/discussion Topical discussion; usually not changes to codebase and removed kind/enhancement A net-new feature or improvement to an existing feature good first issue Good issue for new contributors help wanted Seeking public contribution on this issue labels Mar 8, 2018
@lidel lidel removed this from the 2018-Q1 milestone Mar 8, 2018
@lidel
Copy link
Member

lidel commented Sep 22, 2018

I agree with Oli, we should not mutate paths used in attributes of DOM elements.
We now have public gateways that support cidv1b32-in-subdomain workaround (ipfs/in-web-browsers#89 (comment)), so I am closing this.

@lidel lidel closed this as completed Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/discussion Topical discussion; usually not changes to codebase
Projects
None yet
Development

No branches or pull requests

3 participants