some code cleanup

This commit is contained in:
Felix Ableitner 2021-07-12 05:37:44 +02:00
parent e88ab170ef
commit 28e960bd9c
37 changed files with 86 additions and 174 deletions

View file

@ -7,30 +7,8 @@ use activitystreams::{
pub use lemmy_apub_lib_derive::*; pub use lemmy_apub_lib_derive::*;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use std::marker::PhantomData;
use url::Url; use url::Url;
// for now, limit it to activity routing only, no http sigs, parsing or any of that
// need to route in this order:
// 1. recipient actor
// 2. activity type
// 3. inner object (recursively until object is empty or an url)
// TODO: turn this into a trait in which app has to implement the following functions:
// .checkIdValid() - for unique, instance block etc
// .checkHttpSig::<RequestType>()
// .fetchObject() - for custom http client
// .checkActivity() - for common validity checks
pub struct InboxConfig {
//actors: Vec<ActorConfig>,
}
impl InboxConfig {
pub fn shared_inbox_handler() {
todo!()
}
}
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)] #[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub enum PublicUrl { pub enum PublicUrl {
#[serde(rename = "https://www.w3.org/ns/activitystreams#Public")] #[serde(rename = "https://www.w3.org/ns/activitystreams#Public")]
@ -57,15 +35,13 @@ impl ActivityCommonFields {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
pub trait ActivityHandlerNew { pub trait ActivityHandler {
// TODO: also need to check for instance/community blocks in here
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,
request_counter: &mut i32, request_counter: &mut i32,
) -> Result<(), LemmyError>; ) -> Result<(), LemmyError>;
// todo: later handle request_counter completely inside library
async fn receive( async fn receive(
&self, &self,
context: &LemmyContext, context: &LemmyContext,
@ -94,16 +70,3 @@ pub fn verify_urls_match(a: &Url, b: &Url) -> Result<(), LemmyError> {
} }
Ok(()) Ok(())
} }
// todo: instead of phantomdata, might use option<kind> to cache the fetched object (or just fetch on construction)
pub struct ObjectId<'a, Kind>(Url, &'a PhantomData<Kind>);
impl<Kind> ObjectId<'_, Kind> {
pub fn url(self) -> Url {
self.0
}
pub fn dereference(self) -> Result<Kind, LemmyError> {
// todo: fetch object from http or database
todo!()
}
}

View file

