lemmy/server/src/websocket/mod.rs

86 lines
1.5 KiB
Rust
Raw Normal View History

pub mod server;
2020-01-16 14:39:08 +00:00
use crate::ConnectionId;
use actix::prelude::*;
2020-05-16 14:04:08 +00:00
use diesel::{
r2d2::{ConnectionManager, Pool},
PgConnection,
};
use log::{error, info};
use rand::{rngs::ThreadRng, Rng};
use serde::{Deserialize, Serialize};
use serde_json::Value;
use server::ChatServer;
2020-05-16 14:04:08 +00:00
use std::{
collections::{HashMap, HashSet},
str::FromStr,
};
#[derive(EnumString, ToString, Debug, Clone)]
2020-01-16 14:39:08 +00:00
pub enum UserOperation {
Login,
Register,
GetCaptcha,
2020-01-16 14:39:08 +00:00
CreateCommunity,
CreatePost,
ListCommunities,
ListCategories,
GetPost,
GetCommunity,
CreateComment,
EditComment,
2020-07-21 01:37:44 +00:00
DeleteComment,
RemoveComment,
MarkCommentAsRead,
2020-01-16 14:39:08 +00:00
SaveComment,
CreateCommentLike,
GetPosts,
CreatePostLike,
EditPost,
DeletePost,
RemovePost,
LockPost,
StickyPost,
2020-01-16 14:39:08 +00:00
SavePost,
EditCommunity,
2020-07-20 17:37:39 +00:00
DeleteCommunity,
RemoveCommunity,
2020-01-16 14:39:08 +00:00
FollowCommunity,
GetFollowedCommunities,
GetUserDetails,
GetReplies,
GetUserMentions,
MarkUserMentionAsRead,
2020-01-16 14:39:08 +00:00
GetModlog,
BanFromCommunity,
AddModToCommunity,
CreateSite,
EditSite,
GetSite,
AddAdmin,
BanUser,
Search,
MarkAllAsRead,
SaveUserSettings,
TransferCommunity,
TransferSite,
DeleteAccount,
PasswordReset,
PasswordChange,
CreatePrivateMessage,
EditPrivateMessage,
DeletePrivateMessage,
MarkPrivateMessageAsRead,
GetPrivateMessages,
UserJoin,
GetComments,
GetSiteConfig,
SaveSiteConfig,
2020-01-16 14:39:08 +00:00
}
#[derive(Clone)]
pub struct WebsocketInfo {
pub chatserver: Addr<ChatServer>,
pub id: Option<ConnectionId>,
}