Commit graph

117 commits

Author SHA1 Message Date
Damjan Georgievski
447c361b48 bump version to 0.9.0 2019-01-18 00:40:05 +01: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
Damjan Georgievski
072b427828 opt-level = 'z' for smaller binaries
https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections
> 'z' reduces size even more
2019-01-18 00:10:09 +01:00
Damjan Georgievski
33fde259d3 test travis cache
revert 3f871d17
2019-01-18 00:07:15 +01:00
Дамјан Георгиевски
09cba55dc8 use rust language edition 2018 (introduced in 1.31) 2018-12-06 20:08:26 +01:00
Дамјан Георгиевски
595ebed94d update travis setup
only make release builds on tags, but don't build twice
2018-10-20 19:07:31 +02:00
Дамјан Георгиевски
3f871d1779 explicit caching instead of the default cache: cargo
Based on the suggestions at
https://levans.fr/rust_travis_cache.html
"Beware the rust cache on Travis"
2018-10-20 17:18:43 +02:00
Дамјан Георгиевски
47600fe218 Revert "test a simplified travis.yml"
This reverts commit d0516ecb21.

nope, I do need the TARGET variable to know where the build goes anyway
2018-10-20 16:38:07 +02:00
Дамјан Георгиевски
d0516ecb21 test a simplified travis.yml 2018-10-20 16:31:39 +02: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
Дамјан Георгиевски
609d273ab2
some deduplication from the travis matrix
always use `cache: cargo` and `rust: stable` anyway
2018-10-13 16:13:57 +02:00
Дамјан Георгиевски
92c0cc310e
add windows support in travis
https://blog.travis-ci.com/2018-10-11-windows-early-release
2018-10-13 16:10:43 +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
Дамјан Георгиевски
d6fd817ce0 optimize for size in the release build
3.7mb stripped, down from 4.7mb

opt-level = 's' is supported since Rust 1.28
2018-08-03 15:20:02 +02: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
1aeb2c1bf6 smaller font in footer 2018-07-22 17:27:40 +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
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
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
01f0001594 dark style, footer, homepage 2018-07-22 06:55:58 +02:00
Damjan Georgievski
481a984277 mac os doesn't support --strip-unneeded 2018-07-22 06:05:34 +02:00
Damjan Georgievski
d8cb0f6986 improve wording 2018-07-22 06:00:48 +02:00
Damjan Georgievski
37ff4197f6 add travis badge in README 2018-07-22 05:59:23 +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
8a86739f14 don't overwrite RUST_LOG if it exists 2018-07-22 03:53:39 +02:00
Damjan Georgievski
e56cf130fe strip binaries for release deploys 2018-07-21 22:17:19 +02:00
Damjan Georgievski
dfe3f18f21 let's try making releases via travis
supports both mac os x and linux
2018-07-21 21:28:16 +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
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
6ad16f8dcf r.get() is a shortcut for r.method(Method::GET) 2018-07-21 20:01:28 +02:00
Damjan Georgievski
15704d04e7 version 0.5
note how to build releases
2018-07-21 19:32:04 +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
38434ddaf1 actix-web supports content-encoding:gzip by default
data will be compressed on the wire automatically, so no need to add the complexity of compression
2018-07-21 18:42:54 +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
933b53b2b1 remove the println! since the logger already prints the listener 2018-07-21 15:14:01 +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
Damjan Georgievski
a4d895ea4a bump to the axtix-web 0.7 release 2018-07-21 14:39:29 +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
Дамјан Георгиевски
ca4cc0a941 actix 0.7 has been released, no need to patch the dependency 2018-07-15 18:59:49 +02:00