@ -2,7 +2,7 @@ use proc_macro2::TokenStream;
use quote::quote; use quote::quote;
use syn::{parse_macro_input, Data, DeriveInput}; use syn::{parse_macro_input, Data, DeriveInput};
#[proc_macro_derive(ActivityHandlerNew)] #[proc_macro_derive(ActivityHandler)]
pub fn derive_activity_handler(input: proc_macro::TokenStream) -> proc_macro::TokenStream { pub fn derive_activity_handler(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
// Parse the input tokens into a syntax tree. // Parse the input tokens into a syntax tree.
let input = parse_macro_input!(input as DeriveInput); let input = parse_macro_input!(input as DeriveInput);
@ -34,7 +34,7 @@ pub fn derive_activity_handler(input: proc_macro::TokenStream) -> proc_macro::To
// The generated impl. // The generated impl.
let expanded = quote! { let expanded = quote! {
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl #impl_generics lemmy_apub_lib::ActivityHandlerNew for #name #ty_generics #where_clause { impl #impl_generics lemmy_apub_lib::ActivityHandler for #name #ty_generics #where_clause {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -5,12 +5,7 @@ use crate::activities::{
}; };
use activitystreams::{activity::kind::CreateType, base::BaseExt}; use activitystreams::{activity::kind::CreateType, base::BaseExt};
use lemmy_apub::{objects::FromApub, NoteExt}; use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{ use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler, PublicUrl};
verify_domains_match_opt,
ActivityCommonFields,
ActivityHandlerNew,
PublicUrl,
};
use lemmy_db_schema::source::comment::Comment; use lemmy_db_schema::source::comment::Comment;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{LemmyContext, UserOperationCrud}; use lemmy_websocket::{LemmyContext, UserOperationCrud};
@ -29,7 +24,7 @@ pub struct CreateComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for CreateComment { impl ActivityHandler for CreateComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -5,12 +5,7 @@ use crate::activities::{
}; };
use activitystreams::{activity::kind::UpdateType, base::BaseExt}; use activitystreams::{activity::kind::UpdateType, base::BaseExt};
use lemmy_apub::{objects::FromApub, NoteExt}; use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{ use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler, PublicUrl};
verify_domains_match_opt,
ActivityCommonFields,
ActivityHandlerNew,
PublicUrl,
};
use lemmy_db_schema::source::comment::Comment; use lemmy_db_schema::source::comment::Comment;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{LemmyContext, UserOperationCrud}; use lemmy_websocket::{LemmyContext, UserOperationCrud};
@ -29,7 +24,7 @@ pub struct UpdateComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UpdateComment { impl ActivityHandler for UpdateComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -6,7 +6,7 @@ use lemmy_apub::{
fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person}, fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person},
CommunityType, CommunityType,
}; };
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{source::community::CommunityModerator_, Joinable}; use lemmy_db_queries::{source::community::CommunityModerator_, Joinable};
use lemmy_db_schema::source::community::{CommunityModerator, CommunityModeratorForm}; use lemmy_db_schema::source::community::{CommunityModerator, CommunityModeratorForm};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -27,7 +27,7 @@ pub struct AddMod {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for AddMod { impl ActivityHandler for AddMod {
async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> { async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> {
verify_domains_match(&self.common.actor, self.common.id_unchecked())?; verify_domains_match(&self.common.actor, self.common.id_unchecked())?;
verify_domains_match(&self.target, &self.cc[0])?; verify_domains_match(&self.target, &self.cc[0])?;

View file

@ -20,13 +20,13 @@ use crate::{
}; };
use activitystreams::activity::kind::AnnounceType; use activitystreams::activity::kind::AnnounceType;
use lemmy_apub::insert_activity; use lemmy_apub::insert_activity;
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use url::Url; use url::Url;
#[derive(Clone, Debug, Deserialize, Serialize, ActivityHandlerNew)] #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
#[serde(untagged)] #[serde(untagged)]
pub enum AnnouncableActivities { pub enum AnnouncableActivities {
CreateComment(CreateComment), CreateComment(CreateComment),
@ -58,7 +58,7 @@ pub struct AnnounceActivity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for AnnounceActivity { impl ActivityHandler for AnnounceActivity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -5,7 +5,7 @@ use lemmy_apub::fetcher::{
community::get_or_fetch_and_upsert_community, community::get_or_fetch_and_upsert_community,
person::get_or_fetch_and_upsert_person, person::get_or_fetch_and_upsert_person,
}; };
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{Bannable, Followable}; use lemmy_db_queries::{Bannable, Followable};
use lemmy_db_schema::source::community::{ use lemmy_db_schema::source::community::{
CommunityFollower, CommunityFollower,
@ -30,7 +30,7 @@ pub struct BlockUserFromCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for BlockUserFromCommunity { impl ActivityHandler for BlockUserFromCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,4 +1,4 @@
use crate::activities::community::{send_websocket_message, verify_is_community_mod}; use crate::activities::{community::send_websocket_message, verify_mod_action};
use activitystreams::activity::kind::DeleteType; use activitystreams::activity::kind::DeleteType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{ use lemmy_apub::{
@ -7,7 +7,7 @@ use lemmy_apub::{
ActorType, ActorType,
CommunityType, CommunityType,
}; };
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{source::community::Community_, ApubObject}; use lemmy_db_queries::{source::community::Community_, ApubObject};
use lemmy_db_schema::source::community::Community; use lemmy_db_schema::source::community::Community;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -30,7 +30,7 @@ pub struct DeleteCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for DeleteCommunity { impl ActivityHandler for DeleteCommunity {
async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> { async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> {
verify_domains_match(&self.common.actor, self.common.id_unchecked())?; verify_domains_match(&self.common.actor, self.common.id_unchecked())?;
let object = self.object.clone(); let object = self.object.clone();
@ -42,7 +42,7 @@ impl ActivityHandlerNew for DeleteCommunity {
if let Ok(c) = community { if let Ok(c) = community {
verify_domains_match(&self.object, &self.cc[0])?; verify_domains_match(&self.object, &self.cc[0])?;
check_is_apub_id_valid(&self.common.actor, false)?; check_is_apub_id_valid(&self.common.actor, false)?;
verify_is_community_mod(self.common.actor.clone(), c.actor_id(), context).await verify_mod_action(&self.common.actor, c.actor_id(), context).await
} }
// community action sent to followers // community action sent to followers
else { else {

View file

@ -1,11 +1,7 @@
use anyhow::anyhow; use anyhow::anyhow;
use lemmy_api_common::{blocking, community::CommunityResponse}; use lemmy_api_common::{blocking, community::CommunityResponse};
use lemmy_apub::generate_moderators_url; use lemmy_apub::generate_moderators_url;
use lemmy_db_queries::ApubObject; use lemmy_db_schema::CommunityId;
use lemmy_db_schema::{
source::{community::Community, person::Person},
CommunityId,
};
use lemmy_db_views_actor::community_view::CommunityView; use lemmy_db_views_actor::community_view::CommunityView;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext}; use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext};
@ -44,30 +40,6 @@ async fn send_websocket_message<OP: ToString + Send + lemmy_websocket::Operation
Ok(()) Ok(())
} }
// TODO: why do we have this and verify_mod_action() ?
async fn verify_is_community_mod(
actor: Url,
community: Url,
context: &LemmyContext,
) -> Result<(), LemmyError> {
let actor = blocking(context.pool(), move |conn| {
Person::read_from_apub_id(conn, &actor.into())
})
.await??;
let community = blocking(context.pool(), move |conn| {
Community::read_from_apub_id(conn, &community.into())
})
.await??;
let is_mod_or_admin = blocking(context.pool(), move |conn| {
CommunityView::is_mod_or_admin(conn, actor.id, community.id)
})
.await?;
if !is_mod_or_admin {
return Err(anyhow!("Not a mod").into());
}
Ok(())
}
/// For Add/Remove community moderator activities, check that the target field actually contains /// For Add/Remove community moderator activities, check that the target field actually contains
/// /c/community/moderators. Any different values are unsupported. /// /c/community/moderators. Any different values are unsupported.
fn verify_add_remove_moderator_target(target: &Url, community: Url) -> Result<(), LemmyError> { fn verify_add_remove_moderator_target(target: &Url, community: Url) -> Result<(), LemmyError> {

View file

@ -2,7 +2,7 @@ use crate::activities::community::send_websocket_message;
use activitystreams::activity::kind::RemoveType; use activitystreams::activity::kind::RemoveType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::check_is_apub_id_valid; use lemmy_apub::check_is_apub_id_valid;
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{source::community::Community_, ApubObject}; use lemmy_db_queries::{source::community::Community_, ApubObject};
use lemmy_db_schema::source::community::Community; use lemmy_db_schema::source::community::Community;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -22,7 +22,7 @@ pub struct RemoveCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for RemoveCommunity { impl ActivityHandler for RemoveCommunity {
async fn verify(&self, _context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> { async fn verify(&self, _context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> {
verify_domains_match(&self.common.actor, self.common.id_unchecked())?; verify_domains_match(&self.common.actor, self.common.id_unchecked())?;
check_is_apub_id_valid(&self.common.actor, false)?; check_is_apub_id_valid(&self.common.actor, false)?;

View file

@ -6,7 +6,7 @@ use lemmy_apub::{
fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person}, fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person},
CommunityType, CommunityType,
}; };
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::Joinable; use lemmy_db_queries::Joinable;
use lemmy_db_schema::source::community::{CommunityModerator, CommunityModeratorForm}; use lemmy_db_schema::source::community::{CommunityModerator, CommunityModeratorForm};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -27,7 +27,7 @@ pub struct RemoveMod {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for RemoveMod { impl ActivityHandler for RemoveMod {
async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> { async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> {
verify_domains_match(&self.common.actor, self.common.id_unchecked())?; verify_domains_match(&self.common.actor, self.common.id_unchecked())?;
verify_domains_match(&self.target, &self.cc[0])?; verify_domains_match(&self.target, &self.cc[0])?;

View file

@ -10,7 +10,7 @@ use lemmy_apub::fetcher::{
community::get_or_fetch_and_upsert_community, community::get_or_fetch_and_upsert_community,
person::get_or_fetch_and_upsert_person, person::get_or_fetch_and_upsert_person,
}; };
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::Bannable; use lemmy_db_queries::Bannable;
use lemmy_db_schema::source::community::{CommunityPersonBan, CommunityPersonBanForm}; use lemmy_db_schema::source::community::{CommunityPersonBan, CommunityPersonBanForm};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -30,7 +30,7 @@ pub struct UndoBlockUserFromCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoBlockUserFromCommunity { impl ActivityHandler for UndoBlockUserFromCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,7 +1,6 @@
use crate::activities::community::{ use crate::activities::{
delete::DeleteCommunity, community::{delete::DeleteCommunity, send_websocket_message},
send_websocket_message, verify_mod_action,
verify_is_community_mod,
}; };
use activitystreams::activity::kind::DeleteType; use activitystreams::activity::kind::DeleteType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
@ -11,7 +10,7 @@ use lemmy_apub::{
ActorType, ActorType,
CommunityType, CommunityType,
}; };
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{source::community::Community_, ApubObject}; use lemmy_db_queries::{source::community::Community_, ApubObject};
use lemmy_db_schema::source::community::Community; use lemmy_db_schema::source::community::Community;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -34,7 +33,7 @@ pub struct UndoDeleteCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoDeleteCommunity { impl ActivityHandler for UndoDeleteCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,
@ -50,7 +49,7 @@ impl ActivityHandlerNew for UndoDeleteCommunity {
if let Ok(c) = community { if let Ok(c) = community {
verify_domains_match(&self.object.object, &self.cc[0])?; verify_domains_match(&self.object.object, &self.cc[0])?;
check_is_apub_id_valid(&self.common.actor, false)?; check_is_apub_id_valid(&self.common.actor, false)?;
verify_is_community_mod(self.common.actor.clone(), c.actor_id(), context).await?; verify_mod_action(&self.common.actor, c.actor_id(), context).await?;
} }
// community action sent to followers // community action sent to followers
else { else {

View file

@ -2,7 +2,7 @@ use crate::activities::community::{remove::RemoveCommunity, send_websocket_messa
use activitystreams::activity::kind::RemoveType; use activitystreams::activity::kind::RemoveType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{check_is_apub_id_valid, fetcher::community::get_or_fetch_and_upsert_community}; use lemmy_apub::{check_is_apub_id_valid, fetcher::community::get_or_fetch_and_upsert_community};
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::source::community::Community_; use lemmy_db_queries::source::community::Community_;
use lemmy_db_schema::source::community::Community; use lemmy_db_schema::source::community::Community;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -22,7 +22,7 @@ pub struct UndoRemoveCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoRemoveCommunity { impl ActivityHandler for UndoRemoveCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,8 +1,8 @@
use crate::activities::community::{send_websocket_message, verify_is_community_mod}; use crate::activities::{community::send_websocket_message, verify_mod_action};
use activitystreams::{activity::kind::UpdateType, base::BaseExt}; use activitystreams::{activity::kind::UpdateType, base::BaseExt};
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{check_is_apub_id_valid, objects::FromApubToForm, GroupExt}; use lemmy_apub::{check_is_apub_id_valid, objects::FromApubToForm, GroupExt};
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{ApubObject, Crud}; use lemmy_db_queries::{ApubObject, Crud};
use lemmy_db_schema::source::community::{Community, CommunityForm}; use lemmy_db_schema::source::community::{Community, CommunityForm};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -24,12 +24,12 @@ pub struct UpdateCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UpdateCommunity { impl ActivityHandler for UpdateCommunity {
async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> { async fn verify(&self, context: &LemmyContext, _: &mut i32) -> Result<(), LemmyError> {
verify_domains_match(&self.common.actor, self.common.id_unchecked())?; verify_domains_match(&self.common.actor, self.common.id_unchecked())?;
self.object.id(self.cc[0].as_str())?; self.object.id(self.cc[0].as_str())?;
check_is_apub_id_valid(&self.common.actor, false)?; check_is_apub_id_valid(&self.common.actor, false)?;
verify_is_community_mod(self.common.actor.clone(), self.cc[0].clone(), context).await verify_mod_action(&self.common.actor, self.cc[0].clone(), context).await
} }
async fn receive( async fn receive(

View file

@ -5,7 +5,7 @@ use lemmy_apub::fetcher::{
community::get_or_fetch_and_upsert_community, community::get_or_fetch_and_upsert_community,
person::get_or_fetch_and_upsert_person, person::get_or_fetch_and_upsert_person,
}; };
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler};
use lemmy_db_queries::Followable; use lemmy_db_queries::Followable;
use lemmy_db_schema::source::community::CommunityFollower; use lemmy_db_schema::source::community::CommunityFollower;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -25,7 +25,7 @@ pub struct AcceptFollowCommunity {
/// Handle accepted follows /// Handle accepted follows
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for AcceptFollowCommunity { impl ActivityHandler for AcceptFollowCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -9,7 +9,7 @@ use lemmy_apub::{
fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person}, fetcher::{community::get_or_fetch_and_upsert_community, person::get_or_fetch_and_upsert_person},
CommunityType, CommunityType,
}; };
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler};
use lemmy_db_queries::Followable; use lemmy_db_queries::Followable;
use lemmy_db_schema::source::community::{CommunityFollower, CommunityFollowerForm}; use lemmy_db_schema::source::community::{CommunityFollower, CommunityFollowerForm};
use lemmy_utils::{location_info, LemmyError}; use lemmy_utils::{location_info, LemmyError};
@ -28,7 +28,7 @@ pub struct FollowCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for FollowCommunity { impl ActivityHandler for FollowCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -5,7 +5,7 @@ use lemmy_apub::fetcher::{
community::get_or_fetch_and_upsert_community, community::get_or_fetch_and_upsert_community,
person::get_or_fetch_and_upsert_person, person::get_or_fetch_and_upsert_person,
}; };
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler};
use lemmy_db_queries::Followable; use lemmy_db_queries::Followable;
use lemmy_db_schema::source::community::{CommunityFollower, CommunityFollowerForm}; use lemmy_db_schema::source::community::{CommunityFollower, CommunityFollowerForm};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -24,7 +24,7 @@ pub struct UndoFollowCommunity {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoFollowCommunity { impl ActivityHandler for UndoFollowCommunity {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -10,12 +10,7 @@ use lemmy_apub::{
ActorType, ActorType,
PageExt, PageExt,
}; };
use lemmy_apub_lib::{ use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler, PublicUrl};
verify_domains_match_opt,
ActivityCommonFields,
ActivityHandlerNew,
PublicUrl,
};
use lemmy_db_schema::source::post::Post; use lemmy_db_schema::source::post::Post;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{LemmyContext, UserOperationCrud}; use lemmy_websocket::{LemmyContext, UserOperationCrud};
@ -34,7 +29,7 @@ pub struct CreatePost {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for CreatePost { impl ActivityHandler for CreatePost {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -12,12 +12,7 @@ use lemmy_apub::{
ActorType, ActorType,
PageExt, PageExt,
}; };
use lemmy_apub_lib::{ use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler, PublicUrl};
verify_domains_match_opt,
ActivityCommonFields,
ActivityHandlerNew,
PublicUrl,
};
use lemmy_db_queries::ApubObject; use lemmy_db_queries::ApubObject;
use lemmy_db_schema::{ use lemmy_db_schema::{
source::post::{Post, PostForm}, source::post::{Post, PostForm},
@ -40,7 +35,7 @@ pub struct UpdatePost {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UpdatePost { impl ActivityHandler for UpdatePost {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -11,7 +11,7 @@ use lemmy_apub::{
ActorType, ActorType,
PostOrComment, PostOrComment,
}; };
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::{ use lemmy_db_queries::{
source::{comment::Comment_, post::Post_}, source::{comment::Comment_, post::Post_},
Crud, Crud,
@ -34,7 +34,7 @@ pub struct DeletePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for DeletePostOrComment { impl ActivityHandler for DeletePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -4,7 +4,7 @@ use crate::activities::{
verify_person_in_community, verify_person_in_community,
}; };
use activitystreams::activity::kind::DislikeType; use activitystreams::activity::kind::DislikeType;
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
@ -22,7 +22,7 @@ pub struct DislikePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for DislikePostOrComment { impl ActivityHandler for DislikePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -4,7 +4,7 @@ use crate::activities::{
verify_person_in_community, verify_person_in_community,
}; };
use activitystreams::activity::kind::LikeType; use activitystreams::activity::kind::LikeType;
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
@ -22,7 +22,7 @@ pub struct LikePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for LikePostOrComment { impl ActivityHandler for LikePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -8,7 +8,7 @@ use crate::activities::{
use activitystreams::activity::kind::RemoveType; use activitystreams::activity::kind::RemoveType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment}; use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment};
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::source::{comment::Comment_, post::Post_}; use lemmy_db_queries::source::{comment::Comment_, post::Post_};
use lemmy_db_schema::source::{comment::Comment, post::Post}; use lemmy_db_schema::source::{comment::Comment, post::Post};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -28,7 +28,7 @@ pub struct RemovePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for RemovePostOrComment { impl ActivityHandler for RemovePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -8,7 +8,7 @@ use crate::activities::{
use activitystreams::activity::kind::UndoType; use activitystreams::activity::kind::UndoType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment}; use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment};
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::source::{comment::Comment_, post::Post_}; use lemmy_db_queries::source::{comment::Comment_, post::Post_};
use lemmy_db_schema::source::{comment::Comment, post::Post}; use lemmy_db_schema::source::{comment::Comment, post::Post};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -28,7 +28,7 @@ pub struct UndoDeletePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoDeletePostOrComment { impl ActivityHandler for UndoDeletePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -4,7 +4,7 @@ use crate::activities::{
verify_person_in_community, verify_person_in_community,
}; };
use activitystreams::activity::kind::UndoType; use activitystreams::activity::kind::UndoType;
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
@ -22,7 +22,7 @@ pub struct UndoDislikePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoDislikePostOrComment { impl ActivityHandler for UndoDislikePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -4,7 +4,7 @@ use crate::activities::{
verify_person_in_community, verify_person_in_community,
}; };
use activitystreams::activity::kind::UndoType; use activitystreams::activity::kind::UndoType;
use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{verify_urls_match, ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use url::Url; use url::Url;
@ -22,7 +22,7 @@ pub struct UndoLikePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoLikePostOrComment { impl ActivityHandler for UndoLikePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -9,7 +9,7 @@ use crate::activities::{
use activitystreams::activity::kind::UndoType; use activitystreams::activity::kind::UndoType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment}; use lemmy_apub::{fetcher::objects::get_or_fetch_and_insert_post_or_comment, PostOrComment};
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew, PublicUrl}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler, PublicUrl};
use lemmy_db_queries::source::{comment::Comment_, post::Post_}; use lemmy_db_queries::source::{comment::Comment_, post::Post_};
use lemmy_db_schema::source::{comment::Comment, post::Post}; use lemmy_db_schema::source::{comment::Comment, post::Post};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -29,7 +29,7 @@ pub struct UndoRemovePostOrComment {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoRemovePostOrComment { impl ActivityHandler for UndoRemovePostOrComment {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,7 +1,7 @@
use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person}; use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person};
use activitystreams::{activity::kind::CreateType, base::BaseExt}; use activitystreams::{activity::kind::CreateType, base::BaseExt};
use lemmy_apub::{objects::FromApub, NoteExt}; use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler};
use lemmy_db_schema::source::private_message::PrivateMessage; use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{LemmyContext, UserOperationCrud}; use lemmy_websocket::{LemmyContext, UserOperationCrud};
@ -19,7 +19,7 @@ pub struct CreatePrivateMessage {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for CreatePrivateMessage { impl ActivityHandler for CreatePrivateMessage {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,7 +1,7 @@
use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person}; use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person};
use activitystreams::activity::kind::DeleteType; use activitystreams::activity::kind::DeleteType;
use lemmy_api_common::blocking; use lemmy_api_common::blocking;
use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_domains_match, ActivityCommonFields, ActivityHandler};
use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject}; use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject};
use lemmy_db_schema::source::private_message::PrivateMessage; use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
@ -20,7 +20,7 @@ pub struct DeletePrivateMessage {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for DeletePrivateMessage { impl ActivityHandler for DeletePrivateMessage {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -9,7 +9,7 @@ use lemmy_apub_lib::{
verify_domains_match, verify_domains_match,
verify_urls_match, verify_urls_match,
ActivityCommonFields, ActivityCommonFields,
ActivityHandlerNew, ActivityHandler,
}; };
use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject}; use lemmy_db_queries::{source::private_message::PrivateMessage_, ApubObject};
use lemmy_db_schema::source::private_message::PrivateMessage; use lemmy_db_schema::source::private_message::PrivateMessage;
@ -29,7 +29,7 @@ pub struct UndoDeletePrivateMessage {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UndoDeletePrivateMessage { impl ActivityHandler for UndoDeletePrivateMessage {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -1,7 +1,7 @@
use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person}; use crate::activities::{private_message::send_websocket_message, verify_activity, verify_person};
use activitystreams::{activity::kind::UpdateType, base::BaseExt}; use activitystreams::{activity::kind::UpdateType, base::BaseExt};
use lemmy_apub::{objects::FromApub, NoteExt}; use lemmy_apub::{objects::FromApub, NoteExt};
use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{verify_domains_match_opt, ActivityCommonFields, ActivityHandler};
use lemmy_db_schema::source::private_message::PrivateMessage; use lemmy_db_schema::source::private_message::PrivateMessage;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::{LemmyContext, UserOperationCrud}; use lemmy_websocket::{LemmyContext, UserOperationCrud};
@ -19,7 +19,7 @@ pub struct UpdatePrivateMessage {
} }
#[async_trait::async_trait(?Send)] #[async_trait::async_trait(?Send)]
impl ActivityHandlerNew for UpdatePrivateMessage { impl ActivityHandler for UpdatePrivateMessage {
async fn verify( async fn verify(
&self, &self,
context: &LemmyContext, context: &LemmyContext,

View file

@ -31,12 +31,12 @@ use crate::activities::{
update::UpdatePrivateMessage, update::UpdatePrivateMessage,
}, },
}; };
use lemmy_apub_lib::{ActivityCommonFields, ActivityHandlerNew}; use lemmy_apub_lib::{ActivityCommonFields, ActivityHandler};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize, ActivityHandlerNew)] #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
#[serde(untagged)] #[serde(untagged)]
pub enum PersonInboxActivities { pub enum PersonInboxActivities {
AcceptFollowCommunity(AcceptFollowCommunity), AcceptFollowCommunity(AcceptFollowCommunity),
@ -47,7 +47,7 @@ pub enum PersonInboxActivities {
AnnounceActivity(Box<AnnounceActivity>), AnnounceActivity(Box<AnnounceActivity>),
} }
#[derive(Clone, Debug, Deserialize, Serialize, ActivityHandlerNew)] #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
#[serde(untagged)] #[serde(untagged)]
pub enum GroupInboxActivities { pub enum GroupInboxActivities {
FollowCommunity(FollowCommunity), FollowCommunity(FollowCommunity),
@ -75,7 +75,7 @@ pub enum GroupInboxActivities {
RemoveMod(RemoveMod), RemoveMod(RemoveMod),
} }
#[derive(Clone, Debug, Deserialize, Serialize, ActivityHandlerNew)] #[derive(Clone, Debug, Deserialize, Serialize, ActivityHandler)]
#[serde(untagged)] #[serde(untagged)]
pub enum SharedInboxActivities { pub enum SharedInboxActivities {
// received by group // received by group

View file

@ -17,7 +17,7 @@ use lemmy_apub::{
insert_activity, insert_activity,
APUB_JSON_CONTENT_TYPE, APUB_JSON_CONTENT_TYPE,
}; };
use lemmy_apub_lib::ActivityHandlerNew; use lemmy_apub_lib::ActivityHandler;
use lemmy_db_queries::{source::activity::Activity_, DbPool}; use lemmy_db_queries::{source::activity::Activity_, DbPool};
use lemmy_db_schema::source::activity::Activity; use lemmy_db_schema::source::activity::Activity;
use lemmy_utils::{location_info, settings::structs::Settings, LemmyError}; use lemmy_utils::{location_info, settings::structs::Settings, LemmyError};
@ -26,11 +26,12 @@ use serde::{Deserialize, Serialize};
use std::{fmt::Debug, io::Read}; use std::{fmt::Debug, io::Read};
use url::Url; use url::Url;
pub mod comment; mod comment;
pub mod community; mod community;
pub mod inbox_enums; mod inbox_enums;
pub mod person; mod person;
pub mod post; mod post;
pub mod routes;
pub async fn shared_inbox( pub async fn shared_inbox(
request: HttpRequest, request: HttpRequest,
@ -58,7 +59,7 @@ async fn receive_activity<'a, T>(
context: web::Data<LemmyContext>, context: web::Data<LemmyContext>,
) -> Result<HttpResponse, LemmyError> ) -> Result<HttpResponse, LemmyError>
where where
T: ActivityHandlerNew + Clone + Deserialize<'a> + Serialize + std::fmt::Debug + Send + 'static, T: ActivityHandler + Clone + Deserialize<'a> + Serialize + std::fmt::Debug + Send + 'static,
{ {
let activity = serde_json::from_str::<T>(activity)?; let activity = serde_json::from_str::<T>(activity)?;
let activity_data = activity.common(); let activity_data = activity.common();
@ -167,9 +168,7 @@ pub(crate) async fn is_activity_already_known(
} }
} }
fn assert_activity_not_local<T: Debug + ActivityHandlerNew>( fn assert_activity_not_local<T: Debug + ActivityHandler>(activity: &T) -> Result<(), LemmyError> {
activity: &T,
) -> Result<(), LemmyError> {
let activity_domain = activity let activity_domain = activity
.common() .common()
.id_unchecked() .id_unchecked()

View file

@ -1,3 +1,2 @@
mod activities; mod activities;
mod http; pub mod http;
pub mod routes;

View file

@ -91,7 +91,7 @@ async fn main() -> Result<(), LemmyError> {
.app_data(Data::new(context)) .app_data(Data::new(context))
// The routes // The routes
.configure(|cfg| api_routes::config(cfg, &rate_limiter)) .configure(|cfg| api_routes::config(cfg, &rate_limiter))
.configure(lemmy_apub_receive::routes::config) .configure(lemmy_apub_receive::http::routes::config)
.configure(feeds::config) .configure(feeds::config)
.configure(|cfg| images::config(cfg, &rate_limiter)) .configure(|cfg| images::config(cfg, &rate_limiter))
.configure(nodeinfo::config) .configure(nodeinfo::config)