Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

IPFS integration #2

Closed
2 tasks
daviddias opened this issue Jun 10, 2016 · 19 comments
Closed
2 tasks

IPFS integration #2

daviddias opened this issue Jun 10, 2016 · 19 comments

Comments

@daviddias
Copy link

Hi @pfraze, it was great to chat at the #DWebSummit and getting to know about beaker.

Opening this issue so that we can continue our convo about IPFS integration and also invite other people in the community that might want to participate :)

Since beaker is an electron app, we can integrate either go-ipfs or js-ipfs, which in the short term, will give beaker's IPFS integration different properties, namely:

  • Peer Routing + Content Routing (DHT) with go-ipfs
  • WebRTC with js-ipfs.

Either way, we are standardizing the js-ipfs-api (HTTP-API client library) and js-ipfs core APi to expose the same calls, so that devs don't have to change any code when using a remote daemon or a in process daemon.

I still need to look into beaker code to get familiar with it, but meanwhile if you can give some lights on the integration should be done, it would be great.

Meanwhile, here is a short list of things that we will be doing in our side:

@pfrazee
Copy link
Member

pfrazee commented Jun 10, 2016

@diasdavid great, thanks for opening this issue.

This document explains the repo. I think the background process is the right place to integrate the transport protocols, so that data can persist across navigations, and so we're not confined to WebRTC. So, go-ipfs seems like the right call.

Most of my dat integration's structure should be copyable for IPFS. There may be ways to reuse code btwn the protocol integrations, which will also pay off when we integrate webtorrent. No need to focus on that yet, though; let's just make it work, first.

After we have an ipfs:// and view-ipfs:// protocol, we can look into injecting the IPFS API into web pages.

Some info for reference:

@pfrazee
Copy link
Member

pfrazee commented Jun 11, 2016

@diasdavid @jbenet this is what I have in mind for integration right now. I shared it with the dat guys and they think it's doable on their end. I'm interested if you have technical or design issues to raise.

@pfrazee
Copy link
Member

pfrazee commented Jun 12, 2016

I've hit an issue that'll need some thought.

Chromium (and thus Electron) have a concept of "standard" URLs. You can read about them here.

To make electron's webviews handle paths correctly (in links, in imgs, etc) we want Electron to treat the folder hash as the domain. Then, paths like /icon.png will resolve as expected:

in ipfs://QmTqDSxMH6xsKabqhBSeBVu89UmbF2Z1CbN4k4tT6Zhy8R/, it'll resolve to...
ipfs://QmTqDSxMH6xsKabqhBSeBVu89UmbF2Z1CbN4k4tT6Zhy8R/icon.png

Here's the problem: the domain in standard URIs are case-insensitive. Once a protocol is registered as standard, chromium automatically runs toLowerCase on the domain. In base58/64, this destroys information.

I've committed a basic integration. If you serve an index.html via ipfs, then remove 'ipfs' from this line, you can open the file via ipfs://{root-hash-that-includes-the-index.html}. But, if you readd 'ipfs' to the standard protocol registrations, you'll see the url bar automatically toLowerCase(), and the GET will fail.

Two possible solutions:

  1. Only use hex-encoded IPFS urls. This may not be super feasible, since the rest of the ecosystem is in base52+.
  2. Dont use chromium's standard-url protocols. This may work, but it won't be super easy. Maybe we can make the webviews work, as expected, through some combination of JS injected into the client, and request interception.

We might raise issues with electron, but that's an unlikely solution as well.

@pfrazee
Copy link
Member

pfrazee commented Jun 13, 2016

Two small updates on my last post...

@pfrazee
Copy link
Member

pfrazee commented Jun 13, 2016

screen shot 2016-06-12 at 7 08 34 pm

@davidar
Copy link

davidar commented Jun 13, 2016

I was pointed to ipfs/kubo#1678. Reading it now.

@pfraze Long story short:

  • use /ipfs/Qm... wherever possible
  • if you have to use a URI, use fs:/ipfs/Qm...

@davidar
Copy link

davidar commented Jun 13, 2016

To make electron's webviews handle paths correctly (in links, in imgs, etc) we want Electron to treat the folder hash as the domain. Then, paths like /icon.png will resolve as expected

Absolute paths like /icon.png are strongly discouraged on IPFS, as they break on the HTTP gateway (and violate nesting properties). Therefore it's generally safe to assume that websites on IPFS only use relative links, with the exception of absolute /ipfs/Qm... links.

Edit: I'd actually go further than that and say that paths like /icon.png shouldn't resolve for IPFS sites, as you'd end up with webpages that work in beaker but break elsewhere.

@pfrazee
Copy link
Member

pfrazee commented Jun 17, 2016

@diasdavid hey, I'd like to do a call with the IPFS team, to hear about the vision for IPFS browser. Do you think we could schedule one?

@nicola
Copy link

nicola commented Jun 17, 2016

hey @pfraze I am really interested. A couple of weeks ago I attempted to make an ipfs-specific browser (specific to ipfs in every sense - even its components were on IPFS and makes it easier to be self-publish), I am happy to discuss design choices, I really love the approach in combining all the decentralized projects!

great work!

@pfrazee
Copy link
Member

pfrazee commented Jun 17, 2016

@nicola right on, ping me on IRC sometime and we can chat

@daviddias
Copy link
Author

daviddias commented Jun 18, 2016

Can we do it Tuesday, 9am PDT, 6pm UTC? @pfraze @nicola @jbenet

@pfrazee
Copy link
Member

pfrazee commented Jun 19, 2016

Are those times ==? I think they may be off by an hour.

I can do Tuesday

@nicola
Copy link

nicola commented Jun 19, 2016

I can do tuesday too

@daviddias
Copy link
Author

@pfraze you are right, fixed. Looking forward to chat today :)

9am PDT, 5pm WEST, 6pm UTC

@pfrazee
Copy link
Member

pfrazee commented Jun 21, 2016

Same. How should we get in touch? Google hangout?

On Tue, Jun 21, 2016 at 5:54 AM, David Dias notifications@github.com
wrote:

@pfraze https://github.com/pfraze you are right, fixed. Looking forward
to chat today :)

9am PDT, 5pm WEST, 6pm UTC


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ABNhUyYymaenLuLrDdrIC4sSuk3N0n_Vks5qN8LqgaJpZM4IzLJz
.

@daviddias
Copy link
Author

Sent a cal invite with a Hangout URL :)

@pfrazee
Copy link
Member

pfrazee commented Aug 11, 2016

Now basically working. The code has been moved into https://github.com/pfrazee/beaker-plugin-ipfs. Give it a shot!

@Powersource
Copy link

@pfrazee that repo link is dead now. What's the status of this a year later?

@pfrazee
Copy link
Member

pfrazee commented Nov 24, 2017

Hey @Powersource, see my comment here #480 (comment)

pfrazee pushed a commit that referenced this issue Nov 5, 2018
…l-pfrazee-changes

Updates to the favicon drawing tool
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants