Update actix-web

asonix/better-errors
Aode (lion) 2021-11-24 17:35:48 -06:00
parent 2e42f3c0c5
commit 46e82e91e5
7 changed files with 29 additions and 28 deletions

21
Cargo.lock generated
View File

@ -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",

View File

@ -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"] }

View File

@ -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<CommentQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, LemmyError> {
let id = CommentId(info.comment_id.parse::<i32>()?);
let comment: ApubComment = blocking(context.pool(), move |conn| Comment::read(conn, id))
.await??

View File

@ -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<CommunityQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, 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<CommunityQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, 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<CommunityQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, 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<CommunityQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, LemmyError> {
let community: ApubCommunity = blocking(context.pool(), move |conn| {
Community::read_from_name(conn, &info.community_name)
})

View File

@ -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<T>(data: &T) -> HttpResponse<Body>
fn create_apub_response<T>(data: &T) -> HttpResponse<AnyBody>
where
T: Serialize,
{
@ -126,13 +126,13 @@ where
.json(WithContext::new(data))
}
fn create_json_apub_response(data: serde_json::Value) -> HttpResponse<Body> {
fn create_json_apub_response(data: serde_json::Value) -> HttpResponse<AnyBody> {
HttpResponse::Ok()
.content_type(APUB_JSON_CONTENT_TYPE)
.json(data)
}
fn create_apub_tombstone_response<T>(data: &T) -> HttpResponse<Body>
fn create_apub_tombstone_response<T>(data: &T) -> HttpResponse<AnyBody>
where
T: Serialize,
{
@ -152,7 +152,7 @@ pub struct ActivityQuery {
pub(crate) async fn get_activity(
info: web::Path<ActivityQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, LemmyError> {
let settings = context.settings();
let activity_id = Url::parse(&format!(
"{}/activities/{}/{}",

View File

@ -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<PersonQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, 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<PersonQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, LemmyError> {
let person = blocking(context.pool(), move |conn| {
Person::find_by_name(conn, &info.user_name)
})

View File

@ -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<PostQuery>,
context: web::Data<LemmyContext>,
) -> Result<HttpResponse<Body>, LemmyError> {
) -> Result<HttpResponse<AnyBody>, LemmyError> {
let id = PostId(info.post_id.parse::<i32>()?);
let post: ApubPost = blocking(context.pool(), move |conn| Post::read(conn, id))
.await??