From 46e82e91e573a1a642aff21a9049c0ebe09ce319 Mon Sep 17 00:00:00 2001 From: "Aode (lion)" Date: Wed, 24 Nov 2021 17:35:48 -0600 Subject: [PATCH] Update actix-web --- Cargo.lock | 21 +++++++++++---------- Cargo.toml | 2 +- crates/apub/src/http/comment.rs | 4 ++-- crates/apub/src/http/community.rs | 10 +++++----- crates/apub/src/http/mod.rs | 10 +++++----- crates/apub/src/http/person.rs | 6 +++--- crates/apub/src/http/post.rs | 4 ++-- 7 files changed, 29 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7e91c129..e9402f258 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -69,9 +69,9 @@ dependencies = [ [[package]] name = "actix-http" -version = "3.0.0-beta.12" +version = "3.0.0-beta.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afaeb3d3fcb06b775ac62f05d580aae4afe5a149513333a73f688fdf26c06639" +checksum = "1bc3f9d97e32d75fae3ad7d955ac005eea3fd3ea60a89132768700911a60fd94" dependencies = [ "actix-codec", "actix-rt", @@ -170,9 +170,9 @@ dependencies = [ [[package]] name = "actix-tls" -version = "3.0.0-beta.8" +version = "3.0.0-beta.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a563b0245222230c860c1b077ca7309179fff0f575b1914967c1ee385aa5da64" +checksum = "53d4739910b49c77ea88308a9fbfae544524b34884161527f9978c0102052da0" dependencies = [ "actix-codec", "actix-rt", @@ -182,6 +182,7 @@ dependencies = [ "futures-core", "http", "log", + "pin-project-lite", "tokio-rustls", "tokio-util", "webpki-roots", @@ -199,9 +200,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.0.0-beta.11" +version = "4.0.0-beta.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85aa9bb018d83a0db70f557ba0cde9c6170a5d1de4fede02e377f68c1ac5aa9" +checksum = "e87cfc4efaad42f8a054e269d1b85046397ff4e8707e49128dea3f99a512a9d6" dependencies = [ "actix-codec", "actix-http", @@ -388,9 +389,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "awc" -version = "3.0.0-beta.10" +version = "3.0.0-beta.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f122bed94dc044b13a991b292ff6a3cde4c3fba890a4e3dbbec0f2eedc607f0a" +checksum = "f9f7d0c472987e454f41c3f4c7fa336ca139707ab255644b0480144c2060c800" dependencies = [ "actix-codec", "actix-http", @@ -3999,9 +4000,9 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.5.0-beta.2" +version = "0.5.0-beta.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cac34827e06f78b69523b2fbe5b2dd4dfc75940b2ea5ba37e4fa2a25d4a0edf" +checksum = "994e4a59135823bdca121a8d086e3fcc71741c8677b47fa95a6afdd15e8f646f" dependencies = [ "actix-web", "pin-project", diff --git a/Cargo.toml b/Cargo.toml index 0d38c2e7f..9a0879899 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ serde = { version = "1.0.130", features = ["derive"] } actix = "0.12.0" actix-web = { version = "4.0.0-beta.9", default-features = false, features = ["rustls"] } tracing = "0.1.29" -tracing-actix-web = "0.5.0-beta.2" +tracing-actix-web = "0.5.0-beta.3" tracing-error = "0.2.0" tracing-log = "0.1.2" tracing-subscriber = { version = "0.3.2", features = ["env-filter"] } diff --git a/crates/apub/src/http/comment.rs b/crates/apub/src/http/comment.rs index f62ff36e2..d19847421 100644 --- a/crates/apub/src/http/comment.rs +++ b/crates/apub/src/http/comment.rs @@ -2,7 +2,7 @@ use crate::{ http::{create_apub_response, create_apub_tombstone_response}, objects::comment::ApubComment, }; -use actix_web::{body::Body, web, web::Path, HttpResponse}; +use actix_web::{body::AnyBody, web, web::Path, HttpResponse}; use diesel::result::Error::NotFound; use lemmy_api_common::blocking; use lemmy_apub_lib::traits::ApubObject; @@ -20,7 +20,7 @@ pub(crate) struct CommentQuery { pub(crate) async fn get_apub_comment( info: Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let id = CommentId(info.comment_id.parse::()?); let comment: ApubComment = blocking(context.pool(), move |conn| Comment::read(conn, id)) .await?? diff --git a/crates/apub/src/http/community.rs b/crates/apub/src/http/community.rs index b040a4a80..a65f267a1 100644 --- a/crates/apub/src/http/community.rs +++ b/crates/apub/src/http/community.rs @@ -21,7 +21,7 @@ use crate::{ collections::group_followers::GroupFollowers, }, }; -use actix_web::{body::Body, web, web::Payload, HttpRequest, HttpResponse}; +use actix_web::{body::AnyBody, web, web::Payload, HttpRequest, HttpResponse}; use lemmy_api_common::blocking; use lemmy_apub_lib::{object_id::ObjectId, traits::ApubObject}; use lemmy_db_schema::source::community::Community; @@ -39,7 +39,7 @@ pub(crate) struct CommunityQuery { pub(crate) async fn get_apub_community_http( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let community: ApubCommunity = blocking(context.pool(), move |conn| { Community::read_from_name(conn, &info.community_name) }) @@ -96,7 +96,7 @@ pub(in crate::http) async fn receive_group_inbox( pub(crate) async fn get_apub_community_followers( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let community = blocking(context.pool(), move |conn| { Community::read_from_name(conn, &info.community_name) }) @@ -110,7 +110,7 @@ pub(crate) async fn get_apub_community_followers( pub(crate) async fn get_apub_community_outbox( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let community = blocking(context.pool(), move |conn| { Community::read_from_name(conn, &info.community_name) }) @@ -124,7 +124,7 @@ pub(crate) async fn get_apub_community_outbox( pub(crate) async fn get_apub_community_moderators( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let community: ApubCommunity = blocking(context.pool(), move |conn| { Community::read_from_name(conn, &info.community_name) }) diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index 0d484e8f8..154bbca07 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -7,7 +7,7 @@ use crate::{ insert_activity, }; use actix_web::{ - body::Body, + body::AnyBody, web, web::{Bytes, BytesMut, Payload}, HttpRequest, @@ -117,7 +117,7 @@ where /// Convert the data to json and turn it into an HTTP Response with the correct ActivityPub /// headers. -fn create_apub_response(data: &T) -> HttpResponse +fn create_apub_response(data: &T) -> HttpResponse where T: Serialize, { @@ -126,13 +126,13 @@ where .json(WithContext::new(data)) } -fn create_json_apub_response(data: serde_json::Value) -> HttpResponse { +fn create_json_apub_response(data: serde_json::Value) -> HttpResponse { HttpResponse::Ok() .content_type(APUB_JSON_CONTENT_TYPE) .json(data) } -fn create_apub_tombstone_response(data: &T) -> HttpResponse +fn create_apub_tombstone_response(data: &T) -> HttpResponse where T: Serialize, { @@ -152,7 +152,7 @@ pub struct ActivityQuery { pub(crate) async fn get_activity( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let settings = context.settings(); let activity_id = Url::parse(&format!( "{}/activities/{}/{}", diff --git a/crates/apub/src/http/person.rs b/crates/apub/src/http/person.rs index b98f189c9..6eeb0ebdb 100644 --- a/crates/apub/src/http/person.rs +++ b/crates/apub/src/http/person.rs @@ -11,7 +11,7 @@ use crate::{ objects::person::ApubPerson, protocol::collections::person_outbox::PersonOutbox, }; -use actix_web::{body::Body, web, web::Payload, HttpRequest, HttpResponse}; +use actix_web::{body::AnyBody, web, web::Payload, HttpRequest, HttpResponse}; use lemmy_api_common::blocking; use lemmy_apub_lib::traits::ApubObject; use lemmy_db_schema::source::person::Person; @@ -29,7 +29,7 @@ pub struct PersonQuery { pub(crate) async fn get_apub_person_http( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let user_name = info.into_inner().user_name; // TODO: this needs to be able to read deleted persons, so that it can send tombstones let person: ApubPerson = blocking(context.pool(), move |conn| { @@ -72,7 +72,7 @@ pub(in crate::http) async fn receive_person_inbox( pub(crate) async fn get_apub_person_outbox( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let person = blocking(context.pool(), move |conn| { Person::find_by_name(conn, &info.user_name) }) diff --git a/crates/apub/src/http/post.rs b/crates/apub/src/http/post.rs index 52fe002a9..39a78c1e7 100644 --- a/crates/apub/src/http/post.rs +++ b/crates/apub/src/http/post.rs @@ -2,7 +2,7 @@ use crate::{ http::{create_apub_response, create_apub_tombstone_response}, objects::post::ApubPost, }; -use actix_web::{body::Body, web, HttpResponse}; +use actix_web::{body::AnyBody, web, HttpResponse}; use diesel::result::Error::NotFound; use lemmy_api_common::blocking; use lemmy_apub_lib::traits::ApubObject; @@ -20,7 +20,7 @@ pub(crate) struct PostQuery { pub(crate) async fn get_apub_post( info: web::Path, context: web::Data, -) -> Result, LemmyError> { +) -> Result, LemmyError> { let id = PostId(info.post_id.parse::()?); let post: ApubPost = blocking(context.pool(), move |conn| Post::read(conn, id)) .await??