Actualiza actix-web a la versión 4

This commit is contained in:
Manuel Cillero 2022-07-02 23:40:48 +02:00
parent cafc4422fa
commit 82d23c2499
9 changed files with 20 additions and 21 deletions

View file

@ -19,7 +19,7 @@ features = ["mysql"]
default-features = false
[dependencies]
actix-web = "3.3.3"
actix-web = "4.1.0"
pagetop-admin = { path = "../pagetop-admin" }
pagetop-user = { path = "../pagetop-user" }
pagetop-node = { path = "../pagetop-node" }

View file

@ -15,4 +15,4 @@ license = "Apache-2.0 or MIT"
[dependencies]
pagetop = { path = "../pagetop" }
maud = { version = "0.23.0" }
maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd6" }

View file

@ -43,11 +43,11 @@ fluent-templates = "0.7.1"
unic-langid = "0.9.0"
actix-web = "4.1.0"
actix-web-static-files = "4.0.0"
actix-files = "0.6.1"
actix-web-static-files = "4.0.0"
static-files = "0.2.3"
maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd62165a075c7f16a32f8bbacc398f52d13", features = ["actix-web"] }
sycamore = { version = "0.7.1", features = ["ssr"] }
maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd6", features = ["actix-web"] }
serde = { version = "1.0", features = ["derive"] }

View file

@ -18,8 +18,8 @@ features = ["mysql"]
default-features = false
[dependencies]
actix-web = "3.3.3"
actix-web = "4.1.0"
# Si se usa la macro html!:
maud = { version = "0.23.0" }
maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd6" }
# Si se requiere serialización de estructuras de datos:
serde = { version = "1.0", features = ["derive"] }

View file

@ -9,6 +9,6 @@ edition = "2021"
[dependencies]
pagetop = { path = "../pagetop" }
# Si se usa la macro html!:
maud = { version = "0.23.0" }
maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd6" }
# Si se requiere serialización de estructuras de datos:
serde = { version = "1.0", features = ["derive"] }

View file

@ -3,17 +3,18 @@ use static_files::resource_dir;
use std::env;
use std::path::Path;
fn main() {
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 main() -> std::io::Result<()> {
build_resource_dir("./static/theme", "theme")?;
build_resource_dir("./static/aliner", "aliner")?;
build_resource_dir("./static/bootsier", "bootsier")?;
build_resource_dir("./static/bulmix", "bulmix")
}
fn build_resource_dir(dir: &str, with_filename: &str, with_fn: &str) {
fn build_resource_dir(dir: &str, name: &str) -> std::io::Result<()> {
let mut resource = resource_dir(dir);
resource.with_generated_filename(
Path::new(env::var("OUT_DIR").unwrap().as_str()).join(with_filename)
Path::new(env::var("OUT_DIR").unwrap().as_str()).join(format!("{}.rs", name))
);
resource.with_generated_fn(with_fn);
resource.build().unwrap();
resource.with_module_name(format!("resources_{}", name));
resource.build()
}

View file

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

View file

@ -60,7 +60,7 @@ impl ThemeTrait for Bootsier {
style="width: 20%; max-width: 188px"
alt="Caution!";
div class="media-body" {
h1 class="display-4" { (s) }
h1 class="display-4" { (s.as_str()) }
p class="lead" { (l(description)) }
hr class="my-4";
p { (l(message)) }

View file

@ -127,7 +127,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
.with_title(format!("Error {}", s.as_str()).as_str())
.add_to("content", Chunck::with(html! {
div {
h1 { (s) }
h1 { (s.as_str()) }
}
}))
.render()