Coder Social home page Coder Social logo

IPFS integration about beaker HOT 19 CLOSED

beakerbrowser avatar beakerbrowser commented on August 27, 2024 1
IPFS integration

from beaker.

Comments (19)

pfrazee avatar pfrazee commented on August 27, 2024 2

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

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

@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:

  • npm-go-ipfs ships prebuilt go-ipfs binaries, so devs should not need go installed to run beaker's build
  • When ipfs/js-ipfsd-ctl#78 closes, js-ipfsd-ctl will install the arch-appropriate ipfs binary on first execution. We'll need to hook into this and tell the user what's going on.
  • js-ipfs-api is how we'll interact with the go binary.

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

@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.

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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.

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

Two small updates on my last post...

  • I managed to get things mostly working without the standard scheme. Paths were resolving better than I expected. So, that may not be too hard to handle.
  • I was pointed to ipfs/kubo#1678. Reading it now.

from beaker.

davidar avatar davidar commented on August 27, 2024

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...

from beaker.

davidar avatar davidar commented on August 27, 2024

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.

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

@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?

from beaker.

nicola avatar nicola commented on August 27, 2024

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!

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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

from beaker.

daviddias avatar daviddias commented on August 27, 2024

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

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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

I can do Tuesday

from beaker.

nicola avatar nicola commented on August 27, 2024

I can do tuesday too

from beaker.

daviddias avatar daviddias commented on August 27, 2024

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

9am PDT, 5pm WEST, 6pm UTC

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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

On Tue, Jun 21, 2016 at 5:54 AM, David Dias [email protected]
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
.

from beaker.

daviddias avatar daviddias commented on August 27, 2024

Sent a cal invite with a Hangout URL :)

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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

from beaker.

Powersource avatar Powersource commented on August 27, 2024

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

from beaker.

pfrazee avatar pfrazee commented on August 27, 2024

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

from beaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.