Añade las dependencias para soportar Actix-web 4

Pendiente de que Maud libere una nueva versión con las modificaciones
aplicadas en https://github.com/lambda-fairy/maud/pull/331 para soportar
Actix-web 4.
This commit is contained in:
Manuel Cillero 2022-03-15 20:11:54 +01:00
parent 1102a76e47
commit ad65ab494c
3 changed files with 26 additions and 41 deletions

View file

@ -27,23 +27,24 @@ categories = [
doc-comment = "0.3.3"
downcast-rs = "1.2.0"
figlet-rs = "0.1.3"
futures = "0.3"
futures = "0.3.21"
once_cell = "1.9.0"
url = "2.2.2"
config_rs = { package = "config", version = "0.11.0", features = ["toml"] }
tracing = "0.1"
tracing-appender = "0.2"
tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] }
tracing-unwrap = { version = "0.9", default-features = false }
tracing-actix-web = "0.2"
tracing = "0.1.32"
tracing-appender = "0.2.1"
tracing-subscriber = { version = "0.3.9", features = ["json", "env-filter"] }
tracing-unwrap = { version = "0.9.2", default-features = false }
tracing-actix-web = "0.5.1"
fluent-templates = "0.6.1"
unic-langid = "0.9.0"
actix-web = "3.3.3"
actix-web-static-files = "3.0.5"
actix-web = "4.0.1"
actix-web-static-files = "4.0.0"
static-files = "0.2.3"
maud = { version = "0.23.0", features = ["actix-web"] }
sycamore = { version = "0.7.1", features = ["ssr"] }
@ -51,13 +52,13 @@ sycamore = { version = "0.7.1", features = ["ssr"] }
serde = { version = "1.0", features = ["derive"] }
[dependencies.sea-orm]
version = "0.6"
version = "0.6.0"
features = ["debug-print", "macros", "runtime-async-std-native-tls"]
default-features = false
optional = true
[dependencies.sea-schema]
version = "0.5"
version = "0.6.0"
features = ["debug-print", "migration"]
default-features = false
optional = true
@ -69,7 +70,7 @@ postgres = ["sea-orm", "sea-schema", "sea-orm/sqlx-postgres"]
sqlite = ["sea-orm", "sea-schema", "sea-orm/sqlx-sqlite"]
[build-dependencies]
actix-web-static-files = "3.0.5"
static-files = "0.2.3"
[lib]
name = "pagetop"

View file

@ -1,33 +1,19 @@
use actix_web_static_files::resource_dir;
use static_files::resource_dir;
use std::env;
use std::path::Path;
fn main() {
resource_dir("./static/theme")
.with_generated_filename(
Path::new(env::var("OUT_DIR").unwrap().as_str())
.join("theme.rs")
)
.with_generated_fn("assets")
.build()
.unwrap();
resource_dir("./static/aliner")
.with_generated_filename(
Path::new(env::var("OUT_DIR").unwrap().as_str())
.join("aliner.rs")
)
.with_generated_fn("assets")
.build()
.unwrap();
resource_dir("./static/bootsier")
.with_generated_filename(
Path::new(env::var("OUT_DIR").unwrap().as_str())
.join("bootsier.rs")
)
.with_generated_fn("assets")
.build()
.unwrap();
build_resource_dir("./static/theme", "theme.rs", "assets");
build_resource_dir("./static/aliner", "aliner.rs", "assets");
build_resource_dir("./static/bootsier", "bootsier.rs", "assets");
}
fn build_resource_dir(dir: &str, with_filename: &str, with_fn: &str) {
let mut resource = resource_dir(dir);
resource.with_generated_filename(
Path::new(env::var("OUT_DIR").unwrap().as_str()).join(with_filename)
);
resource.with_generated_fn(with_fn);
resource.build().unwrap();
}

View file

@ -5,7 +5,6 @@ use crate::core::theme::register_theme;
use crate::core::module::register_module;
use std::io::Error;
use actix_web::middleware::normalize::{NormalizePath, TrailingSlash};
pub struct Application {
server: Server,
@ -77,8 +76,7 @@ impl Application {
// Prepara el servidor web.
let server = server::HttpServer::new(move || {
server::App::new()
.wrap(tracing_actix_web::TracingLogger)
.wrap(NormalizePath::new(TrailingSlash::Trim))
.wrap(tracing_actix_web::TracingLogger::default())
.configure(&global::themes)
.configure(&global::modules)
})