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

feat: load Web UI from IPFS #680

Merged
merged 1 commit into from
Feb 14, 2019
Merged

feat: load Web UI from IPFS #680

merged 1 commit into from
Feb 14, 2019

Conversation

lidel
Copy link
Member

@lidel lidel commented Feb 14, 2019

This is a prerequisite for #679, so I am merging in fast-track mode to create a new release and fix #679 ASAP. cc ipfs/ipfs-webui#959
Feel free to comment – will address any concerns in separate PRs.

Before, webui was bundled with extension itself. Unfortunately this
caused issues with reviews at addon (webui build was not reproducible).

This PR replaces bundled webui with one loaded from custom gateway.

  • To make it work we modify HTTP headers to make cross-origin requests
    from 'blessed' webuiRootUrl work without changing default go-ipfs configuration.
  • To improve UX, content script sets ipfsApi in webui's localStorage
    to the same endpoint as one defined in Companion (unless it was already
    customized by the user).
    • Switched programmatic content script injections from browser.tabs.onUpdated to browser.webNavigation.onDOMContentLoaded it executes only once and in case of linkify experiment DOM updates are handled via MutationObserver anyway
  • Sadly Web UI for js-ipfs had to be disabled for now (it may come back thanks to lunet experiment from The Future of "accessing API of remote IPFS node" in-web-browsers#137)

Digressions / notes to self:

  • The amount of differences in HTTP header and CORS handling between Firefox and Chrome in WebExtension context is baffling :'(
    • Example: Chrome requires additional handling of values in preflight request, namely value from Access-Control-Request-Headers needs to be manually restored in Access-Control-Allow-Headers (Firefox allowed whitelisting cross-origin webui access without this step)
    • Fun fact: Chrome 72 removed access to arbitrary headers from webRequest. If one wants to peek at Referer header, they need to add extraHeaders to listener's constructor. This works only in Chrome – Firefox breaks, so now one needs to provide a different arguments to browser.webRequest.onBeforeSendHeaders.addListener depending on which browser is the runtime

Before, webui was bundled with extension itself. Unfortunately this
caused issues with reviews at addon (webui build was not reproducible).

This change replaces bundled webui with one loaded from custom gateway.
To make it work we modify HTTP headers to make cross-origin requests
from 'blessed' webuiRootUrl work without changing default go-ipfs configuration.

To improve UX, content script sets `ipfsApi` in webui's `localStorage`
to the same endpoint as one defined in Companion (unless it was already
customized by the user).
@ghost ghost assigned lidel Feb 14, 2019
@ghost ghost added the status/in-progress In progress label Feb 14, 2019
@lidel lidel merged commit a98e563 into master Feb 14, 2019
@ghost ghost removed the status/in-progress In progress label Feb 14, 2019
@lidel lidel deleted the fix/remote-wbeui branch February 14, 2019 23:43
This was referenced Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restore presence on AMO
1 participant