BusterLabs / Partyshare

A free, open source file sharing application, built on the peer-to-peer hypermedia protocol IPFS.
https://busterlabs.github.io/Partyshare
MIT License
158 stars 26 forks source link

Don't expose the root directory tree #29

Closed bhstahl closed 7 years ago

bhstahl commented 7 years ago

Rather than recursively adding the entire folder, exposing the hash for the root of every file, each file (especially all files in each sub folder) should be added individually, so you cannot navigate to the root hash and see the list of files.

From #23

matthewrobertbell commented 7 years ago

IMO, viewing the contents of a subfolder is a feature (being able to browse related files that have been consciously shared together), whereas being able to view the root folder is not.

As I mentioned in #23, I think hiding subfolders or files in the root folder in their own "virtual directory" would solve this. Here's how it could be done on the command line.

➜ ~ echo "Hello" > hello.txt ➜ ~ mkdir hello_example_folder ➜ ~ mv hello.txt hello_example_folder ➜ ~ ipfs add -r hello_example_folder added QmY9cxiHqTFoWamkQVkpmmqzBrY3hCBEL2XNu3NtX74Fuu hello_example_folder/hello.txt added QmbK12JY5ouWwGba4UVibqiKCWq22bRSoZyDaR7mXMUBWz hello_example_folder

You can then view it like this on an IPFS gateway:

screenshot 2017-05-30 07 45 11

as well as being able to link directly to the file.

I believe this can be done using the IPFS API without actually creating a folder on the filesystem, or moving the file.

bhstahl commented 7 years ago

Agreed @mattseh I saw subfolder browsing as a feature as well but didn't consider that the root would feel like an invasion of privacy. I do agree now that you mention it though. I'll give these rules a shot:

matthewrobertbell commented 7 years ago

Will a subfolder of the root folder be added inside a virtual folder? I think it should be, so then there is no listing of the root folder at all.

On 31 May 2017, at 12:10, Ben Stahl notifications@github.com wrote:

Agreed @mattseh I saw subfolder browsing as a feature as well but didn't consider that the root would feel like an invasion of privacy. I do agree now that you mention it though. I'll give these rules a shot:

Root files added by themselves in a virtual folder for file names Subfolders added recursively to allow browsing — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

bhstahl commented 7 years ago

Yeah, I like that. Anything at the root is private, including folders, but whole folders can still be shared.

Fil commented 7 years ago

Great! This was preventing me from doing more than tests.

However it seems we can't share a folder from the root, and it makes the UX a bit inconsistent.

this is my tree:

Partyshare/
├── cox-2.png
├── seenthis
│   ├── 2017-05
│   │   └── partyshare.gif
…
└── visionscarto
    └── projections
        ├── cox-1.png
…

I can share cox-2.png file from the root folder, but not seenthis or visionscarto. (The seenthis/2017-05/ subfolder is shareable.)

Fil commented 7 years ago

OOps now I understand.

=> the URL given for a file is its "main subfolder"'s URL + path within that subfolder: QmckjuZUrzudf5iwghpiHFWJVQeVVsVcGftjV4Aq6qK8tZ + /projections/lee-1.png

Intuitively I thought this would be something else (which seems way simpler and consistent): if I share a file, I get $HASH/filename.png ; and if I share a directory, $HASH/dirname/.

This way sharing a file would never expose anything else than the file itself, and sharing a folder (any folder within the root folder and its subfolders) would expose all the files contained in that folder, and only those.

matthewrobertbell commented 7 years ago

I just played with this and it looks like how I suggested, thanks :)

bhstahl commented 7 years ago

Great @mattseh!

@Fil, I'm going to think a bit further about subfolders + subfolder-of-subfolders and come up with an ideal solution. Hearing your use cases is super helpful though!