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: leverage IPFS node provided by Brave #956

Merged
merged 3 commits into from
Jan 7, 2021
Merged

feat: leverage IPFS node provided by Brave #956

merged 3 commits into from
Jan 7, 2021

Conversation

lidel
Copy link
Member

@lidel lidel commented Jan 5, 2021

This PR adds support for IPFS node provided by Brave Nightly (brave/brave-browser#10220) and closes #947

Important!

ipfs/ipfs-docs#581 needs merging once this work is completed so docs are up to date.

TLDR

  • detects chrome.ipfs APIs and adds "Provided by Brave" node type in Preferences
  • ensures correct ports are used, even if user manually changes the config of Brave's node
  • trigger "Enable IPFS" flow if user did not choose how to resolve ipfs:// yet
  • wait for Brave to download and install binary (if missing)
  • this PR does not remove js-ipfs+chrome.sockets node type yet (but we update UI to indicate it is deprecated)

Onboarding flow (IPFS already enabled in Brave)

When Companion is installed, user is presented with Welcome screen that has "Brave user" section at the very top:

onboarding-2021-01-04--14-02-49

Clicking on "Open Preferences" lets user to choose backend. In brave, "Provided by Brave" is added to the list:

2021-01-04--14-03-22

Onboarding flow (IPFS not enabled yet)

The very first time (on an empty profile) is the same as before, but when "Provided by Brave" is selected Companion checks if Brave user selected how to resolve IPFS resources.
If they did not make the choice yet (resolve method being ask) we open ipfs:// URI in a new tab to trigger the decision via dropbar UI:

2021-01-05--14-04-56

Companion needs user to click "Enable IPFS" – it will download go-ipfs binary and set local node as the default resolver of ipfs:// and ipns:// URIs.

For now, the triggers is just an image, but a dedicated HTML page with some text asking user to click "Enable IPFS" would be better, as downloading go-ipfs binary may take time and user won't see any visual feedback for a while.

Given available APIs, our extension is able to update the tab to indicate a different activation stage and provide some visual feedback:

  1. Asking user to click on "Enable IPFS" button (User action needed)
  2. Waiting for go-ipfs binary download
  3. Waiting for ipfs init
  4. Waiting for ipfs daemon to start

@jessicaschilling I think a simple static page(s) similar to #911 would do – are you able to come up with user-friendly text/prompt for the activation steps? First one is the most important, remaining ones are just progress updates.

@lidel lidel requested a review from jessicaschilling January 5, 2021 13:21
@jessicaschilling
Copy link
Contributor

Note: We'll also need to update https://docs.ipfs.io/how-to/companion-node-types accordingly.

@jessicaschilling
Copy link
Contributor

@lidel Sending you a page under separate cover, since I assume we want to just put this on a gateway eventually. Let me know.

@jessicaschilling
Copy link
Contributor

@lidel -- I've added ipfs/ipfs-docs#581 for docs changes. Can you please make any edits you'd like, and merge when the rest of this work is complete? Thank you!

Copy link
Contributor

@jessicaschilling jessicaschilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some text changes - I haven't built and inspected in detail, so please LMK if you'd like.

This replaces ipfs:// URI used for triggering activation dropbar with
a page that can be updated by Companion to reflect the stage of
activation.

The page was created by Jessica:
#956 (comment)
@lidel
Copy link
Member Author

lidel commented Jan 6, 2021

@jessicaschilling Thanks! I replaced activation trigger to use your onboarding page + trimmed one label (because its displayed only in Brave).
I'm going to ship this to Beta, so we can have more eyes on this.

@lidel lidel modified the milestones: v2.16, v2.17 Jan 7, 2021
@lidel lidel merged commit b5cddcf into master Jan 7, 2021
@lidel lidel deleted the feat/brave-node branch January 7, 2021 12:36
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.

Detect and manage embedded go-ipfs in Brave
2 participants