2021-07-27 22:18:50 +00:00
|
|
|
use crate::{check_is_apub_id_valid, CommunityType};
|
|
|
|
use itertools::Itertools;
|
2021-08-17 18:04:58 +00:00
|
|
|
use lemmy_db_schema::source::community::Community;
|
2021-07-27 22:18:50 +00:00
|
|
|
use lemmy_utils::{settings::structs::Settings, LemmyError};
|
2021-08-17 18:04:58 +00:00
|
|
|
use lemmy_websocket::LemmyContext;
|
2021-07-27 22:18:50 +00:00
|
|
|
use url::Url;
|
Apub inbox rewrite (#1652)
* start to implement apub inbox routing lib
* got something that almost works
* it compiles!
* implemented some more
* move library code to separate crate (most of it)
* convert private message handlers
* convert all comment receivers (except undo comment)
* convert post receiver
* add verify trait
* convert community receivers
* add cc field for all activities which i forgot before
* convert inbox functions, add missing checks
* convert undo like/dislike receivers
* convert undo_delete and undo_remove receivers
* move block/unblock activities
* convert remaining activity receivers
* reimplement http signature verification and other checks
* also use actor type for routing, VerifyActivity and SendActivity traits
* cleanup and restructure apub_receive code
* wip: try to fix activity routing
* implement a (very bad) derive macro for activityhandler
* working activity routing!
* rework pm verify(), fix tests and confirm manually
also remove inbox username check which was broken
* rework following verify(), fix tests and test manually
* fix post/comment create/update, rework voting
* Rewrite remove/delete post/comment, fix tests, test manually
* Rework and fix (un)block user, announce, update post
* some code cleanup
* rework delete/remove activity receivers (still quite messy)
* rewrite, test and fix add/remove mod, update community handlers
* add docs for ActivityHandler derive macro
* dont try to compile macro comments
2021-07-17 16:08:46 +00:00
|
|
|
|
|
|
|
pub mod add_mod;
|
|
|
|
pub mod announce;
|
|
|
|
pub mod block_user;
|
2021-08-19 21:24:33 +00:00
|
|
|
pub mod remove_mod;
|
Apub inbox rewrite (#1652)
* start to implement apub inbox routing lib
* got something that almost works
* it compiles!
* implemented some more
* move library code to separate crate (most of it)
* convert private message handlers
* convert all comment receivers (except undo comment)
* convert post receiver
* add verify trait
* convert community receivers
* add cc field for all activities which i forgot before
* convert inbox functions, add missing checks
* convert undo like/dislike receivers
* convert undo_delete and undo_remove receivers
* move block/unblock activities
* convert remaining activity receivers
* reimplement http signature verification and other checks
* also use actor type for routing, VerifyActivity and SendActivity traits
* cleanup and restructure apub_receive code
* wip: try to fix activity routing
* implement a (very bad) derive macro for activityhandler
* working activity routing!
* rework pm verify(), fix tests and confirm manually
also remove inbox username check which was broken
* rework following verify(), fix tests and test manually
* fix post/comment create/update, rework voting
* Rewrite remove/delete post/comment, fix tests, test manually
* Rework and fix (un)block user, announce, update post
* some code cleanup
* rework delete/remove activity receivers (still quite messy)
* rewrite, test and fix add/remove mod, update community handlers
* add docs for ActivityHandler derive macro
* dont try to compile macro comments
2021-07-17 16:08:46 +00:00
|
|
|
pub mod undo_block_user;
|
|
|
|
pub mod update;
|
|
|
|
|
2021-07-27 22:18:50 +00:00
|
|
|
async fn list_community_follower_inboxes(
|
|
|
|
community: &Community,
|
|
|
|
additional_inboxes: Vec<Url>,
|
|
|
|
context: &LemmyContext,
|
|
|
|
) -> Result<Vec<Url>, LemmyError> {
|
|
|
|
Ok(
|
|
|
|
vec![
|
|
|
|
community.get_follower_inboxes(context.pool()).await?,
|
|
|
|
additional_inboxes,
|
|
|
|
]
|
|
|
|
.iter()
|
|
|
|
.flatten()
|
|
|
|
.unique()
|
2021-08-04 21:13:51 +00:00
|
|
|
.filter(|inbox| inbox.host_str() != Some(&Settings::get().hostname))
|
2021-07-27 22:18:50 +00:00
|
|
|
.filter(|inbox| check_is_apub_id_valid(inbox, false).is_ok())
|
|
|
|
.map(|inbox| inbox.to_owned())
|
|
|
|
.collect(),
|
|
|
|
)
|
|
|
|
}
|