3 use activitystreams::error::DomainError;
4 pub use lemmy_apub_lib_derive::*;
5 use lemmy_utils::LemmyError;
6 use lemmy_websocket::LemmyContext;
9 pub trait ActivityFields {
10 fn id_unchecked(&self) -> &Url;
11 fn actor(&self) -> &Url;
12 fn cc(&self) -> Vec<Url>;
15 #[async_trait::async_trait(?Send)]
16 pub trait ActivityHandler {
19 context: &LemmyContext,
20 request_counter: &mut i32,
21 ) -> Result<(), LemmyError>;
25 context: &LemmyContext,
26 request_counter: &mut i32,
27 ) -> Result<(), LemmyError>;
30 pub fn verify_domains_match(a: &Url, b: &Url) -> Result<(), LemmyError> {
31 if a.domain() != b.domain() {
32 return Err(DomainError.into());
37 pub fn verify_urls_match(a: &Url, b: &Url) -> Result<(), LemmyError> {
39 return Err(DomainError.into());