Commit graph

34 commits

Author SHA1 Message Date
Дамјан Георгиевски
84599e5d82 cargo fmt 2022-03-01 14:40:41 +01:00
Дамјан Георгиевски
24ee4f3f09
Actix v4 (#11)
Updated to:
* actix-web 4.0.0
* actix-files 0.6.0
* clap 3.1.0
* rust edition 2021
2022-03-01 14:33:21 +01:00
Дамјан Георгиевски
a671e47edf rename to src/directory_listing.rs 2020-09-20 00:53:31 +02:00
Дамјан Георгиевски
98fbec274c enable the .tar handler 2020-09-14 23:44:00 +02:00
Дамјан Георгиевски
cce8560bd5 Begin port to actix-web 3.0
* actix-files is quite easy to use now
* uses futures 0.3 now, and async/await. the streaming archiver is not
  ported yet.

0.11.x versions will be dev versions until the port is done
2020-09-12 04:28:20 +02:00
Дамјан Георгиевски
da69d3de6f clippy and rustfmt anoyances 2019-09-21 21:24:44 +02:00
Дамјан Георгиевски
c68cf3a3e8 improve cli help text
and add a `-w` as short for `--chdir`
2019-09-21 21:24:41 +02:00
Дамјан Георгиевски
9c6ff4eddf rename channel to threaded_archiver
I think that reflects its purpose much better
2019-09-21 21:17:39 +02:00
Дамјан Георгиевски
85f1df81a1 refactor with actix-web 1.0.0
* actix-web 1.0.0 brought some changes in how associated data is accessed, and how
handlers are written.
* static files are now a separate crate `actix-files`.
* web::run now creates the App and the Server and runs the server. they really want to
  have HttpServer::new and App::new in the same scope
  (I couldn't find a proper signature for the create_app function)
* replace .trim_right_matches (depreceated in rust 1.33) with .trim_end_matches

https://github.com/actix/actix-web/blob/web-v1.0.0/MIGRATION.md
2019-06-16 17:27:09 +02:00
Damjan Georgievski
cba32451b3 some more "edition 2018" updates
`extern crate` and `#[macro_use]` are no longer needed
2019-01-18 00:24:42 +01:00
Damjan Georgievski
0596f72c8d rust 1.32 now defaults to the system allocator
https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html#jemalloc-is-removed-by-default
2019-01-18 00:14:16 +01:00
Дамјан Георгиевски
2742a39aaa update for a change after actix-web 0.7.8
somewhere between 0.7.8 and 0.7.12 `web::create_app` started returning a
`Result`.
2018-10-20 15:04:13 +02:00
Дамјан Георгиевски
7a0572de80 use system alocator instead of jmalloc
Rust 1.28 feature. saves 300kb in executable size
2018-08-03 15:41:00 +02:00
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