BobbyWibowo / lolisafe

Blazing fast file uploader and awesome bunker written in node! 🚀
MIT License
317 stars 56 forks source link

Users get their own folder #605

Closed flleeppyy closed 1 year ago

flleeppyy commented 1 year ago

I know you said no feature requests, but maybe it's a quality of life feature or something.

I'm running my own fork of lolisafe, and not a lot of people use it since it's private, and not having the filenames be the actual name of the uploaded file is a bit annoying, but even if i were to replace all the file names in the uploads folder to their respective names, there would be duplicates and ones that interfere with each other.

I was thinking about user folders, where each user has their own folder in the uploads folder, and it would enable files to have file names when being downloaded. The ones that have duplicate names could run a checksum over them, and if they're the same, just return the url to the file that's already on the server. And if the checksums dont match, just append "-1" (increments as there more variations of the file) to the file name.

BobbyWibowo commented 1 year ago

Unfortunately, that'll require quite a bit of under-the-hood refactoring to get that to work as expected Since the initial design philosophy, since the very beginning, is just to simply store them as random identifiers (pomf-like)

I personally do not have any need for that type of storage scheme, so sorry about that

Alternatively, you can consider serving files with node, and then enabling setContentDisposition in config file Files will still be stored as their random identifiers, but upon download, browsers will automatically prompt/save the files according to their original names (wget and such need to enable an option flag to instruct them to follow the Content-Disposition header)

Serving files with node won't be as blazing fast as using Nginx directly, but that should only be obvious on very heavy traffic