ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

FlyWeb #599

Closed runvnc closed 1 year ago

runvnc commented 7 years ago

Hello, would something like FlyWeb and js-ipfs make it possible to create a local-ipfs-gateway-in-a-web-page? Or a more general question, does this project or another like it address this issue: it seems that requiring the user to install a local server blocks most potential users and gateways defeat the main purpose by routing all traffic through specific traditional servers. (Or can the core problem of IPFS deployment be solved by socially engineering advocates within key groups like browser and operating systems teams.)

Thanks for giving my question a chance and thanks for your time.

victorb commented 7 years ago

local-ipfs-gateway-in-a-web-page

Not sure what the use case is here, to run a IPFS gateway in a web page? Not sure why you would like to do that, since you can just fetch the objects directly with js-ipfs in the page, instead of having a gateway.

I don't think I'm understanding your question good enough to give a proper answer.

runvnc commented 7 years ago

I thought I described it in enough detail. Either I don't understand IPFS/js-ipfs or I was just wasting my time anyway. Whatever.

daviddias commented 7 years ago

Hey @runvnc, what @VictorBjelkholm was bringing up is that running an IPFS gateway, also known as the HTTP-API that gets exposed when an IPFS daemon is running, is not possible since you can't have a spawn an http server inside the browser.

What you can do directly, is use js-ipfs as a "gateway" to the entire IPFS network, because js-ipfs is a full IPFS node :)

runvnc commented 7 years ago

FlyWeb is an HTTP server in Firefox. If it were used to make a gateway then other IPFS sites that don't know about js-ipfs would be accessible.

jbenet commented 7 years ago

@runvnc yeah this use case is a good idea, and i've discussed it with some as Mozilla worked on, and released FlyWeb. Yes, we should be able to make an ipfs http gateway with it, to interact with non-ipfs devices locally. Expanding your questions, i think you're asking:

Assuming that,

  • Does the js-ipfs implementation include the http-to-ipfs gateway that go-ipfs has?

I believe not yet? But i think @diasdavid plans for it to be there eventually. @diasdavid thoughts? There's a listing of "commands implemented in js-ipfs to reach go-ipfs parity" somewhere, thought in the readme of this repo, but i can't find it right now.

The point though is to port this part of go-ipfs: https://github.com/ipfs/go-ipfs/tree/master/core/corehttp which is being extracted to https://github.com/ipfs/go-ipfs-gateway soon. (i think @lgierth is up to that)

If you want to try something mad-sciency, can ask @lgierth and @whyrusleeping if the go-ipfs http-to-ipfs gateway is independent enough to try something like a gopherjs-ed thing on top of js-ipfs. I recently have been very impressed by gopherjs -- even if its payloads happen to include the entire go runtime >.<

  • If so, where can i find an example of its usage?

Not yet there, i think.

  • And, have you tried using it with FlyWeb, to expose IPFS content with a local gateway? That's what I'm aiming for.

Yes, i really want this, and want to support this use case. How serious are you about pursuing this? this is something i'd be willing to throw resources into in the near term. (considering putting a bounty on it)

jbenet commented 7 years ago

I think this is worth reopening, until we have a plan of action.

runvnc commented 7 years ago

@jbenet thanks, was starting to think I was crazy. Unfortunately I don't think I have the time right now because of other obligations. I mainly wanted to mention the idea because I saw FlyWeb and wondered if it could help with distributed computing in some way.

It seems like any dev who is interested in FlyWeb and not too busy would quite possibly be excited about this use case, especially if there was a bounty.

So I know that questions don't actually solve problems but can't help but ask one more. Does anyone know if/when Chrome people will start on something like FlyWeb?

daviddias commented 7 years ago

I believe not yet? But i think @diasdavid plans for it to be there eventually. @diasdavid thoughts? There's a listing of "commands implemented in js-ipfs to reach go-ipfs parity" somewhere, thought in the readme of this repo, but i can't find it right now.

We do support the HTTP-API, which enables us to tests like benchmarks and sharding from go-ipfs. I believe the list you are looking for is this one: https://github.com/ipfs/js-ipfs/blob/master/ROADMAP.md#project-status

You can even use js-ipfs-api to contact js-ipfs through its http-api implementation :)

harshjv commented 7 years ago

@diasdavid So, is it possible to start HTTP gateway using API for js-ipfs node created through API in node.js?

daviddias commented 7 years ago

@harshjv absolutely, see my comment in your other issue: https://github.com/ipfs/js-ipfs/issues/693

ghost commented 7 years ago

I've brought up FlyWeb again, but for local peer discovery: https://github.com/ipfs/in-web-browsers/issues/45

daviddias commented 7 years ago

Pinging the FlyWeb team @kannanvijayan, @justindarc and @sicking.

Hi FlyWeb team o/, my apologies for spamming directly your Github notifications inbox. We would like to develop a PoC of js-ipfs in the browser using FlyWeb's service discovery API.

Currently, js-ipfs works in the browser, both Chrome and Firefox and we also have an HTTP API and client libraries that developers are familiar, we could expose a http transport for js-ipfs through FlyWeb or use it to find the node in some other tab.

What's the current state of FlyWeb and its current dev roadmap? When can we expect to see it on a regular release of Firefox?

Thanks in advance!

daviddias commented 6 years ago

@lgierth @VictorBjelkholm could you please document in this issue your recent experiments? Thank you :)

victorb commented 6 years ago

There is now a experimental effort from mozilla to support many of our wanted APIs, mdns is one of them! Issue is here: https://github.com/mozilla/libdweb/issues/7

daviddias commented 5 years ago

@alanshaw @lidel can you post here all the demos and talks on libdweb so far to this thread?

lidel commented 5 years ago

libdweb: mDNS Local Discovery and TCP Transport

FlyWeb core is reused by libdweb for TCP Socket API. Discovery and transport poc using this API was created by @alanshaw in https://github.com/ipfs-shipyard/ipfs-companion/pull/553:

Video demo: libdweb MDNS discovery for JS IPFS running in a web extension https://www.youtube.com/watch?v=FRzyWUXIyeo screenshot_9

libdweb: Streaming Protocol Handler

Protocol Handler API poc implementation of ipfs:// and ipns:// is in https://github.com/ipfs-shipyard/ipfs-companion/pull/533 (AFAIK not related to FlyWeb, but mentioning here for completeness)

Video demo: Protocol Handler Demo with libdweb and Firefox Nightly https://www.youtube.com/watch?v=fS8pLOQdOoM Lab Day 2018 // Protocol Handler Demo with libdweb and Firefox Nightly

SgtPooki commented 1 year ago

FYI that helia-service-worker-gateway did "local-ipfs-gateway-in-a-web-page" via a service-worker, and though the code is somewhat rough around the edges, it proves everyone could essentially all run their own in-app gateways without having to rely on centralized gateways.

The more WebTransport gets supported, and the more nodes in the IPFS network update to support WebTransport, the better this will get.

whizzzkid commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments before 2023-06-05. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).