diff --git a/Cargo.lock b/Cargo.lock index 707cfac5..57ffe87a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -423,9 +423,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.6.0" +version = "4.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1cf67dadb19d7c95e5a299e2dda24193b89d5d4f33a3b9800888ede9e19aa32" +checksum = "1988c02af8d2b718c05bc4aeb6a66395b7cdf32858c2c71131e5637a8c05a9ff" dependencies = [ "actix-codec", "actix-http", @@ -483,9 +483,9 @@ dependencies = [ [[package]] name = "actix-web-codegen" -version = "4.2.2" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" +checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" dependencies = [ "actix-router", "proc-macro2", @@ -4926,7 +4926,7 @@ dependencies = [ "actix-web", "actix-web-lab", "aes-gcm-siv", - "base64 0.22.1", + "base64 0.21.7", "env_logger", "log", "serde", diff --git a/Cargo.toml b/Cargo.toml index fa252ec2..7e0dc88e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -90,7 +90,7 @@ actix-session = "0.9" actix-test = "0.1" actix-tls = "3.4" actix-utils = "3" -actix-web = "4.6" +actix-web = "4.7" actix-web-actors = "4.1" actix-web-lab = "0.20" actix-ws = "0.2.5" diff --git a/forms/multipart-s3/src/main.rs b/forms/multipart-s3/src/main.rs index 032bae53..3811d888 100644 --- a/forms/multipart-s3/src/main.rs +++ b/forms/multipart-s3/src/main.rs @@ -2,15 +2,10 @@ use std::{fs, io}; use actix_multipart::form::{tempfile::TempFile, text::Text, MultipartForm}; use actix_web::{ - body::SizedStream, - delete, error, get, - http::Method, - middleware::Logger, - post, route, - web::{self}, - App, Error, HttpResponse, HttpServer, Responder, + body::SizedStream, delete, error, get, http::Method, middleware::Logger, post, route, web, App, + Error, HttpResponse, HttpServer, Responder, }; -use actix_web_lab::{extract::Path, respond::Html}; +use actix_web_lab::extract::Path; use aws_config::{meta::region::RegionProviderChain, BehaviorVersion}; use dotenvy::dotenv; use futures_util::{stream, StreamExt as _}; @@ -93,7 +88,7 @@ async fn delete_from_s3( #[get("/")] async fn index() -> impl Responder { - Html(include_str!("./index.html").to_owned()) + web::Html::new(include_str!("./index.html").to_owned()) } #[actix_web::main] diff --git a/graphql/async-graphql/src/main.rs b/graphql/async-graphql/src/main.rs index c23752e4..260bc7dc 100644 --- a/graphql/async-graphql/src/main.rs +++ b/graphql/async-graphql/src/main.rs @@ -1,6 +1,5 @@ use actix_cors::Cors; use actix_web::{get, middleware::Logger, route, web, App, HttpServer, Responder}; -use actix_web_lab::respond::Html; use async_graphql::{ http::{playground_source, GraphQLPlaygroundConfig}, EmptyMutation, EmptySubscription, Schema, @@ -19,7 +18,7 @@ async fn graphql(schema: web::Data, req: GraphQLRequest) -> Grap /// GraphiQL playground UI #[get("/graphiql")] async fn graphql_playground() -> impl Responder { - Html(playground_source( + web::Html::new(playground_source( GraphQLPlaygroundConfig::new("/graphql").subscription_endpoint("/graphql"), )) } diff --git a/graphql/juniper-advanced/src/handlers.rs b/graphql/juniper-advanced/src/handlers.rs index c9631141..b9232ab5 100644 --- a/graphql/juniper-advanced/src/handlers.rs +++ b/graphql/juniper-advanced/src/handlers.rs @@ -1,5 +1,4 @@ use actix_web::{get, route, web, Error, HttpResponse, Responder}; -use actix_web_lab::respond::Html; use juniper::http::{graphiql::graphiql_source, GraphQLRequest}; use crate::{ @@ -26,7 +25,7 @@ pub async fn graphql( /// GraphiQL UI #[get("/graphiql")] async fn graphql_playground() -> impl Responder { - Html(graphiql_source("/graphql", None)) + web::Html::new(graphiql_source("/graphql", None)) } pub fn register(config: &mut web::ServiceConfig) { diff --git a/graphql/juniper/src/main.rs b/graphql/juniper/src/main.rs index 40d6f8b0..0a076457 100644 --- a/graphql/juniper/src/main.rs +++ b/graphql/juniper/src/main.rs @@ -10,7 +10,6 @@ use actix_web::{ web::{self, Data}, App, HttpResponse, HttpServer, Responder, }; -use actix_web_lab::respond::Html; use juniper::http::{graphiql::graphiql_source, GraphQLRequest}; mod schema; @@ -20,7 +19,7 @@ use crate::schema::{create_schema, Schema}; /// GraphiQL playground UI #[get("/graphiql")] async fn graphql_playground() -> impl Responder { - Html(graphiql_source("/graphql", None)) + web::Html::new(graphiql_source("/graphql", None)) } /// GraphQL endpoint diff --git a/server-sent-events/src/main.rs b/server-sent-events/src/main.rs index 04ca4209..62d33b09 100644 --- a/server-sent-events/src/main.rs +++ b/server-sent-events/src/main.rs @@ -1,7 +1,7 @@ use std::{io, sync::Arc}; use actix_web::{get, middleware::Logger, post, web, App, HttpResponse, HttpServer, Responder}; -use actix_web_lab::{extract::Path, respond::Html}; +use actix_web_lab::extract::Path; mod broadcast; use self::broadcast::Broadcaster; @@ -30,7 +30,7 @@ async fn main() -> io::Result<()> { #[get("/")] async fn index() -> impl Responder { - Html(include_str!("index.html").to_owned()) + web::Html::new(include_str!("index.html").to_owned()) } #[get("/events")] diff --git a/templating/askama/src/main.rs b/templating/askama/src/main.rs index 02f6ea40..7819eabf 100644 --- a/templating/askama/src/main.rs +++ b/templating/askama/src/main.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use actix_web::{middleware, web, App, HttpServer, Responder, Result}; -use actix_web_lab::respond::Html; use askama::Template; #[derive(Template)] @@ -27,7 +26,7 @@ async fn index(query: web::Query>) -> Result>, lang: LangChoice) -> impl Responder { let data = json!({ "lang": lang }); let body = hb.render("index", &data).unwrap(); - Html(body) + web::Html::new(body) } #[get("/{user}/{data}")] @@ -46,7 +46,7 @@ async fn user( "data": info.1 }); let body = hb.render("user", &data).unwrap(); - Html(body) + web::Html::new(body) } #[actix_web::main] diff --git a/templating/handlebars/src/main.rs b/templating/handlebars/src/main.rs index ba364217..57c2fba1 100644 --- a/templating/handlebars/src/main.rs +++ b/templating/handlebars/src/main.rs @@ -8,7 +8,6 @@ use actix_web::{ middleware::{ErrorHandlerResponse, ErrorHandlers}, web, App, HttpResponse, HttpServer, Responder, Result, }; -use actix_web_lab::respond::Html; use handlebars::{DirectorySourceOptions, Handlebars}; use serde_json::json; @@ -19,7 +18,7 @@ async fn index(hb: web::Data>) -> impl Responder { }); let body = hb.render("index", &data).unwrap(); - Html(body) + web::Html::new(body) } #[get("/{user}/{data}")] @@ -31,7 +30,7 @@ async fn user(hb: web::Data>, path: web::Path<(String, String)>) }); let body = hb.render("user", &data).unwrap(); - Html(body) + web::Html::new(body) } #[actix_web::main] diff --git a/templating/minijinja/src/main.rs b/templating/minijinja/src/main.rs index acbb496c..06a1fe94 100644 --- a/templating/minijinja/src/main.rs +++ b/templating/minijinja/src/main.rs @@ -8,7 +8,6 @@ use actix_web::{ middleware::{ErrorHandlerResponse, ErrorHandlers, Logger}, web, App, FromRequest, HttpRequest, HttpResponse, HttpServer, Responder, Result, }; -use actix_web_lab::respond::Html; use minijinja::path_loader; use minijinja_autoreload::AutoReloader; @@ -21,14 +20,14 @@ impl MiniJinjaRenderer { &self, tmpl: &str, ctx: impl Into, - ) -> actix_web::Result { + ) -> actix_web::Result { self.tmpl_env .acquire_env() .map_err(|_| error::ErrorInternalServerError("could not acquire template env"))? .get_template(tmpl) .map_err(|_| error::ErrorInternalServerError("could not find template"))? .render(ctx.into()) - .map(Html) + .map(web::Html::new) .map_err(|err| { log::error!("{err}"); error::ErrorInternalServerError("template error") diff --git a/templating/sailfish/src/main.rs b/templating/sailfish/src/main.rs index a4e20c83..a6d603a7 100644 --- a/templating/sailfish/src/main.rs +++ b/templating/sailfish/src/main.rs @@ -3,7 +3,6 @@ use actix_web::{ middleware::{Compress, Logger}, web, App, HttpServer, Responder, }; -use actix_web_lab::respond::Html; use sailfish::TemplateOnce; #[derive(TemplateOnce)] @@ -24,7 +23,7 @@ async fn greet(params: web::Path<(String,)>) -> actix_web::Result) -> actix_web::Result { .render_once() .map_err(error::ErrorInternalServerError)?; - Ok(Html(body)) + Ok(web::Html::new(body)) } #[get("/")] async fn hello() -> impl Responder { - Html("

Hello world!

".to_owned()) + web::Html::new("

Hello world!

".to_owned()) } #[actix_web::main] diff --git a/templating/tera/src/main.rs b/templating/tera/src/main.rs index ef6e1d56..d076cdd2 100644 --- a/templating/tera/src/main.rs +++ b/templating/tera/src/main.rs @@ -8,7 +8,6 @@ use actix_web::{ middleware::{self, ErrorHandlerResponse, ErrorHandlers}, web, App, Error, HttpResponse, HttpServer, Responder, Result, }; -use actix_web_lab::respond::Html; use tera::Tera; // store tera template in application state @@ -28,7 +27,7 @@ async fn index( .map_err(|_| error::ErrorInternalServerError("Template error"))? }; - Ok(Html(s)) + Ok(web::Html::new(s)) } #[actix_web::main]