"lemmy_db_views_actor",
"lemmy_db_views_moderator",
"lemmy_utils",
- "lemmy_websocket",
"serde",
"serde_json",
"serial_test",
name = "lemmy_api_common"
version = "0.16.5"
dependencies = [
+ "actix",
"actix-rt",
"actix-web",
+ "actix-web-actors",
+ "anyhow",
+ "background-jobs",
"chrono",
"diesel",
"encoding",
"lemmy_db_views_actor",
"lemmy_db_views_moderator",
"lemmy_utils",
+ "opentelemetry 0.17.0",
"percent-encoding",
+ "rand 0.8.5",
"regex",
"reqwest",
"reqwest-middleware",
"rosetta-i18n",
"serde",
+ "serde_json",
+ "strum",
+ "strum_macros",
+ "tokio",
"tracing",
+ "tracing-opentelemetry 0.17.4",
"url",
"webpage",
]
"lemmy_db_views",
"lemmy_db_views_actor",
"lemmy_utils",
- "lemmy_websocket",
"serde",
"serde_json",
"tracing",
"lemmy_db_views",
"lemmy_db_views_actor",
"lemmy_utils",
- "lemmy_websocket",
"once_cell",
"reqwest",
"reqwest-middleware",
"lemmy_db_views",
"lemmy_db_views_actor",
"lemmy_utils",
- "lemmy_websocket",
"once_cell",
"reqwest",
"reqwest-middleware",
"lemmy_db_schema",
"lemmy_routes",
"lemmy_utils",
- "lemmy_websocket",
"opentelemetry 0.17.0",
"opentelemetry-otlp",
"parking_lot",
"uuid",
]
-[[package]]
-name = "lemmy_websocket"
-version = "0.16.5"
-dependencies = [
- "actix",
- "actix-web",
- "actix-web-actors",
- "anyhow",
- "background-jobs",
- "chrono",
- "diesel",
- "lemmy_api_common",
- "lemmy_db_schema",
- "lemmy_db_views",
- "lemmy_db_views_actor",
- "lemmy_utils",
- "opentelemetry 0.17.0",
- "rand 0.8.5",
- "reqwest-middleware",
- "serde",
- "serde_json",
- "strum",
- "strum_macros",
- "tokio",
- "tracing",
- "tracing-opentelemetry 0.17.4",
-]
-
[[package]]
name = "lettre"
version = "0.10.1"
"crates/db_views",
"crates/db_views_actor",
"crates/db_views_actor",
- "crates/websocket",
"crates/routes"
]
lemmy_utils = { version = "=0.16.5", path = "./crates/utils" }
lemmy_db_schema = { version = "=0.16.5", path = "./crates/db_schema" }
lemmy_api_common = { version = "=0.16.5", path = "./crates/api_common" }
-lemmy_websocket = { version = "=0.16.5", path = "./crates/websocket" }
lemmy_routes = { version = "=0.16.5", path = "./crates/routes" }
lemmy_db_views = { version = "=0.16.5", path = "./crates/db_views" }
lemmy_db_views_actor = { version = "=0.16.5", path = "./crates/db_views_actor" }
lemmy_utils = { workspace = true }
lemmy_db_schema = { workspace = true }
lemmy_api_common = { workspace = true }
-lemmy_websocket = { workspace = true }
lemmy_routes = { workspace = true }
activitypub_federation = { workspace = true }
diesel = { workspace = true }
lemmy_db_views_moderator = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] }
-lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true }
diesel = { workspace = true }
bcrypt = { workspace = true }
use lemmy_api_common::{
comment::{CommentResponse, CreateCommentLike},
utils::{check_community_ban, check_downvotes_enabled, get_local_user_view_from_jwt},
+ websocket::{send::send_comment_ws_message, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
fetcher::post_or_comment::PostOrComment,
};
use lemmy_db_views::structs::{CommentView, LocalUserView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperation};
use std::convert::TryInto;
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
comment::{CommentResponse, SaveComment},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::{
source::comment::{CommentSaved, CommentSavedForm},
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for SaveComment {
use lemmy_api_common::{
comment::{CommentReportResponse, CreateCommentReport},
utils::{check_community_ban, get_local_user_view_from_jwt},
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_db_schema::{
};
use lemmy_db_views::structs::{CommentReportView, CommentView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a comment report and notifies the moderators of the community
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
comment::{ListCommentReports, ListCommentReportsResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views::comment_report_view::CommentReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
/// Lists comment reports for a community if an id is supplied
/// or returns all comment reports for communities a user moderates
use lemmy_api_common::{
comment::{CommentReportResponse, ResolveCommentReport},
utils::{get_local_user_view_from_jwt, is_mod_or_admin},
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{source::comment_report::CommentReport, traits::Reportable};
use lemmy_db_views::structs::CommentReportView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a comment report and notifies the moderators of the community
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
community::{AddModToCommunity, AddModToCommunityResponse},
utils::{get_local_user_view_from_jwt, is_mod_or_admin},
+ websocket::{messages::SendCommunityRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
objects::{community::ApubCommunity, person::ApubPerson},
};
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for AddModToCommunity {
use lemmy_api_common::{
community::{BanFromCommunity, BanFromCommunityResponse},
utils::{get_local_user_view_from_jwt, is_mod_or_admin, remove_user_data_in_community},
+ websocket::{messages::SendCommunityRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
activities::block::SiteOrCommunity,
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
-use lemmy_websocket::{messages::SendCommunityRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for BanFromCommunity {
use lemmy_api_common::{
community::{BlockCommunity, BlockCommunityResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_apub::protocol::activities::following::undo_follow::UndoFollow;
use lemmy_db_schema::{
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for BlockCommunity {
use lemmy_api_common::{
community::{CommunityResponse, FollowCommunity},
utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt},
+ LemmyContext,
};
use lemmy_apub::{
objects::community::ApubCommunity,
};
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for FollowCommunity {
use lemmy_api_common::{
community::{CommunityResponse, HideCommunity},
utils::{get_local_user_view_from_jwt, is_admin},
+ websocket::{send::send_community_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::community::update::UpdateCommunity;
use lemmy_db_schema::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl Perform for HideCommunity {
use lemmy_api_common::{
community::{GetCommunityResponse, TransferCommunity},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, location_info, ConnectionId};
-use lemmy_websocket::LemmyContext;
// TODO: we dont do anything for federation here, it should be updated the next time the community
// gets fetched. i hope we can get rid of the community creator role soon.
Search,
},
utils::local_site_to_slur_regex,
- websocket::{CommunityJoin, ModJoin, PostJoin, UserJoin},
+ websocket::{
+ serialize_websocket_message,
+ structs::{CommunityJoin, ModJoin, PostJoin, UserJoin},
+ UserOperation,
+ },
+ LemmyContext,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_utils::{error::LemmyError, utils::check_slurs, ConnectionId};
-use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperation};
use serde::Deserialize;
mod comment;
use lemmy_api_common::{
person::{AddAdmin, AddAdminResponse},
utils::{get_local_user_view_from_jwt, is_admin},
+ websocket::{messages::SendAllMessage, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for AddAdmin {
use lemmy_api_common::{
person::{BanPerson, BanPersonResponse},
utils::{get_local_user_view_from_jwt, is_admin, remove_user_data},
+ websocket::{messages::SendAllMessage, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
activities::block::SiteOrCommunity,
use lemmy_db_views::structs::SiteView;
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
-use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for BanPerson {
use lemmy_api_common::{
person::{BlockPerson, BlockPersonResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::{
source::person_block::{PersonBlock, PersonBlockForm},
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for BlockPerson {
use lemmy_api_common::{
person::{ChangePassword, LoginResponse},
utils::{get_local_user_view_from_jwt, password_length_check},
+ LemmyContext,
};
use lemmy_db_schema::source::local_user::LocalUser;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for ChangePassword {
use lemmy_api_common::{
person::{LoginResponse, PasswordChangeAfterReset},
utils::password_length_check,
+ LemmyContext,
};
use lemmy_db_schema::source::{
local_user::LocalUser,
};
use lemmy_db_views::structs::SiteView;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PasswordChangeAfterReset {
use actix_web::web::Data;
use captcha::{gen, Difficulty};
use chrono::Duration;
-use lemmy_api_common::person::{CaptchaResponse, GetCaptcha, GetCaptchaResponse};
+use lemmy_api_common::{
+ person::{CaptchaResponse, GetCaptcha, GetCaptchaResponse},
+ websocket::messages::CaptchaItem,
+ LemmyContext,
+};
use lemmy_db_schema::{source::local_site::LocalSite, utils::naive_now};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::CaptchaItem, LemmyContext};
#[async_trait::async_trait(?Send)]
impl Perform for GetCaptcha {
use lemmy_api_common::{
person::{BannedPersonsResponse, GetBannedPersons},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetBannedPersons {
use lemmy_api_common::{
person::{Login, LoginResponse},
utils::{check_registration_application, check_user_valid},
+ LemmyContext,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for Login {
use lemmy_api_common::{
person::{GetPersonMentions, GetPersonMentionsResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views_actor::person_mention_view::PersonMentionQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetPersonMentions {
use lemmy_api_common::{
person::{GetReplies, GetRepliesResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views_actor::comment_reply_view::CommentReplyQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetReplies {
use lemmy_api_common::{
person::{GetRepliesResponse, MarkAllAsRead},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::source::{
comment_reply::CommentReply,
private_message::PrivateMessage,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for MarkAllAsRead {
use lemmy_api_common::{
person::{MarkPersonMentionAsRead, PersonMentionResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::{
source::person_mention::{PersonMention, PersonMentionUpdateForm},
};
use lemmy_db_views_actor::structs::PersonMentionView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for MarkPersonMentionAsRead {
use lemmy_api_common::{
person::{CommentReplyResponse, MarkCommentReplyAsRead},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::{
source::comment_reply::{CommentReply, CommentReplyUpdateForm},
};
use lemmy_db_views_actor::structs::CommentReplyView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for MarkCommentReplyAsRead {
use lemmy_api_common::{
person::{GetUnreadCount, GetUnreadCountResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views::structs::PrivateMessageView;
use lemmy_db_views_actor::structs::{CommentReplyView, PersonMentionView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetUnreadCount {
use lemmy_api_common::{
person::{GetReportCount, GetReportCountResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views::structs::{CommentReportView, PostReportView, PrivateMessageReportView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetReportCount {
use lemmy_api_common::{
person::{PasswordReset, PasswordResetResponse},
utils::send_password_reset_email,
+ LemmyContext,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PasswordReset {
use lemmy_api_common::{
person::{LoginResponse, SaveUserSettings},
utils::{get_local_user_view_from_jwt, send_verification_email},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
utils::{is_valid_display_name, is_valid_matrix_id},
ConnectionId,
};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for SaveUserSettings {
use lemmy_api_common::{
person::{VerifyEmail, VerifyEmailResponse},
utils::send_email_verification_success,
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for VerifyEmail {
use lemmy_api_common::{
post::{GetSiteMetadata, GetSiteMetadataResponse},
request::fetch_site_metadata,
+ LemmyContext,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetSiteMetadata {
get_local_user_view_from_jwt,
mark_post_as_read,
},
+ websocket::{send::send_post_ws_message, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
fetcher::post_or_comment::PostOrComment,
traits::{Crud, Likeable},
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for CreatePostLike {
get_local_user_view_from_jwt,
is_mod_or_admin,
},
+ websocket::{send::send_post_ws_message, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
objects::post::ApubPost,
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for LockPost {
use lemmy_api_common::{
post::{MarkPostAsRead, PostResponse},
utils::{get_local_user_view_from_jwt, mark_post_as_read, mark_post_as_unread},
+ LemmyContext,
};
use lemmy_db_views::structs::PostView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for MarkPostAsRead {
use lemmy_api_common::{
post::{PostResponse, SavePost},
utils::{get_local_user_view_from_jwt, mark_post_as_read},
+ LemmyContext,
};
use lemmy_db_schema::{
source::post::{PostSaved, PostSavedForm},
};
use lemmy_db_views::structs::PostView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for SavePost {
get_local_user_view_from_jwt,
is_mod_or_admin,
},
+ websocket::{send::send_post_ws_message, UserOperation},
+ LemmyContext,
};
use lemmy_apub::{
objects::post::ApubPost,
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for StickyPost {
use lemmy_api_common::{
post::{CreatePostReport, PostReportResponse},
utils::{check_community_ban, get_local_user_view_from_jwt},
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::community::report::Report;
use lemmy_db_schema::{
};
use lemmy_db_views::structs::{PostReportView, PostView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Creates a post report and notifies the moderators of the community
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
post::{ListPostReports, ListPostReportsResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_views::post_report_view::PostReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
/// Lists post reports for a community if an id is supplied
/// or returns all post reports for communities a user moderates
use lemmy_api_common::{
post::{PostReportResponse, ResolvePostReport},
utils::{get_local_user_view_from_jwt, is_mod_or_admin},
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{source::post_report::PostReport, traits::Reportable};
use lemmy_db_views::structs::PostReportView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
/// Resolves or unresolves a post report and notifies the moderators of the community
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
private_message::{MarkPrivateMessageAsRead, PrivateMessageResponse},
utils::get_local_user_view_from_jwt,
+ websocket::{send::send_pm_ws_message, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{
source::private_message::{PrivateMessage, PrivateMessageUpdateForm},
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for MarkPrivateMessageAsRead {
use lemmy_api_common::{
private_message::{CreatePrivateMessageReport, PrivateMessageReportResponse},
utils::get_local_user_view_from_jwt,
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{
newtypes::CommunityId,
};
use lemmy_db_views::structs::PrivateMessageReportView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for CreatePrivateMessageReport {
use lemmy_api_common::{
private_message::{ListPrivateMessageReports, ListPrivateMessageReportsResponse},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_views::private_message_report_view::PrivateMessageReportQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for ListPrivateMessageReports {
use lemmy_api_common::{
private_message::{PrivateMessageReportResponse, ResolvePrivateMessageReport},
utils::{get_local_user_view_from_jwt, is_admin},
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
};
use lemmy_db_schema::{
newtypes::CommunityId,
};
use lemmy_db_views::structs::PrivateMessageReportView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
#[async_trait::async_trait(?Send)]
impl Perform for ResolvePrivateMessageReport {
use lemmy_api_common::{
site::{GetSiteResponse, LeaveAdmin},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
use lemmy_db_views::structs::SiteView;
use lemmy_db_views_actor::structs::PersonViewSafe;
use lemmy_utils::{error::LemmyError, version, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for LeaveAdmin {
use lemmy_api_common::{
site::{GetModlog, GetModlogResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt, is_admin, is_mod_or_admin},
+ LemmyContext,
};
use lemmy_db_schema::{
newtypes::{CommunityId, PersonId},
ModlogListParams,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
use ModlogActionType::*;
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
site::{PurgeComment, PurgeItemResponse},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PurgeComment {
request::purge_image_from_pictrs,
site::{PurgeCommunity, PurgeItemResponse},
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_community},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PurgeCommunity {
request::purge_image_from_pictrs,
site::{PurgeItemResponse, PurgePerson},
utils::{get_local_user_view_from_jwt, is_admin, purge_image_posts_for_person},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PurgePerson {
request::purge_image_from_pictrs,
site::{PurgeItemResponse, PurgePost},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for PurgePost {
use lemmy_api_common::{
site::{ApproveRegistrationApplication, RegistrationApplicationResponse},
utils::{get_local_user_view_from_jwt, is_admin, send_application_approved_email},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
};
use lemmy_db_views::structs::{LocalUserView, RegistrationApplicationView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for ApproveRegistrationApplication {
use lemmy_api_common::{
site::{ListRegistrationApplications, ListRegistrationApplicationsResponse},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::registration_application_view::RegistrationApplicationQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
/// Lists registration applications, filterable by undenied only.
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
site::{GetUnreadRegistrationApplicationCount, GetUnreadRegistrationApplicationCountResponse},
utils::{get_local_user_view_from_jwt, is_admin},
+ LemmyContext,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::RegistrationApplicationView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for GetUnreadRegistrationApplicationCount {
use lemmy_api_common::{
site::{ResolveObject, ResolveObjectResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ LemmyContext,
};
use lemmy_apub::fetcher::search::{search_query_to_object_id, SearchableObjects};
use lemmy_db_schema::{newtypes::PersonId, source::local_site::LocalSite, utils::DbPool};
use lemmy_db_views::structs::{CommentView, PostView};
use lemmy_db_views_actor::structs::{CommunityView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for ResolveObject {
use lemmy_api_common::{
site::{Search, SearchResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ LemmyContext,
};
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{
use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery};
use lemmy_db_views_actor::{community_view::CommunityQuery, person_view::PersonQuery};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl Perform for Search {
use lemmy_api_common::{
utils::get_local_user_view_from_jwt,
websocket::{
- CommunityJoin,
- CommunityJoinResponse,
- ModJoin,
- ModJoinResponse,
- PostJoin,
- PostJoinResponse,
- UserJoin,
- UserJoinResponse,
+ messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
+ structs::{
+ CommunityJoin,
+ CommunityJoinResponse,
+ ModJoin,
+ ModJoinResponse,
+ PostJoin,
+ PostJoinResponse,
+ UserJoin,
+ UserJoinResponse,
+ },
},
-};
-use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{
- messages::{JoinCommunityRoom, JoinModRoom, JoinPostRoom, JoinUserRoom},
LemmyContext,
};
+use lemmy_utils::{error::LemmyError, ConnectionId};
#[async_trait::async_trait(?Send)]
impl Perform for UserJoin {
percent-encoding = { workspace = true, optional = true }
webpage = { version = "1.4.0", default-features = false, features = ["serde"], optional = true }
encoding = { version = "0.2.33", optional = true }
+rand = { workspace = true }
+serde_json = { workspace = true }
+actix = { workspace = true }
+anyhow = { workspace = true }
+tokio = { workspace = true }
+strum = { workspace = true }
+strum_macros = { workspace = true }
+opentelemetry = { workspace = true }
+tracing-opentelemetry = { workspace = true }
+actix-web-actors = { version = "4.1.0", default-features = false }
+background-jobs = "0.13.0"
[dev-dependencies]
actix-rt = { workspace = true }
pub mod utils;
pub mod websocket;
+#[macro_use]
+extern crate strum_macros;
pub extern crate lemmy_db_schema;
pub extern crate lemmy_db_views;
pub extern crate lemmy_db_views_actor;
pub extern crate lemmy_db_views_moderator;
+
+use crate::websocket::chat_server::ChatServer;
+use actix::Addr;
+use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
+use lemmy_utils::{
+ rate_limit::RateLimitCell,
+ settings::{structs::Settings, SETTINGS},
+};
+use reqwest_middleware::ClientWithMiddleware;
+
+pub struct LemmyContext {
+ pool: DbPool,
+ chat_server: Addr<ChatServer>,
+ client: ClientWithMiddleware,
+ settings: Settings,
+ secret: Secret,
+ rate_limit_cell: RateLimitCell,
+}
+
+impl LemmyContext {
+ pub fn create(
+ pool: DbPool,
+ chat_server: Addr<ChatServer>,
+ client: ClientWithMiddleware,
+ settings: Settings,
+ secret: Secret,
+ settings_updated_channel: RateLimitCell,
+ ) -> LemmyContext {
+ LemmyContext {
+ pool,
+ chat_server,
+ client,
+ settings,
+ secret,
+ rate_limit_cell: settings_updated_channel,
+ }
+ }
+ pub fn pool(&self) -> &DbPool {
+ &self.pool
+ }
+ pub fn chat_server(&self) -> &Addr<ChatServer> {
+ &self.chat_server
+ }
+ pub fn client(&self) -> &ClientWithMiddleware {
+ &self.client
+ }
+ pub fn settings(&self) -> &'static Settings {
+ &SETTINGS
+ }
+ pub fn secret(&self) -> &Secret {
+ &self.secret
+ }
+ pub fn settings_updated_channel(&self) -> &RateLimitCell {
+ &self.rate_limit_cell
+ }
+}
+
+impl Clone for LemmyContext {
+ fn clone(&self) -> Self {
+ LemmyContext {
+ pool: self.pool.clone(),
+ chat_server: self.chat_server.clone(),
+ client: self.client.clone(),
+ settings: self.settings.clone(),
+ secret: self.secret.clone(),
+ rate_limit_cell: self.rate_limit_cell.clone(),
+ }
+ }
+}
use crate::{
- messages::{CaptchaItem, StandardMessage, WsMessage},
- serialize_websocket_message,
+ comment::CommentResponse,
+ post::PostResponse,
+ websocket::{
+ messages::{CaptchaItem, StandardMessage, WsMessage},
+ serialize_websocket_message,
+ OperationType,
+ UserOperation,
+ UserOperationCrud,
+ },
LemmyContext,
- OperationType,
- UserOperation,
- UserOperationCrud,
};
use actix::prelude::*;
use anyhow::Context as acontext;
-use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
use lemmy_db_schema::{
newtypes::{CommunityId, LocalUserId, PostId},
source::secret::Secret,
-use crate::{
+use crate::websocket::{
chat_server::{ChatServer, SessionInfo},
messages::{
CaptchaItem,
-use crate::UserOperation;
+use crate::{comment::CommentResponse, post::PostResponse, websocket::UserOperation};
use actix::{prelude::*, Recipient};
-use lemmy_api_common::{comment::CommentResponse, post::PostResponse};
use lemmy_db_schema::newtypes::{CommunityId, LocalUserId, PostId};
use lemmy_utils::{ConnectionId, IpAddr};
use serde::{Deserialize, Serialize};
-#[macro_use]
-extern crate strum_macros;
-
-use crate::chat_server::ChatServer;
-use actix::Addr;
-use lemmy_db_schema::{source::secret::Secret, utils::DbPool};
-use lemmy_utils::{
- error::LemmyError,
- rate_limit::RateLimitCell,
- settings::{structs::Settings, SETTINGS},
-};
-use reqwest_middleware::ClientWithMiddleware;
+use lemmy_utils::error::LemmyError;
use serde::Serialize;
pub mod chat_server;
pub mod messages;
pub mod routes;
pub mod send;
-
-pub struct LemmyContext {
- pool: DbPool,
- chat_server: Addr<ChatServer>,
- client: ClientWithMiddleware,
- settings: Settings,
- secret: Secret,
- rate_limit_cell: RateLimitCell,
-}
-
-impl LemmyContext {
- pub fn create(
- pool: DbPool,
- chat_server: Addr<ChatServer>,
- client: ClientWithMiddleware,
- settings: Settings,
- secret: Secret,
- settings_updated_channel: RateLimitCell,
- ) -> LemmyContext {
- LemmyContext {
- pool,
- chat_server,
- client,
- settings,
- secret,
- rate_limit_cell: settings_updated_channel,
- }
- }
- pub fn pool(&self) -> &DbPool {
- &self.pool
- }
- pub fn chat_server(&self) -> &Addr<ChatServer> {
- &self.chat_server
- }
- pub fn client(&self) -> &ClientWithMiddleware {
- &self.client
- }
- pub fn settings(&self) -> &'static Settings {
- &SETTINGS
- }
- pub fn secret(&self) -> &Secret {
- &self.secret
- }
- pub fn settings_updated_channel(&self) -> &RateLimitCell {
- &self.rate_limit_cell
- }
-}
-
-impl Clone for LemmyContext {
- fn clone(&self) -> Self {
- LemmyContext {
- pool: self.pool.clone(),
- chat_server: self.chat_server.clone(),
- client: self.client.clone(),
- settings: self.settings.clone(),
- secret: self.secret.clone(),
- rate_limit_cell: self.rate_limit_cell.clone(),
- }
- }
-}
+pub mod structs;
#[derive(Serialize)]
struct WebsocketResponse<T> {
use crate::{
- chat_server::ChatServer,
- messages::{Connect, Disconnect, StandardMessage, WsMessage},
+ websocket::{
+ chat_server::ChatServer,
+ messages::{Connect, Disconnect, StandardMessage, WsMessage},
+ },
LemmyContext,
};
use actix::prelude::*;
use crate::{
- messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
- LemmyContext,
- OperationType,
-};
-use lemmy_api_common::{
comment::CommentResponse,
community::CommunityResponse,
post::PostResponse,
private_message::PrivateMessageResponse,
utils::{check_person_block, get_interface_language, send_email_to_user},
+ websocket::{
+ messages::{SendComment, SendCommunityRoomMessage, SendPost, SendUserRoomMessage},
+ OperationType,
+ },
+ LemmyContext,
};
use lemmy_db_schema::{
newtypes::{CommentId, CommunityId, LocalUserId, PersonId, PostId, PrivateMessageId},
lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] }
-lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true }
bcrypt = { workspace = true }
serde_json = { workspace = true }
get_post,
local_site_to_slur_regex,
},
+ websocket::{
+ send::{send_comment_ws_message, send_local_notifs},
+ UserOperationCrud,
+ },
+ LemmyContext,
};
use lemmy_apub::{
generate_local_apub_endpoint,
utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId,
};
-use lemmy_websocket::{
- send::{send_comment_ws_message, send_local_notifs},
- LemmyContext,
- UserOperationCrud,
-};
#[async_trait::async_trait(?Send)]
impl PerformCrud for CreateComment {
use lemmy_api_common::{
comment::{CommentResponse, DeleteComment},
utils::{check_community_ban, get_local_user_view_from_jwt},
+ websocket::{
+ send::{send_comment_ws_message, send_local_notifs},
+ UserOperationCrud,
+ },
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{
- send::{send_comment_ws_message, send_local_notifs},
- LemmyContext,
- UserOperationCrud,
-};
#[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteComment {
get_local_user_view_from_jwt_opt,
listing_type_with_site_default,
},
+ LemmyContext,
};
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{
};
use lemmy_db_views::comment_view::CommentQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetComments {
use lemmy_api_common::{
comment::{CommentResponse, GetComment},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ LemmyContext,
};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetComment {
use lemmy_api_common::{
comment::{CommentResponse, RemoveComment},
utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin},
+ websocket::{
+ send::{send_comment_ws_message, send_local_notifs},
+ UserOperationCrud,
+ },
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
};
use lemmy_db_views::structs::CommentView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{
- send::{send_comment_ws_message, send_local_notifs},
- LemmyContext,
- UserOperationCrud,
-};
#[async_trait::async_trait(?Send)]
impl PerformCrud for RemoveComment {
is_mod_or_admin,
local_site_to_slur_regex,
},
+ websocket::{
+ send::{send_comment_ws_message, send_local_notifs},
+ UserOperationCrud,
+ },
+ LemmyContext,
};
use lemmy_apub::protocol::activities::{
create_or_update::note::CreateOrUpdateNote,
utils::{remove_slurs, scrape_text_for_mentions},
ConnectionId,
};
-use lemmy_websocket::{
- send::{send_comment_ws_message, send_local_notifs},
- LemmyContext,
- UserOperationCrud,
-};
#[async_trait::async_trait(?Send)]
impl PerformCrud for EditComment {
use lemmy_api_common::{
community::{CommunityResponse, CreateCommunity},
utils::{get_local_user_view_from_jwt, is_admin, local_site_to_slur_regex},
+ LemmyContext,
};
use lemmy_apub::{
generate_followers_url,
utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
ConnectionId,
};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for CreateCommunity {
use lemmy_api_common::{
community::{CommunityResponse, DeleteCommunity},
utils::get_local_user_view_from_jwt,
+ websocket::{send::send_community_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
};
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteCommunity {
use lemmy_api_common::{
community::{ListCommunities, ListCommunitiesResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ LemmyContext,
};
use lemmy_db_schema::{source::local_site::LocalSite, traits::DeleteableOrRemoveable};
use lemmy_db_views_actor::community_view::CommunityQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for ListCommunities {
use lemmy_api_common::{
community::{GetCommunity, GetCommunityResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ websocket::messages::GetCommunityUsersOnline,
+ LemmyContext,
};
use lemmy_apub::{
fetcher::resolve_actor_identifier,
};
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::GetCommunityUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetCommunity {
use lemmy_api_common::{
community::{CommunityResponse, RemoveCommunity},
utils::{get_local_user_view_from_jwt, is_admin},
+ websocket::{send::send_community_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, utils::naive_from_unix, ConnectionId};
-use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for RemoveCommunity {
use lemmy_api_common::{
community::{CommunityResponse, EditCommunity},
utils::{get_local_user_view_from_jwt, local_site_to_slur_regex},
+ websocket::{send::send_community_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::community::update::UpdateCommunity;
use lemmy_db_schema::{
};
use lemmy_db_views_actor::structs::CommunityModeratorView;
use lemmy_utils::{error::LemmyError, utils::check_slurs_opt, ConnectionId};
-use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for EditCommunity {
GetPrivateMessages,
},
site::{CreateSite, EditSite, GetSite},
+ websocket::{serialize_websocket_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{serialize_websocket_message, LemmyContext, UserOperationCrud};
use serde::Deserialize;
mod comment;
local_site_to_slur_regex,
mark_post_as_read,
},
+ websocket::{send::send_post_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::{
generate_local_apub_endpoint,
utils::{check_slurs, check_slurs_opt, clean_url_params, is_valid_post_title},
ConnectionId,
};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use tracing::{warn, Instrument};
use url::Url;
use webmention::{Webmention, WebmentionError};
use lemmy_api_common::{
post::{DeletePost, PostResponse},
utils::{check_community_ban, check_community_deleted_or_removed, get_local_user_view_from_jwt},
+ websocket::{send::send_post_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for DeletePost {
get_local_user_view_from_jwt_opt,
listing_type_with_site_default,
},
+ LemmyContext,
};
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::community::ApubCommunity};
use lemmy_db_schema::{
};
use lemmy_db_views::post_view::PostQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetPosts {
use lemmy_api_common::{
post::{GetPost, GetPostResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt, mark_post_as_read},
+ websocket::messages::GetPostUsersOnline,
+ LemmyContext,
};
use lemmy_db_schema::{
aggregates::structs::{PersonPostAggregates, PersonPostAggregatesForm},
use lemmy_db_views::structs::PostView;
use lemmy_db_views_actor::structs::{CommunityModeratorView, CommunityView};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{messages::GetPostUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetPost {
use lemmy_api_common::{
post::{PostResponse, RemovePost},
utils::{check_community_ban, get_local_user_view_from_jwt, is_mod_or_admin},
+ websocket::{send::send_post_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::activities::deletion::{send_apub_delete_in_community, DeletableObjects};
use lemmy_db_schema::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for RemovePost {
get_local_user_view_from_jwt,
local_site_to_slur_regex,
},
+ websocket::{send::send_post_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::{
create_or_update::page::CreateOrUpdatePage,
utils::{check_slurs_opt, clean_url_params, is_valid_post_title},
ConnectionId,
};
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for EditPost {
local_site_to_slur_regex,
send_email_to_user,
},
+ websocket::{send::send_pm_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::{
generate_local_apub_endpoint,
};
use lemmy_db_views::structs::LocalUserView;
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
-use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for CreatePrivateMessage {
use lemmy_api_common::{
private_message::{DeletePrivateMessage, PrivateMessageResponse},
utils::get_local_user_view_from_jwt,
+ websocket::{send::send_pm_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::activities::deletion::send_apub_delete_private_message;
use lemmy_db_schema::{
traits::Crud,
};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for DeletePrivateMessage {
use lemmy_api_common::{
private_message::{GetPrivateMessages, PrivateMessagesResponse},
utils::get_local_user_view_from_jwt,
+ LemmyContext,
};
use lemmy_db_schema::traits::DeleteableOrRemoveable;
use lemmy_db_views::private_message_view::PrivateMessageQuery;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetPrivateMessages {
use lemmy_api_common::{
private_message::{EditPrivateMessage, PrivateMessageResponse},
utils::{get_local_user_view_from_jwt, local_site_to_slur_regex},
+ websocket::{send::send_pm_ws_message, UserOperationCrud},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::{
create_or_update::chat_message::CreateOrUpdateChatMessage,
utils::naive_now,
};
use lemmy_utils::{error::LemmyError, utils::remove_slurs, ConnectionId};
-use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
#[async_trait::async_trait(?Send)]
impl PerformCrud for EditPrivateMessage {
local_site_to_slur_regex,
site_description_length_check,
},
+ LemmyContext,
};
use lemmy_apub::generate_site_inbox_url;
use lemmy_db_schema::{
utils::{check_application_question, check_slurs, check_slurs_opt},
ConnectionId,
};
-use lemmy_websocket::LemmyContext;
use url::Url;
#[async_trait::async_trait(?Send)]
use lemmy_api_common::{
site::{GetSite, GetSiteResponse, MyUserInfo},
utils::{build_federated_instances, get_local_user_settings_view_from_jwt_opt},
+ websocket::messages::GetUsersOnline,
+ LemmyContext,
};
use lemmy_db_schema::source::{actor_language::SiteLanguage, language::Language, tagline::Tagline};
use lemmy_db_views::structs::{LocalUserDiscussionLanguageView, SiteView};
PersonViewSafe,
};
use lemmy_utils::{error::LemmyError, version, ConnectionId};
-use lemmy_websocket::{messages::GetUsersOnline, LemmyContext};
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetSite {
local_site_to_slur_regex,
site_description_length_check,
},
+ websocket::{messages::SendAllMessage, UserOperationCrud},
+ LemmyContext,
};
use lemmy_db_schema::{
source::{
utils::{check_application_question, check_slurs_opt},
ConnectionId,
};
-use lemmy_websocket::{messages::SendAllMessage, LemmyContext, UserOperationCrud};
use std::str::FromStr;
#[async_trait::async_trait(?Send)]
send_new_applicant_email_to_admins,
send_verification_email,
},
+ websocket::messages::CheckCaptcha,
+ LemmyContext,
};
use lemmy_apub::{
generate_inbox_url,
utils::{check_slurs, check_slurs_opt, is_valid_actor_name},
ConnectionId,
};
-use lemmy_websocket::{messages::CheckCaptcha, LemmyContext};
#[async_trait::async_trait(?Send)]
impl PerformCrud for Register {
use lemmy_api_common::{
person::{DeleteAccount, DeleteAccountResponse},
utils::{delete_user_account, get_local_user_view_from_jwt},
+ LemmyContext,
};
use lemmy_apub::protocol::activities::deletion::delete_user::DeleteUser;
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for DeleteAccount {
use lemmy_api_common::{
person::{GetPersonDetails, GetPersonDetailsResponse},
utils::{check_private_instance, get_local_user_view_from_jwt_opt},
+ LemmyContext,
};
use lemmy_apub::{fetcher::resolve_actor_identifier, objects::person::ApubPerson};
use lemmy_db_schema::{
use lemmy_db_views::{comment_view::CommentQuery, post_view::PostQuery};
use lemmy_db_views_actor::structs::{CommunityModeratorView, PersonViewSafe};
use lemmy_utils::{error::LemmyError, ConnectionId};
-use lemmy_websocket::LemmyContext;
#[async_trait::async_trait(?Send)]
impl PerformCrud for GetPersonDetails {
lemmy_db_views = { workspace = true, features = ["full"] }
lemmy_db_views_actor = { workspace = true, features = ["full"] }
lemmy_api_common = { workspace = true, features = ["full"] }
-lemmy_websocket = { workspace = true }
activitypub_federation = { workspace = true }
diesel = { workspace = true }
chrono = { workspace = true }
use activitystreams_kinds::{activity::BlockType, public};
use anyhow::anyhow;
use chrono::NaiveDateTime;
-use lemmy_api_common::utils::{remove_user_data, remove_user_data_in_community};
+use lemmy_api_common::{
+ utils::{remove_user_data, remove_user_data_in_community},
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
community::{
traits::{Bannable, Crud, Followable},
};
use lemmy_utils::{error::LemmyError, utils::convert_datetime};
-use lemmy_websocket::LemmyContext;
use url::Url;
impl BlockUser {
};
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use chrono::NaiveDateTime;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{source::site::Site, utils::DbPool};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
use url::Url;
utils::verify_domains_match,
};
use activitystreams_kinds::{activity::UndoType, public};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
community::{CommunityPersonBan, CommunityPersonBanForm},
traits::{Bannable, Crud},
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl UndoBlockUser {
traits::{ActivityHandler, Actor},
};
use activitystreams_kinds::{activity::AddType, public};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
community::{CommunityModerator, CommunityModeratorForm},
traits::{Crud, Joinable},
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl AddMod {
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::{activity::AnnounceType, public};
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde_json::Value;
use tracing::debug;
use url::Url;
protocol::activities::community::announce::AnnounceActivity,
};
use activitypub_federation::{core::object_id::ObjectId, traits::Actor};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::source::person::PersonFollower;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
pub mod add_mod;
traits::{ActivityHandler, Actor},
};
use activitystreams_kinds::{activity::RemoveType, public};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
community::{CommunityModerator, CommunityModeratorForm},
traits::{Crud, Joinable},
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl RemoveMod {
traits::{ActivityHandler, Actor},
};
use activitystreams_kinds::activity::FlagType;
-use lemmy_api_common::{comment::CommentReportResponse, post::PostReportResponse};
+use lemmy_api_common::{
+ comment::CommentReportResponse,
+ post::PostReportResponse,
+ websocket::{messages::SendModRoomMessage, UserOperation},
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment_report::{CommentReport, CommentReportForm},
};
use lemmy_db_views::structs::{CommentReportView, PostReportView};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{messages::SendModRoomMessage, LemmyContext, UserOperation};
use url::Url;
impl Report {
traits::{ActivityHandler, ApubObject},
};
use activitystreams_kinds::{activity::UpdateType, public};
+use lemmy_api_common::{
+ websocket::{send::send_community_ws_message, UserOperationCrud},
+ LemmyContext,
+};
use lemmy_db_schema::{source::community::Community, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{send::send_community_ws_message, LemmyContext, UserOperationCrud};
use url::Url;
impl UpdateCommunity {
utils::verify_domains_match,
};
use activitystreams_kinds::public;
-use lemmy_api_common::utils::check_post_deleted_or_removed;
+use lemmy_api_common::{
+ utils::check_post_deleted_or_removed,
+ websocket::{send::send_comment_ws_message, UserOperationCrud},
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment::{CommentLike, CommentLikeForm},
traits::{Crud, Likeable},
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{send::send_comment_ws_message, LemmyContext, UserOperationCrud};
use url::Url;
impl CreateOrUpdateNote {
use crate::{local_instance, objects::person::ApubPerson};
use activitypub_federation::core::object_id::ObjectId;
+use lemmy_api_common::{websocket::send::send_local_notifs, LemmyContext};
use lemmy_db_schema::{
newtypes::LocalUserId,
source::{comment::Comment, post::Post},
traits::Crud,
};
use lemmy_utils::{error::LemmyError, utils::scrape_text_for_mentions};
-use lemmy_websocket::{send::send_local_notifs, LemmyContext};
pub mod comment;
pub mod post;
utils::{verify_domains_match, verify_urls_match},
};
use activitystreams_kinds::public;
+use lemmy_api_common::{
+ websocket::{send::send_post_ws_message, UserOperationCrud},
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
community::Community,
traits::{Crud, Likeable},
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{send::send_post_ws_message, LemmyContext, UserOperationCrud};
use url::Url;
impl CreateOrUpdatePage {
traits::{ActivityHandler, Actor, ApubObject},
utils::verify_domains_match,
};
+use lemmy_api_common::{
+ websocket::{send::send_pm_ws_message, UserOperationCrud},
+ LemmyContext,
+};
use lemmy_db_schema::{source::person::Person, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{send::send_pm_ws_message, LemmyContext, UserOperationCrud};
use url::Url;
impl CreateOrUpdateChatMessage {
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::activity::DeleteType;
+use lemmy_api_common::{
+ websocket::{
+ send::{send_comment_ws_message_simple, send_community_ws_message, send_post_ws_message},
+ UserOperationCrud,
+ },
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment::{Comment, CommentUpdateForm},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{
- send::{send_comment_ws_message_simple, send_community_ws_message, send_post_ws_message},
- LemmyContext,
- UserOperationCrud,
-};
use url::Url;
#[async_trait::async_trait(?Send)]
utils::verify_urls_match,
};
use activitystreams_kinds::{activity::DeleteType, public};
-use lemmy_api_common::utils::delete_user_account;
+use lemmy_api_common::{utils::delete_user_account, LemmyContext};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
/// This can be separate from Delete activity because it doesn't need to be handled in shared inbox
utils::verify_domains_match,
};
use activitystreams_kinds::public;
+use lemmy_api_common::{
+ websocket::{
+ send::{
+ send_comment_ws_message_simple,
+ send_community_ws_message,
+ send_pm_ws_message,
+ send_post_ws_message,
+ },
+ UserOperationCrud,
+ },
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment::{Comment, CommentUpdateForm},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{
- send::{
- send_comment_ws_message_simple,
- send_community_ws_message,
- send_pm_ws_message,
- send_post_ws_message,
- },
- LemmyContext,
- UserOperationCrud,
-};
use std::ops::Deref;
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::{
+ websocket::{
+ send::{send_comment_ws_message_simple, send_community_ws_message, send_post_ws_message},
+ UserOperationCrud,
+ },
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment::{Comment, CommentUpdateForm},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{
- send::{send_comment_ws_message_simple, send_community_ws_message, send_post_ws_message},
- LemmyContext,
- UserOperationCrud,
-};
use url::Url;
#[async_trait::async_trait(?Send)]
utils::verify_urls_match,
};
use activitystreams_kinds::activity::AcceptType;
-use lemmy_api_common::community::CommunityResponse;
+use lemmy_api_common::{
+ community::CommunityResponse,
+ websocket::{messages::SendUserRoomMessage, UserOperation},
+ LemmyContext,
+};
use lemmy_db_schema::{source::community::CommunityFollower, traits::Followable};
use lemmy_db_views::structs::LocalUserView;
use lemmy_db_views_actor::structs::CommunityView;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{messages::SendUserRoomMessage, LemmyContext, UserOperation};
use url::Url;
impl AcceptFollow {
traits::{ActivityHandler, Actor},
};
use activitystreams_kinds::activity::FollowType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
community::{CommunityFollower, CommunityFollowerForm},
traits::Followable,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl Follow {
utils::verify_urls_match,
};
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
community::{CommunityFollower, CommunityFollowerForm},
traits::Followable,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl UndoFollow {
};
use activitystreams_kinds::public;
use anyhow::anyhow;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
newtypes::CommunityId,
source::{community::Community, local_site::LocalSite},
};
use lemmy_db_views_actor::structs::{CommunityPersonBanView, CommunityView};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Serialize;
use std::ops::Deref;
use tracing::info;
objects::{comment::ApubComment, person::ApubPerson, post::ApubPost},
protocol::activities::voting::vote::VoteType,
};
+use lemmy_api_common::{
+ websocket::{
+ send::{send_comment_ws_message_simple, send_post_ws_message},
+ UserOperation,
+ },
+ LemmyContext,
+};
use lemmy_db_schema::{
source::{
comment::{CommentLike, CommentLikeForm},
traits::Likeable,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::{
- send::{send_comment_ws_message_simple, send_post_ws_message},
- LemmyContext,
- UserOperation,
-};
pub mod undo_vote;
pub mod vote;
utils::verify_urls_match,
};
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{newtypes::CommunityId, source::community::Community, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
impl UndoVote {
};
use activitypub_federation::{core::object_id::ObjectId, data::Data, traits::ActivityHandler};
use anyhow::anyhow;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
newtypes::CommunityId,
source::{community::Community, local_site::LocalSite},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
/// Vote has as:Public value in cc field, unlike other activities. This indicates to other software
},
};
use activitypub_federation::{data::Data, deser::context::WithContext, traits::ActivityHandler};
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
use crate::objects::community::ApubCommunity;
-use lemmy_websocket::LemmyContext;
+use lemmy_api_common::LemmyContext;
pub(crate) mod community_moderators;
pub(crate) mod community_outbox;
site::Site,
};
use lemmy_utils::LemmyError;
-use lemmy_websocket::LemmyContext;
+use lemmy_api_common::LemmyContext;
// TODO: merge this trait with ApubObject (means that db_schema needs to depend on apub_lib)
#[async_trait::async_trait(?Send)]
use crate::{fetcher::webfinger::webfinger_resolve_actor, ActorType};
use activitypub_federation::traits::ApubObject;
use itertools::Itertools;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::traits::ApubActor;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
pub mod post_or_comment;
pub mod search;
};
use activitypub_federation::traits::ApubObject;
use chrono::NaiveDateTime;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use chrono::NaiveDateTime;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
use url::Url;
};
use activitypub_federation::traits::{Actor, ApubObject};
use chrono::NaiveDateTime;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
use activitypub_federation::{core::object_id::ObjectId, traits::ApubObject};
use anyhow::anyhow;
use itertools::Itertools;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::newtypes::DbUrl;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use tracing::debug;
use url::Url;
use activitypub_federation::traits::ApubObject;
use actix_web::{web, web::Path, HttpResponse};
use diesel::result::Error::NotFound;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{newtypes::CommentId, source::comment::Comment, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
#[derive(Deserialize)]
traits::ApubObject,
};
use actix_web::{web, HttpRequest, HttpResponse};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::ApubActor};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
#[derive(Deserialize)]
};
use actix_web::{web, HttpRequest, HttpResponse};
use http::StatusCode;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::source::activity::Activity;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use once_cell::sync::OnceCell;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_json::Value;
};
use activitypub_federation::{deser::context::WithContext, traits::ApubObject};
use actix_web::{web, HttpRequest, HttpResponse};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{source::person::Person, traits::ApubActor};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
#[derive(Deserialize)]
use activitypub_federation::traits::ApubObject;
use actix_web::{web, HttpResponse};
use diesel::result::Error::NotFound;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{newtypes::PostId, source::post::Post, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
#[derive(Deserialize)]
};
use activitypub_federation::{deser::context::WithContext, traits::ApubObject};
use actix_web::{web, HttpRequest, HttpResponse};
+use lemmy_api_common::LemmyContext;
use lemmy_db_views::structs::SiteView;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use url::Url;
pub(crate) async fn get_apub_site_http(
};
use anyhow::Context;
use async_trait::async_trait;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
newtypes::DbUrl,
source::{activity::Activity, instance::Instance, local_site::LocalSite},
utils::DbPool,
};
use lemmy_utils::{error::LemmyError, location_info, settings::structs::Settings};
-use lemmy_websocket::LemmyContext;
use once_cell::sync::Lazy;
use tokio::sync::OnceCell;
use url::{ParseError, Url};
};
use activitypub_federation::core::object_id::ObjectId;
use activitystreams_kinds::link::MentionType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{comment::Comment, person::Person, post::Post},
traits::Crud,
error::LemmyError,
utils::{scrape_text_for_mentions, MentionData},
};
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use url::Url;
};
use activitystreams_kinds::{object::NoteType, public};
use chrono::NaiveDateTime;
-use lemmy_api_common::utils::local_site_opt_to_slur_regex;
+use lemmy_api_common::{utils::local_site_opt_to_slur_regex, LemmyContext};
use lemmy_db_schema::{
source::{
comment::{Comment, CommentInsertForm, CommentUpdateForm},
error::LemmyError,
utils::{convert_datetime, markdown_to_html, remove_slurs},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use url::Url;
use activitystreams_kinds::actor::GroupType;
use chrono::NaiveDateTime;
use itertools::Itertools;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{
actor_language::CommunityLanguage,
error::LemmyError,
utils::{convert_datetime, markdown_to_html},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use tracing::debug;
use url::Url;
utils::verify_domains_match,
};
use chrono::NaiveDateTime;
-use lemmy_api_common::utils::local_site_opt_to_slur_regex;
+use lemmy_api_common::{utils::local_site_opt_to_slur_regex, LemmyContext};
use lemmy_db_schema::{
source::{
actor_language::SiteLanguage,
error::LemmyError,
utils::{check_slurs, check_slurs_opt, convert_datetime, markdown_to_html},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use tracing::debug;
use url::Url;
pub(crate) mod tests {
use actix::Actor;
use anyhow::anyhow;
- use lemmy_api_common::request::build_user_agent;
+ use lemmy_api_common::{
+ request::build_user_agent,
+ websocket::chat_server::ChatServer,
+ LemmyContext,
+ };
use lemmy_db_schema::{source::secret::Secret, utils::build_db_pool_for_tests};
use lemmy_utils::{
error::LemmyError,
rate_limit::{RateLimitCell, RateLimitConfig},
settings::SETTINGS,
};
- use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::{Client, Request, Response};
use reqwest_middleware::{ClientBuilder, Middleware, Next};
use task_local_extensions::Extensions;
utils::verify_domains_match,
};
use chrono::NaiveDateTime;
-use lemmy_api_common::utils::local_site_opt_to_slur_regex;
+use lemmy_api_common::{utils::local_site_opt_to_slur_regex, LemmyContext};
use lemmy_db_schema::{
source::{
instance::Instance,
error::LemmyError,
utils::{check_slurs, check_slurs_opt, convert_datetime, markdown_to_html},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use url::Url;
};
use activitystreams_kinds::public;
use chrono::NaiveDateTime;
-use lemmy_api_common::{request::fetch_site_data, utils::local_site_opt_to_slur_regex};
+use lemmy_api_common::{
+ request::fetch_site_data,
+ utils::local_site_opt_to_slur_regex,
+ LemmyContext,
+};
use lemmy_db_schema::{
self,
source::{
error::LemmyError,
utils::{check_slurs, convert_datetime, markdown_to_html, remove_slurs},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use url::Url;
utils::verify_domains_match,
};
use chrono::NaiveDateTime;
-use lemmy_api_common::utils::check_person_block;
+use lemmy_api_common::{utils::check_person_block, LemmyContext};
use lemmy_db_schema::{
source::{
person::Person,
error::LemmyError,
utils::{convert_datetime, markdown_to_html},
};
-use lemmy_websocket::LemmyContext;
use std::ops::Deref;
use url::Url;
use activitystreams_kinds::activity::BlockType;
use anyhow::anyhow;
use chrono::{DateTime, FixedOffset};
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::AddType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::RemoveType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one};
use activitystreams_kinds::activity::FlagType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::UpdateType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
protocol::{activities::CreateOrUpdateType, objects::note::Note, InCommunity},
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{source::community::Community, traits::Crud};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
protocol::{activities::CreateOrUpdateType, objects::page::Page, InCommunity},
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::DeleteType;
use anyhow::anyhow;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
};
use activitypub_federation::{core::object_id::ObjectId, deser::helpers::deserialize_one_or_many};
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
};
use activitypub_federation::core::object_id::ObjectId;
use activitystreams_kinds::activity::UndoType;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
protocol::InCommunity,
};
use activitypub_federation::core::object_id::ObjectId;
+use lemmy_api_common::LemmyContext;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use strum_macros::Display;
use crate::generate_followers_url;
use activitystreams_kinds::collection::CollectionType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::source::community::Community;
use lemmy_db_views_actor::structs::CommunityFollowerView;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
use crate::{local_instance, objects::community::ApubCommunity};
use activitypub_federation::{deser::values::MediaTypeMarkdown, utils::fetch_object_http};
use activitystreams_kinds::object::ImageType;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::newtypes::DbUrl;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::collections::HashMap;
use url::Url;
};
use activitystreams_kinds::actor::GroupType;
use chrono::{DateTime, FixedOffset};
-use lemmy_api_common::utils::local_site_opt_to_slur_regex;
+use lemmy_api_common::{utils::local_site_opt_to_slur_regex, LemmyContext};
use lemmy_db_schema::{
newtypes::InstanceId,
source::community::{CommunityInsertForm, CommunityUpdateForm},
error::LemmyError,
utils::{check_slurs, check_slurs_opt},
};
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
};
use activitystreams_kinds::object::NoteType;
use chrono::{DateTime, FixedOffset};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use std::ops::Deref;
};
use chrono::{DateTime, FixedOffset};
use itertools::Itertools;
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::newtypes::DbUrl;
use lemmy_utils::error::LemmyError;
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use serde_with::skip_serializing_none;
use url::Url;
[dependencies]
lemmy_utils = { workspace = true }
-lemmy_websocket = { workspace = true }
lemmy_db_views = { workspace = true }
lemmy_db_views_actor = { workspace = true }
lemmy_db_schema = { workspace = true }
use actix_web::{error::ErrorBadRequest, web, Error, HttpRequest, HttpResponse, Result};
use anyhow::anyhow;
use chrono::{DateTime, NaiveDateTime, Utc};
+use lemmy_api_common::LemmyContext;
use lemmy_db_schema::{
newtypes::LocalUserId,
source::{community::Community, local_user::LocalUser, person::Person},
structs::{CommentReplyView, PersonMentionView},
};
use lemmy_utils::{claims::Claims, error::LemmyError, utils::markdown_to_html};
-use lemmy_websocket::LemmyContext;
use once_cell::sync::Lazy;
use rss::{
extension::dublincore::DublinCoreExtensionBuilder,
HttpResponse,
};
use futures::stream::{Stream, StreamExt};
-use lemmy_api_common::utils::get_local_user_view_from_jwt;
+use lemmy_api_common::{utils::get_local_user_view_from_jwt, LemmyContext};
use lemmy_db_schema::source::local_site::LocalSite;
use lemmy_utils::{claims::Claims, rate_limit::RateLimitCell, REQWEST_TIMEOUT};
-use lemmy_websocket::LemmyContext;
use reqwest::Body;
use reqwest_middleware::{ClientWithMiddleware, RequestBuilder};
use serde::{Deserialize, Serialize};
use actix_web::{error::ErrorBadRequest, web, Error, HttpResponse, Result};
use anyhow::anyhow;
+use lemmy_api_common::LemmyContext;
use lemmy_db_views::structs::SiteView;
use lemmy_utils::{error::LemmyError, version};
-use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize};
use url::Url;
use actix_web::{web, web::Query, HttpResponse};
use anyhow::Context;
+use lemmy_api_common::LemmyContext;
use lemmy_apub::fetcher::webfinger::{WebfingerLink, WebfingerResponse};
use lemmy_db_schema::{
source::{community::Community, person::Person},
traits::ApubActor,
};
use lemmy_utils::{error::LemmyError, location_info};
-use lemmy_websocket::LemmyContext;
use serde::Deserialize;
use url::Url;
+++ /dev/null
-[package]
-name = "lemmy_websocket"
-version.workspace = true
-edition.workspace = true
-description.workspace = true
-license.workspace = true
-homepage.workspace = true
-documentation.workspace = true
-repository.workspace = true
-
-[lib]
-name = "lemmy_websocket"
-path = "src/lib.rs"
-doctest = false
-
-[dependencies]
-lemmy_utils = { workspace = true }
-lemmy_api_common = { workspace = true, features = ["full"] }
-lemmy_db_schema = { workspace = true, features = ["full"] }
-lemmy_db_views = { workspace = true, features = ["full"] }
-lemmy_db_views_actor = { workspace = true, features = ["full"] }
-reqwest-middleware = { workspace = true }
-tracing = { workspace = true }
-rand = { workspace = true }
-serde = { workspace = true }
-serde_json = { workspace = true }
-actix = { workspace = true }
-anyhow = { workspace = true }
-diesel = { workspace = true }
-tokio = { workspace = true }
-strum = { workspace = true }
-strum_macros = { workspace = true }
-chrono = { workspace = true }
-actix-web = { workspace = true }
-opentelemetry = { workspace = true }
-tracing-opentelemetry = { workspace = true }
-actix-web-actors = { version = "4.1.0", default-features = false }
-background-jobs = "0.13.0"
ResolveObject,
Search,
},
- websocket::{CommunityJoin, ModJoin, PostJoin, UserJoin},
+ websocket::{
+ routes::chat_route,
+ structs::{CommunityJoin, ModJoin, PostJoin, UserJoin},
+ },
+ LemmyContext,
};
use lemmy_api_crud::PerformCrud;
use lemmy_utils::rate_limit::RateLimitCell;
-use lemmy_websocket::{routes::chat_route, LemmyContext};
use serde::Deserialize;
pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimitCell) {
check_private_instance_and_federation_enabled,
local_site_rate_limit_to_rate_limit_config,
},
+ websocket::chat_server::ChatServer,
+ LemmyContext,
};
use lemmy_api_crud::match_websocket_operation_crud;
use lemmy_db_schema::{
rate_limit::RateLimitCell,
settings::{structs::Settings, SETTINGS},
};
-use lemmy_websocket::{chat_server::ChatServer, LemmyContext};
use reqwest::Client;
use reqwest_middleware::ClientBuilder;
use reqwest_retry::{policies::ExponentialBackoff, RetryTransientMiddleware};