Commit graph

26 commits

Author SHA1 Message Date
Дамјан Георгиевски
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
Дамјан Георгиевски
9c6ff4eddf rename channel to threaded_archiver
I think that reflects its purpose much better
2019-09-21 21:17:39 +02:00
Дамјан Георгиевски
6fbe1b22ea update percent-encoding and htmlescape
* percent-encoding 1.0 to 2.0
* actualy move from htmlescape to v_htmlescape

code updated for some api changes too
2019-08-28 19:44:22 +02:00
Дамјан Георгиевски
acedfa2a6c remove some actix_web:: prefixes 2019-06-16 18:03:26 +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
Дамјан Георгиевски
09cba55dc8 use rust language edition 2018 (introduced in 1.31) 2018-12-06 20:08:26 +01:00
Дамјан Георгиевски
4346b5d559 since actix-web 0.7.2 this is the default log format 2018-07-26 18:53:04 +02:00
Damjan Georgievski
306c545151 let's return a Result from create_app
with the possibility that any errors could be reported/handled by the
caller. the lambda in server::new(|| ...) doesn't care though
2018-07-23 00:32:59 +02:00
Damjan Georgievski
d2f9578b68 add some headers to the favicon
* content-type to image/png
* cache control for 24h
2018-07-22 17:45:28 +02:00
Damjan Georgievski
71482ffacd don't panic on r.metadata()
use unwrap_or() instead of unwrap() to avoid panics if metadata can't be
read from a direntry.

optimistic_is_dir will just return false in that case (same as non
directory)
2018-07-22 17:08:21 +02:00
Damjan Georgievski
625bbcc0b9 replace the unwrap with a error return
don't panic on std::fs::read_dir error (although permission errors are
returned as 404 responses)
2018-07-22 07:41:05 +02:00
Damjan Georgievski
01f0001594 dark style, footer, homepage 2018-07-22 06:55:58 +02:00
Damjan Georgievski
592ea53524 many improvements to the html generated
- css is now in src/style.css - included in the executable at compile time
- use writeln!/write! macros instead of push_str + format!
- properly generate the link to the .tar for the current directory

v0.6
2018-07-22 05:51:55 +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
06e5cd47eb this can be expressed in a single filter_map 2018-07-21 21:27:57 +02:00
Damjan Georgievski
a9c0e1ec81 use r#" "# string literals so to not escape the " 2018-07-21 20:27:03 +02:00
Damjan Georgievski
6ad16f8dcf r.get() is a shortcut for r.method(Method::GET) 2018-07-21 20:01:28 +02:00
Damjan Georgievski
0967442fcd add a favicon
- fixes #6
- the image is embeded in the executable with the include_bytes! macro
- I choose a simple share image
2018-07-21 18:41:02 +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
091f203317 use a non default logger that doesn't log the timestamp
the env_logger already adds the timestamp, so it was redundant

before:
`INFO 2018-07-21T12:57:49Z: actix_web::middleware::logger: 127.0.0.1:42112 [21/Jul/2018:14:57:49 +0200] "GET / HTTP/1.1" 200 858 "-" "curl/7.61.0" 0.000686`

after:
`INFO 2018-07-21T13:03:20Z: actix_web::middleware::logger: 127.0.0.1:42154 "GET / HTTP/1.1" 200 858 "-" "curl/7.61.0" 0.000367`
2018-07-21 15:13:30 +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
Дамјан Георгиевски
9a56bcb1a0 slight reorganization of the html generation 2018-07-08 16:11:19 +02:00
Дамјан Георгиевски
e9ef0d582e insignificant changes
* renamed `run_tar_in_thread()` to `stream_tar_in_thread()`
* use `impl Responder` instead of `Result<HttpResponse>`
* add an `.unwrap()` to `StaticFiles::new()` (seems to be an upstream API change)
2018-07-08 16:07:32 +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