Update actix crate

This commit is contained in:
silverpill 2022-08-18 18:05:18 +00:00
parent 9abf7bd76b
commit c546840787
3 changed files with 16 additions and 21 deletions

18
Cargo.lock generated
View file

@ -21,9 +21,9 @@ dependencies = [
[[package]]
name = "actix-cors"
version = "0.6.1"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "414360eed71ba2d5435b185ba43ecbe281dfab5df3898286d6b7be8074372c92"
checksum = "02a0adcaabb68f1dfe8880cb3c5f049261c68f5d69ce06b6f3a930f31710838e"
dependencies = [
"actix-utils",
"actix-web",
@ -36,9 +36,9 @@ dependencies = [
[[package]]
name = "actix-files"
version = "0.6.0"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d81bde9a79336aa51ebed236e91fc1a0528ff67cfdf4f68ca4c61ede9fd26fb5"
checksum = "d832782fac6ca7369a70c9ee9a20554623c5e51c76e190ad151780ebea1cf689"
dependencies = [
"actix-http",
"actix-service",
@ -169,9 +169,9 @@ dependencies = [
[[package]]
name = "actix-web"
version = "4.0.1"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4e5ebffd51d50df56a3ae0de0e59487340ca456f05dd0b90c0a7a6dd6a74d31"
checksum = "a27e8fe9ba4ae613c21f677c2cfaf0696c3744030c6f485b34634e502d6bb379"
dependencies = [
"actix-codec",
"actix-http",
@ -221,16 +221,16 @@ dependencies = [
[[package]]
name = "actix-web-httpauth"
version = "0.6.0"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c25a48b4684f90520183cd1a688e5f4f7e9905835fa75d02c0fe4f60fcdbe6"
checksum = "6dda62cf04bc3a9ad2ea8f314f721951cfdb4cdacec4e984d20e77c7bb170991"
dependencies = [
"actix-service",
"actix-utils",
"actix-web",
"base64",
"futures-core",
"futures-util",
"log",
"pin-project-lite",
]

View file

@ -11,10 +11,10 @@ default-run = "mitra"
[dependencies]
# Used to handle incoming HTTP requests
actix-cors = "0.6.1"
actix-files = "0.6.0"
actix-web = "4.0.1"
actix-web-httpauth = "0.6.0"
actix-cors = "0.6.2"
actix-files = "0.6.2"
actix-web = "4.1.0"
actix-web-httpauth = "0.8.0"
# Used for HTML sanitization
ammonia = "3.2.0"
# Used for catching errors

View file

@ -1,10 +1,9 @@
use actix_cors::Cors;
use actix_web::{
http::header,
web,
App, HttpServer,
dev::Service,
middleware::Logger as ActixLogger,
web,
App, HttpServer,
};
use tokio::sync::Mutex;
@ -95,13 +94,9 @@ async fn main() -> std::io::Result<()> {
})
.allow_any_method()
.allow_any_header()
.expose_any_header()
},
};
let cors_config = cors_config
// Link header needs to be explicitly exposed
// because expose_any_header doesn't work
// https://github.com/actix/actix-extras/issues/192
.expose_headers(vec![header::LINK]);
let mut app = App::new()
.wrap(cors_config)
.wrap(ActixLogger::new("%r : %s : %{r}a"))