Commit graph

21 commits

Author SHA1 Message Date
Damjan Georgievski
b139b6113a return error instead of expect()
expect() is an unwrap() with a message. use the ? macro to just return
the error from main for a cleaner output
2018-07-22 17:14:01 +02:00
Damjan Georgievski
bd1429ebb6 explain why these won't panic 2018-07-22 17:09:53 +02:00
Damjan Georgievski
9058452d93 set_current_dir: don't unwrap, return error
the difference is a panic vs a clean error
2018-07-22 07:25:07 +02:00
Damjan Georgievski
1a12b3aa30 canonicalized root directory is now also an App state
- used to setup the StaticFiles handler
- also for the .tar file handler

additionally, PathBuf::from_param is used to forbid certain paths, see:
https://actix.rs/api/actix-web/stable/actix_web/dev/trait.FromParam.html
2018-07-22 05:39:32 +02:00
Damjan Georgievski
8a86739f14 don't overwrite RUST_LOG if it exists 2018-07-22 03:53:39 +02:00
Damjan Georgievski
ac3627179f insignificant changes
still experimenting with *my* rust style
2018-07-21 20:22:40 +02:00
Damjan Georgievski
a3a95e66c3 also chdir to destination directory 2018-07-21 20:13:14 +02:00
Damjan Georgievski
9373a1cb9c upercase PORT in usage 2018-07-21 19:31:43 +02:00
Damjan Georgievski
e707d1a05e log shared directory 2018-07-21 19:12:59 +02:00
Damjan Georgievski
e400d6e1d3 implement cli arguments with clap
* add clap dependency https://docs.rs/clap/
* updated README with the real USAGE
* the web App now takes a directory to server files from
2018-07-21 17:45:24 +02:00
Damjan Georgievski
933b53b2b1 remove the println! since the logger already prints the listener 2018-07-21 15:14:01 +02:00
Damjan Georgievski
a6a3d707d6 implement a default logger
I've snuck some renames of variables too
2018-07-21 14:59:47 +02:00
Дамјан Георгиевски
c91c994c8c actix_web reexports actix
Re-export actix::prelude::* as actix_web::actix module.

So no need to explicitly import it or add it in Cargo.toml
2018-07-19 20:03:17 +02:00
Дамјан Георгиевски
fd46bfb55a refactor: split code in multiple files
… main.rs is now small enough to add cli args
2018-07-05 17:48:40 +02:00
Дамјан Георгиевски
b8f4607dba fancier dir list template 2018-07-05 10:55:22 +02:00
Дамјан Георгиевски
591587649c sort directories first, and then alphabetically by filename 2018-07-04 23:41:54 +02:00
Дамјан Георгиевски
a8fef98041 charset=utf-8 2018-07-04 23:31:02 +02:00
Дамјан Георгиевски
95adb78666 double quotes for html attribute values 2018-07-04 23:30:37 +02:00
Дамјан Георгиевски
46ffbeaa6e implement streaming of a folder as a tar 2018-07-04 23:14:05 +02:00
Дамјан Георгиевски
b5533e1428 implement custom directory listing 2018-07-04 23:13:32 +02:00
Дамјан Георгиевски
7845a4e3d7 first skeleton 2018-07-04 14:03:30 +02:00