ipfs-shipyard / ipfs-share-files

Share files via IPFS
https://share.ipfs.io
MIT License
149 stars 31 forks source link

Add uploads to MFS when external IPFS API is used #24

Closed lidel closed 6 years ago

lidel commented 6 years ago

As noted in Design: Pinning Content we are moving away from using low level pins and instead we keep data around by adding references to MFS.

First part is already done in this app, it does not pin uploaded content:

https://github.com/ipfs-shipyard/ipfs-share-files/blob/3d8c417ffc0c2ababd771e1277afbecd851e1a55/src/bundles/files.js#L204

What is missing is adding content to MFS.

Of course we don't want to do that when fallback to browserified js-ipfs is used, but if external IPFS API is accessed over HTTP API or window.ipfs there should be an additional step of adding wrapping directory to MFS.

We should put the time of upload in the name of root directory to make it possible to display uploads in lexical order (this enables user to cleanup old uploads or easily find the latest one)

Maybe something like /shared/YYYY-MM-YY_HH-MM-SS? It does not pollute the MFS root and is self-explanatory.

cc @ipfs-shipyard/gui https://github.com/ipfs-shipyard/ipfs-companion/issues/415

fsdiogo commented 6 years ago

I don't see the point of using the MFS for this app, at least in its first stages 🤔

For now this app is oriented for just one flow:

  1. You add files to IPFS
  2. Share the link
  3. Done

When you get back to the app is to start the flow all over again, instead of modifying the state of what you previously added (you can't even do that right now).

lidel commented 6 years ago

I think you are right. It is better to keep this as an explicit user action. WebUI now has option to "Add from IPFS Path" so it should be enough for first iteration.

I am closing this, we may revisit this when integration between webui and share app begins.