From 31da95af95184fceee4aac8478d9574f51d46c43 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 2 Jun 2022 18:23:27 +0200 Subject: [PATCH] Remove generic param error from receive_activity() --- examples/federation/instance.rs | 2 +- src/core/inbox.rs | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/examples/federation/instance.rs b/examples/federation/instance.rs index 4943178..207ad4d 100644 --- a/examples/federation/instance.rs +++ b/examples/federation/instance.rs @@ -114,7 +114,7 @@ async fn http_post_user_inbox( ) -> Result { let data: InstanceHandle = data.into_inner().deref().clone(); let activity = serde_json::from_str(&payload)?; - receive_activity::, MyUser, InstanceHandle, Error>( + receive_activity::, MyUser, InstanceHandle>( request, activity, &data.clone().local_instance, diff --git a/src/core/inbox.rs b/src/core/inbox.rs index 1fe2c0f..39276b5 100644 --- a/src/core/inbox.rs +++ b/src/core/inbox.rs @@ -16,17 +16,19 @@ pub trait ActorPublicKey { } /// Receive an activity and perform some basic checks, including HTTP signature verification. -pub async fn receive_activity( +pub async fn receive_activity( request: HttpRequest, activity: Activity, local_instance: &LocalInstance, data: &Data, -) -> Result +) -> Result::Error> where - Activity: ActivityHandler + DeserializeOwned + Send + 'static, - Actor: ApubObject + ActorPublicKey + Send + 'static, + Activity: ActivityHandler + DeserializeOwned + Send + 'static, + Actor: ApubObject + ActorPublicKey + Send + 'static, for<'de2> ::ApubType: serde::Deserialize<'de2>, - E: From + From, + ::Error: + From + From + From<::Error>, + ::Error: From + From, { verify_domains_match(activity.id(), activity.actor())?; verify_url_valid(activity.id(), &local_instance.settings)?;