A simple file server to learn rust and warp.
Note: This is a learner's project and is not remotely usable.
This can probably be implemented in a simpler way using warp::fs::dir
, but where's the fun in that.
- Required: Edit the
BASE_FOLDER
inhandlers.rs
to point to the folder you want to serve. (I know this is suboptimal). - Change the IP (say from 0.0.0.0 to 127.0.0.1) and Port (say 3030 to 8080) per your needs. (Again, suboptimal and should ideally be read from a config file)
- Run
cargo run
- Experimental in-progress UI can be accessed by running
pnpm dev
ornpm dev
insapper
folder (Backend must be on localhost:3030) - Even more experimental and in-progress UI can be accessed by running
pnpm dev
ornpm dev
insveltekit
folder (Backend must be on localhost:3030)
- Stable webUI can be accessed at http://IP_IN_RUST:PORT_IN_RUST/web/ls
- Experimental UIs can be accessed at http://IP_IN_SAPPER:PORT_IN_SAPPER/files
- Fetch the list of directories at
my/dir
->GET http://IP:PORT/api/ls?path=my%2Fdir
- Download the file at
my/dir/file.ext
->GET http://IP:PORT/api/download?path=my%2Fdir%2Ffile.ext
- Delete the file/folder at
my/dir/rec
->GET http://IP:PORT/api/rm?path=my%2Fdir%2Frec
- File and path sanitization to prevent directory attacks.
- View and traverse folders
- Download files
- Create folders
- Delete folders and files
- Upload files (tested with file size of ~ 12GB on localhost)
- Multi tenant and auth
- Rename dir / file
- Move file / dir
- Code Cleanup, Import Optimization
- Logging
- warp, hyper, tokio for the basic web server / concurrency stuff.
- sailfish for web templating.
- svelte / sapper for experimental UIs.
- Other helper libs.
- miniserve for parts of code mainly HTML / CSS / JS