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 default-features = false
[dependencies] [dependencies]
actix-web = "3.3.3" actix-web = "4.1.0"
pagetop-admin = { path = "../pagetop-admin" } pagetop-admin = { path = "../pagetop-admin" }
pagetop-user = { path = "../pagetop-user" } pagetop-user = { path = "../pagetop-user" }
pagetop-node = { path = "../pagetop-node" } pagetop-node = { path = "../pagetop-node" }

View file

@ -15,4 +15,4 @@ license = "Apache-2.0 or MIT"
[dependencies] [dependencies]
pagetop = { path = "../pagetop" } 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" unic-langid = "0.9.0"
actix-web = "4.1.0" actix-web = "4.1.0"
actix-web-static-files = "4.0.0"
actix-files = "0.6.1" 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"] } maud = { git = "https://github.com/lambda-fairy/maud", rev = "e6787cd6", features = ["actix-web"] }
sycamore = { version = "0.7.1", features = ["ssr"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -18,8 +18,8 @@ features = ["mysql"]
default-features = false default-features = false
[dependencies] [dependencies]
actix-web = "3.3.3" actix-web = "4.1.0"
# Si se usa la macro html!: # 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: # Si se requiere serialización de estructuras de datos:
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -9,6 +9,6 @@ edition = "2021"
[dependencies] [dependencies]
pagetop = { path = "../pagetop" } pagetop = { path = "../pagetop" }
# Si se usa la macro html!: # 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: # Si se requiere serialización de estructuras de datos:
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

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

View file

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

View file

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

View file

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