ipfs-share-files
ipfs-share-files copied to clipboard
Make share a Web Share Target
Adds to the existing PWA functionality by allowing page to be listed in the share sheet on Android, ChromeOS and more OS are interested and heading this direction.
https://web.dev/web-share-target/
@rafaelramalho19 can you please take this one when you are done with translation?
Quick thoughts:
- This will be difficult to pull off without having a regular HTTP backend:
- The API is designed around
- :yellow_heart: HTTP GET for sharing smaller data types (text, links)
- We could explore accepting smaller data types and pass it via
#share:{data}
. Success depends on the type of shared data:- :green_heart: TEXT – should be easy, just add it to IPFS as
note-{timestamp}.txt
or something - :yellow_heart: CID or IPFS PATH or URL to public gateway – easy-ish. Add it to the list of shared items + trigger preload on public gateway.
- :broken_heart: URL – it could trigger download of data behind it via
fetch
, read bytes from fetched body (if possible due to CORS etc) and import to IPFS on the fly- CORS is the main problem, it's very difficult to get it to work everywhere. For a prior art example, Twitter on Firefox won't allow our JS to read the payload (https://github.com/ipfs-shipyard/ipfs-companion/issues/227), we may have a similar type of problem with regular JS not running in privileged extension, being limited by fetch and CORS (lack of access to the body). This means we need to do additional analysis if this approach is even feasible, my guess is that is not.
- :green_heart: TEXT – should be easy, just add it to IPFS as
- We could explore accepting smaller data types and pass it via
- :broken_heart: HTTP POST for file upload
- share.ipfs.io is a static app that takes CID via
#fragment
, we don't havePOST /api/v0/add
exposed anywhere - we could consider running a writable gateway or something, but that's way out of scope for a hack week
- share.ipfs.io is a static app that takes CID via
- :yellow_heart: HTTP GET for sharing smaller data types (text, links)
- The API is designed around
TLDR worth exploring, but requires more analysis and time than we have this week, I advise against shipping suboptimal experience too fast.
Before we go into this rabbit home, we should add basic PWA manifest, so people can install share.ipfs.io as an icon on their phone. I created https://github.com/ipfs-shipyard/ipfs-share-files/issues/108 for tracking PWA support.
Makes sense. @rafaelramalho19 if you're able to work on #108 instead, that would be good.
@lidel correct me if I'm wrong, but we can actually upload files in the webapp. Read https://web.dev/web-share-target/#processing-post-shares
@rafaelramalho19 that is possible only if user runs local IPFS node (eg. IPFS Desktop) that exposes http://localhost:5001/api/v0/add (
POST` endpoint)
Mobile users won't have that, and share.ipfs.io will use js-ipfs node embedded on the page itself, so they won't have localhost endpoint.
Couldn't allow this on my phone (Android Samsung S8) 😢
Going to move this out of the hack week to-do list since we merged https://github.com/ipfs-shipyard/ipfs-share-files/issues/108, but community contributions on this are more than welcome! 🙏 Please comment in this issue with any questions, or to let us know when you get started. Thanks!