ipfs / ipfs-companion

Browser extension that simplifies access to IPFS resources on the web
https://docs.ipfs.tech/install/ipfs-companion/
Creative Commons Zero v1.0 Universal
2.07k stars 324 forks source link

Revisit how Companion does preload at public gateways #546

Open lidel opened 6 years ago

lidel commented 6 years ago

Background

Right now Companion preloads uploaded content via HTTP HEAD requests to a public gateway. Public gateway can be customized by the user, and there is an option on Preferences screen to disable preload.

The js-ipfs and infra teams are working on a solution that will fix discoverability and restore "realtime feel" in browser contexts: https://github.com/ipfs/js-ipfs/issues/1459. In short there will be a set of "official" preload gateways that will be used for every write operation made by js-ipfs when running in web browser.

UPDATE: recursive preloads are now possible with:

https://node0.preload.ipfs.io/api/v0/refs?arg={CID}&r=true
https://node1.preload.ipfs.io/api/v0/refs?arg={CID}&r=true

TODO

Update preloadAtPublicGateway and in addition to existing HTTP HEAD request to user-specified public gateway, do additional asynchronous recursive preload via HTTP GET request to one of preload nodes. In case of "quick-upload" screen, the CID should be of the wrapping directory.

Open Questions

Given discussion in https://github.com/ipfs/js-ipfs/issues/1459, questions arise:

alanshaw commented 6 years ago

FYI the HEAD request won't preload a file if it is bigger than max chunk size (unless you traverse the tree that's created and send a request for EVERY node that's created, as well as all it's children). This is why js-ipfs uses the refs API.