]> Untitled Git - lemmy.git/commitdiff
Move websocket structs into lemmy_structs (ref #1115)
authorFelix Ableitner <me@nutomic.com>
Wed, 16 Sep 2020 10:25:22 +0000 (12:25 +0200)
committerFelix Ableitner <me@nutomic.com>
Wed, 16 Sep 2020 11:45:31 +0000 (13:45 +0200)
44 files changed:
Cargo.lock
Cargo.toml
docker/dev/Dockerfile
docker/prod/Dockerfile
lemmy_structs/Cargo.toml [moved from lemmy_api_structs/Cargo.toml with 69% similarity]
lemmy_structs/src/comment.rs [moved from lemmy_api_structs/src/comment.rs with 100% similarity]
lemmy_structs/src/community.rs [moved from lemmy_api_structs/src/community.rs with 100% similarity]
lemmy_structs/src/lib.rs [moved from lemmy_api_structs/src/lib.rs with 97% similarity]
lemmy_structs/src/post.rs [moved from lemmy_api_structs/src/post.rs with 100% similarity]
lemmy_structs/src/site.rs [moved from lemmy_api_structs/src/site.rs with 100% similarity]
lemmy_structs/src/user.rs [moved from lemmy_api_structs/src/user.rs with 100% similarity]
lemmy_structs/src/websocket.rs [moved from src/websocket/messages.rs with 70% similarity]
src/api/comment.rs
src/api/community.rs
src/api/mod.rs
src/api/post.rs
src/api/site.rs
src/api/user.rs
src/apub/comment.rs
src/apub/community.rs
src/apub/fetcher.rs
src/apub/inbox/activities/create.rs
src/apub/inbox/activities/delete.rs
src/apub/inbox/activities/dislike.rs
src/apub/inbox/activities/like.rs
src/apub/inbox/activities/remove.rs
src/apub/inbox/activities/undo.rs
src/apub/inbox/activities/update.rs
src/apub/inbox/community_inbox.rs
src/apub/inbox/user_inbox.rs
src/apub/mod.rs
src/apub/post.rs
src/apub/private_message.rs
src/apub/user.rs
src/lib.rs
src/main.rs
src/routes/api.rs
src/routes/feeds.rs
src/routes/nodeinfo.rs
src/routes/webfinger.rs
src/routes/websocket.rs
src/websocket/chat_server.rs
src/websocket/handlers.rs
src/websocket/mod.rs

index 644c83ac8508af875d6b242db07ae093e40991b4..8fef254fcb22745da338c891534a10545886ef3b 100644 (file)
@@ -1820,18 +1820,6 @@ version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
-[[package]]
-name = "lemmy_api_structs"
-version = "0.1.0"
-dependencies = [
- "actix-web",
- "diesel",
- "lemmy_db",
- "lemmy_utils",
- "log",
- "serde 1.0.115",
-]
-
 [[package]]
 name = "lemmy_db"
 version = "0.1.0"
@@ -1893,9 +1881,9 @@ dependencies = [
  "itertools",
  "jsonwebtoken",
  "lazy_static",
- "lemmy_api_structs",
  "lemmy_db",
  "lemmy_rate_limit",
+ "lemmy_structs",
  "lemmy_utils",
  "log",
  "openssl",
@@ -1907,13 +1895,28 @@ dependencies = [
  "serde_json",
  "sha2",
  "strum",
- "strum_macros",
  "thiserror",
  "tokio",
  "url",
  "uuid 0.8.1",
 ]
 
+[[package]]
+name = "lemmy_structs"
+version = "0.1.0"
+dependencies = [
+ "actix",
+ "actix-web",
+ "chrono",
+ "diesel",
+ "lemmy_db",
+ "lemmy_utils",
+ "log",
+ "serde 1.0.115",
+ "strum",
+ "strum_macros",
+]
+
 [[package]]
 name = "lemmy_utils"
 version = "0.1.0"
index f1f490b0d6fe37fb8a1635c5081cd0bb28cb1b80..dc411a63965ecd09c8dcca6a00116369a468b6eb 100644 (file)
@@ -10,14 +10,14 @@ lto = true
 members = [
     "lemmy_utils",
     "lemmy_db",
-    "lemmy_api_structs",
+    "lemmy_structs",
     "lemmy_rate_limit",
 ]
 
 [dependencies]
 lemmy_utils = { path = "./lemmy_utils" }
 lemmy_db = { path = "./lemmy_db" }
-lemmy_api_structs = { path = "./lemmy_api_structs" }
+lemmy_structs = { path = "./lemmy_structs" }
 lemmy_rate_limit = { path = "./lemmy_rate_limit" }
 diesel = "1.4.4"
 diesel_migrations = "1.4.0"
@@ -38,7 +38,6 @@ log = "0.4.0"
 env_logger = "0.7.1"
 rand = "0.7.3"
 strum = "0.19.2"
-strum_macros = "0.19.2"
 jsonwebtoken = "7.0.1"
 lazy_static = "1.3.0"
 rss = "1.9.0"
index d9a95c85c873c6a0131896f052cd55111f448002..17e58fda4602fb528c776d52e8790cc7bcc49f5b 100644 (file)
@@ -10,7 +10,7 @@ RUN cargo install --git https://github.com/romac/cargo-build-deps.git
 WORKDIR /app/server
 RUN mkdir -p lemmy_db/src/ \
       lemmy_utils/src/ \
-      lemmy_api_structs/src/ \
+      lemmy_structs/src/ \
       lemmy_rate_limit/src/ \
       lemmy
 
@@ -18,7 +18,7 @@ RUN mkdir -p lemmy_db/src/ \
 COPY Cargo.toml Cargo.lock ./
 COPY lemmy_db/Cargo.toml ./lemmy_db/
 COPY lemmy_utils/Cargo.toml ./lemmy_utils/
-COPY lemmy_api_structs/Cargo.toml ./lemmy_api_structs/
+COPY lemmy_structs/Cargo.toml ./lemmy_structs/
 COPY lemmy_rate_limit/Cargo.toml ./lemmy_rate_limit/
 
 # Cache the deps
@@ -28,7 +28,7 @@ RUN cargo build-deps
 COPY src ./src/
 COPY lemmy_db/src ./lemmy_db/src/
 COPY lemmy_utils/src/ ./lemmy_utils/src/
-COPY lemmy_api_structs/src/ ./lemmy_api_structs/src/
+COPY lemmy_structs/src/ ./lemmy_structs/src/
 COPY lemmy_rate_limit/src/ ./lemmy_rate_limit/src/
 COPY migrations ./migrations/
 
index 2ba5bca7075ceeb6ffc6f749dabe973c9f5ecc42..20e910a429f0ad9dfbf56be2599be020e44bbb1e 100644 (file)
@@ -13,7 +13,7 @@ WORKDIR /app/server
 COPY Cargo.toml Cargo.lock ./
 COPY lemmy_db ./lemmy_db
 COPY lemmy_utils ./lemmy_utils
-COPY lemmy_api_structs ./lemmy_api_structs
+COPY lemmy_structs ./lemmy_structs
 COPY lemmy_rate_limit ./lemmy_rate_limit
 RUN mkdir -p ./src/bin \
    && echo 'fn main() { println!("Dummy") }' > ./src/bin/main.rs
similarity index 69%
rename from lemmy_api_structs/Cargo.toml
rename to lemmy_structs/Cargo.toml
index b442f697d5b6bfc175d7d5cc3315cd71bcde931a..25e38109a15a0368d07c8ff265fe175969a98a04 100644 (file)
@@ -1,11 +1,11 @@
 [package]
-name = "lemmy_api_structs"
+name = "lemmy_structs"
 version = "0.1.0"
 authors = ["Felix Ableitner <me@nutomic.com>"]
 edition = "2018"
 
 [lib]
-name = "lemmy_api_structs"
+name = "lemmy_structs"
 path = "src/lib.rs"
 
 [dependencies]
@@ -15,3 +15,7 @@ serde = { version = "1.0.105", features = ["derive"] }
 log = "0.4.0"
 diesel = "1.4.4"
 actix-web = { version = "3.0.0-beta.3", features = ["rustls"] }
+actix = "0.10.0"
+strum = "0.19.2"
+strum_macros = "0.19.2"
+chrono = { version = "0.4.7", features = ["serde"] }
\ No newline at end of file
similarity index 97%
rename from lemmy_api_structs/src/lib.rs
rename to lemmy_structs/src/lib.rs
index dd2a78cda131fc7fe319c00ef59472da1aa32df6..f7140205a284ce4478bd9b3ea8d79fbdf25568ac 100644 (file)
@@ -1,13 +1,18 @@
+extern crate actix;
 extern crate actix_web;
 extern crate diesel;
 extern crate log;
 extern crate serde;
+#[macro_use]
+extern crate strum_macros;
+extern crate chrono;
 
 pub mod comment;
 pub mod community;
 pub mod post;
 pub mod site;
 pub mod user;
+pub mod websocket;
 
 use diesel::PgConnection;
 use lemmy_db::{
similarity index 70%
rename from src/websocket/messages.rs
rename to lemmy_structs/src/websocket.rs
index 2a0e5fde1e6f8b256a9207e76d327c205548c5df..c5c6c5d607703daaed34cf6cd000089f09bf9b75 100644 (file)
@@ -1,9 +1,72 @@
-use crate::websocket::UserOperation;
+use crate::{comment::CommentResponse, post::PostResponse};
 use actix::{prelude::*, Recipient};
-use lemmy_api_structs::{comment::CommentResponse, post::PostResponse};
 use lemmy_utils::{CommunityId, ConnectionId, IPAddr, PostId, UserId};
 use serde::{Deserialize, Serialize};
 
+#[derive(EnumString, ToString, Debug, Clone)]
+pub enum UserOperation {
+  Login,
+  Register,
+  GetCaptcha,
+  CreateCommunity,
+  CreatePost,
+  ListCommunities,
+  ListCategories,
+  GetPost,
+  GetCommunity,
+  CreateComment,
+  EditComment,
+  DeleteComment,
+  RemoveComment,
+  MarkCommentAsRead,
+  SaveComment,
+  CreateCommentLike,
+  GetPosts,
+  CreatePostLike,
+  EditPost,
+  DeletePost,
+  RemovePost,
+  LockPost,
+  StickyPost,
+  SavePost,
+  EditCommunity,
+  DeleteCommunity,
+  RemoveCommunity,
+  FollowCommunity,
+  GetFollowedCommunities,
+  GetUserDetails,
+  GetReplies,
+  GetUserMentions,
+  MarkUserMentionAsRead,
+  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,
+  PostJoin,
+  CommunityJoin,
+}
+
 /// Chat server sends this messages to session
 #[derive(Message)]
 #[rtype(result = "()")]
index 68481a40a4e38513a173bad9a2c7c64044ed7dc4..2f6a23b682c3d6b976e151a8adde64863dfe63b8 100644 (file)
@@ -8,11 +8,15 @@ use crate::{
     Perform,
   },
   apub::{ApubLikeableType, ApubObjectType},
-  websocket::{messages::SendComment, UserOperation},
   LemmyContext,
 };
 use actix_web::web::Data;
-use lemmy_api_structs::{blocking, comment::*, send_local_notifs};
+use lemmy_structs::{
+  blocking,
+  comment::*,
+  send_local_notifs,
+  websocket::{SendComment, UserOperation},
+};
 use lemmy_db::{
   comment::*,
   comment_view::*,
index 7c8c93f14bd195736626c96aac0269e953c37196..e16e7f717bb38de745ed60f054fd0c0ad6cd3ad6 100644 (file)
@@ -1,15 +1,20 @@
 use crate::{
   api::{get_user_from_jwt, get_user_from_jwt_opt, is_admin, is_mod_or_admin, Perform},
   apub::ActorType,
-  websocket::{
-    messages::{GetCommunityUsersOnline, JoinCommunityRoom, SendCommunityRoomMessage},
-    UserOperation,
-  },
   LemmyContext,
 };
 use actix_web::web::Data;
 use anyhow::Context;
-use lemmy_api_structs::{blocking, community::*};
+use lemmy_structs::{
+  blocking,
+  community::*,
+  websocket::{
+    GetCommunityUsersOnline,
+    JoinCommunityRoom,
+    SendCommunityRoomMessage,
+    UserOperation,
+  },
+};
 use lemmy_db::{
   comment::Comment,
   comment_view::CommentQueryBuilder,
index 1aff5d1069aec3a0d6938a89390dbb409b1cab8f..0c66e7d7150a6ed89a77cc789532493dc3ec448b 100644 (file)
@@ -1,6 +1,6 @@
 use crate::{api::claims::Claims, DbPool, LemmyContext};
 use actix_web::web::Data;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   community::Community,
   community_view::CommunityUserBanView,
index d38c10c9de7aeb4d45af550884e41472cbcdf006..4cfb3babda1b0b2cfbf8f879af2d2344ac38630f 100644 (file)
@@ -2,14 +2,14 @@ use crate::{
   api::{check_community_ban, get_user_from_jwt, get_user_from_jwt_opt, is_mod_or_admin, Perform},
   apub::{ApubLikeableType, ApubObjectType},
   fetch_iframely_and_pictrs_data,
-  websocket::{
-    messages::{GetPostUsersOnline, JoinPostRoom, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use actix_web::web::Data;
-use lemmy_api_structs::{blocking, post::*};
+use lemmy_structs::{
+  blocking,
+  post::*,
+  websocket::{GetPostUsersOnline, JoinPostRoom, SendPost, UserOperation},
+};
 use lemmy_db::{
   comment_view::*,
   community_view::*,
index 727078e273d57ee7a5c6035a0b2ca4374adf0196..e0e2b6ff8565709f5ee2341945ddc0cbb0428bdf 100644 (file)
@@ -2,15 +2,16 @@ use crate::{
   api::{get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform},
   apub::fetcher::search_by_apub_id,
   version,
-  websocket::{
-    messages::{GetUsersOnline, SendAllMessage},
-    UserOperation,
-  },
   LemmyContext,
 };
 use actix_web::web::Data;
 use anyhow::Context;
-use lemmy_api_structs::{blocking, site::*, user::Register};
+use lemmy_structs::{
+  blocking,
+  site::*,
+  user::Register,
+  websocket::{GetUsersOnline, SendAllMessage, UserOperation},
+};
 use lemmy_db::{
   category::*,
   comment_view::*,
index 195e93dc4561adfdc88e2eac7ae0b58166ba5c68..3301be9dcbf543f725b28629a60337ee97917458 100644 (file)
@@ -2,10 +2,6 @@ use crate::{
   api::{claims::Claims, get_user_from_jwt, get_user_from_jwt_opt, is_admin, Perform},
   apub::ApubObjectType,
   captcha_espeak_wav_base64,
-  websocket::{
-    messages::{CaptchaItem, CheckCaptcha, JoinUserRoom, SendAllMessage, SendUserRoomMessage},
-    UserOperation,
-  },
   LemmyContext,
 };
 use actix_web::web::Data;
@@ -13,7 +9,18 @@ use anyhow::Context;
 use bcrypt::verify;
 use captcha::{gen, Difficulty};
 use chrono::Duration;
-use lemmy_api_structs::{blocking, user::*};
+use lemmy_structs::{
+  blocking,
+  user::*,
+  websocket::{
+    CaptchaItem,
+    CheckCaptcha,
+    JoinUserRoom,
+    SendAllMessage,
+    SendUserRoomMessage,
+    UserOperation,
+  },
+};
 use lemmy_db::{
   comment::*,
   comment_view::*,
index 78fe6f8abbf21e7101ebbf9dd972471334528f4f..e71eeacde9702f0a9975e8874fb84d9385b73d4b 100644 (file)
@@ -40,7 +40,7 @@ use activitystreams::{
 use actix_web::{body::Body, web, web::Path, HttpResponse};
 use anyhow::Context;
 use itertools::Itertools;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   comment::{Comment, CommentForm},
   community::Community,
index 8f64c671d780bfa4e12729929a101b48e58e22f4..8a11f570233d7b3c7f2ee3badefd27ef920aa5ba 100644 (file)
@@ -38,7 +38,7 @@ use activitystreams_ext::Ext2;
 use actix_web::{body::Body, web, HttpResponse};
 use anyhow::Context;
 use itertools::Itertools;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   community::{Community, CommunityForm},
   community_view::{CommunityFollowerView, CommunityModeratorView},
index 4891a970516b246b9605d6436701bc19d3874d8d..c1caa039b6f75a9b494b0c99383f709992b82ddd 100644 (file)
@@ -15,7 +15,7 @@ use activitystreams::{base::BaseExt, collection::OrderedCollection, object::Note
 use anyhow::{anyhow, Context};
 use chrono::NaiveDateTime;
 use diesel::result::Error::NotFound;
-use lemmy_api_structs::{blocking, site::SearchResponse};
+use lemmy_structs::{blocking, site::SearchResponse};
 use lemmy_db::{
   comment::{Comment, CommentForm},
   comment_view::CommentView,
index 66286ce17df8e5f2125958223810d582c9939bc7..d54834e176dd93a5a80ceecbc63419461c34eed0 100644 (file)
@@ -9,20 +9,17 @@ use crate::{
     FromApub,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Create, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::Context;
-use lemmy_api_structs::{
+use lemmy_structs::{
   blocking,
   comment::CommentResponse,
   post::PostResponse,
   send_local_notifs,
+  websocket::{SendComment, SendPost, UserOperation},
 };
 use lemmy_db::{
   comment::{Comment, CommentForm},
index 4adc7c33c15eedb9586104f69facd3f0c0659bc4..41615132a84ece093b575ff836219ec13e8ef1cb 100644 (file)
@@ -11,20 +11,17 @@ use crate::{
     GroupExt,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendCommunityRoomMessage, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Delete, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::Context;
-use lemmy_api_structs::{
+use lemmy_structs::{
   blocking,
   comment::CommentResponse,
   community::CommunityResponse,
   post::PostResponse,
+  websocket::{SendComment, SendCommunityRoomMessage, SendPost, UserOperation},
 };
 use lemmy_db::{
   comment::{Comment, CommentForm},
index 9b63e82d81103bbd1d834012e6b0b9b1c504ba16..07bf081503a6c2e3ffeb49daac1ece5cbd47be1a 100644 (file)
@@ -9,16 +9,17 @@ use crate::{
     FromApub,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Dislike, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::Context;
-use lemmy_api_structs::{blocking, comment::CommentResponse, post::PostResponse};
+use lemmy_structs::{
+  blocking,
+  comment::CommentResponse,
+  post::PostResponse,
+  websocket::{SendComment, SendPost, UserOperation},
+};
 use lemmy_db::{
   comment::{CommentForm, CommentLike, CommentLikeForm},
   comment_view::CommentView,
index e6f865b932e64faac15702a71f5d2da09e63ffb5..dbb6363daad9198da0625dddaad89a39830480e7 100644 (file)
@@ -9,16 +9,17 @@ use crate::{
     FromApub,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Like, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::Context;
-use lemmy_api_structs::{blocking, comment::CommentResponse, post::PostResponse};
+use lemmy_structs::{
+  blocking,
+  comment::CommentResponse,
+  post::PostResponse,
+  websocket::{SendComment, SendPost, UserOperation},
+};
 use lemmy_db::{
   comment::{CommentForm, CommentLike, CommentLikeForm},
   comment_view::CommentView,
index 011f57b9506663198e1b3053ce30b91d93bb842d..3299d5cfad7cf774ee17555013d8bde9de055d5e 100644 (file)
@@ -12,20 +12,17 @@ use crate::{
     GroupExt,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendCommunityRoomMessage, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Remove, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::{anyhow, Context};
-use lemmy_api_structs::{
+use lemmy_structs::{
   blocking,
   comment::CommentResponse,
   community::CommunityResponse,
   post::PostResponse,
+  websocket::{SendComment, SendCommunityRoomMessage, SendPost, UserOperation},
 };
 use lemmy_db::{
   comment::{Comment, CommentForm},
index bf2073860e49239eeb582fcfe1de1f36fb74af28..c3dad4208c632a4e88304161f93a3e93a1612bac 100644 (file)
@@ -11,10 +11,6 @@ use crate::{
     GroupExt,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendCommunityRoomMessage, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{
@@ -25,11 +21,12 @@ use activitystreams::{
 };
 use actix_web::HttpResponse;
 use anyhow::{anyhow, Context};
-use lemmy_api_structs::{
+use lemmy_structs::{
   blocking,
   comment::CommentResponse,
   community::CommunityResponse,
   post::PostResponse,
+  websocket::{SendComment, SendCommunityRoomMessage, SendPost, UserOperation},
 };
 use lemmy_db::{
   comment::{Comment, CommentForm, CommentLike},
index f078e67aadd3737b68853dc70aa76e756472dccc..137dc0615934e8f5663bf8ee050a24613f7b9476 100644 (file)
@@ -10,20 +10,17 @@ use crate::{
     FromApub,
     PageExt,
   },
-  websocket::{
-    messages::{SendComment, SendPost},
-    UserOperation,
-  },
   LemmyContext,
 };
 use activitystreams::{activity::Update, base::AnyBase, object::Note, prelude::*};
 use actix_web::HttpResponse;
 use anyhow::Context;
-use lemmy_api_structs::{
+use lemmy_structs::{
   blocking,
   comment::CommentResponse,
   post::PostResponse,
   send_local_notifs,
+  websocket::{SendComment, SendPost, UserOperation},
 };
 use lemmy_db::{
   comment::{Comment, CommentForm},
index b27e6b6a90f521c15ecc384d3c12a435093d5cf9..e60c3fe7a85e35bf546c708fce19213e919a6629 100644 (file)
@@ -15,7 +15,7 @@ use activitystreams::{
 };
 use actix_web::{web, HttpRequest, HttpResponse};
 use anyhow::{anyhow, Context};
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   community::{Community, CommunityFollower, CommunityFollowerForm},
   user::User_,
index ccc4d105a4f1ab3be9866e01cc8c880ba2df054d..cf47a597cb0d14f7ae0219653b224c271532615f 100644 (file)
@@ -6,7 +6,6 @@ use crate::{
     insert_activity,
     FromApub,
   },
-  websocket::{messages::SendUserRoomMessage, UserOperation},
   LemmyContext,
 };
 use activitystreams::{
@@ -17,7 +16,11 @@ use activitystreams::{
 };
 use actix_web::{web, HttpRequest, HttpResponse};
 use anyhow::Context;
-use lemmy_api_structs::{blocking, user::PrivateMessageResponse};
+use lemmy_structs::{
+  blocking,
+  user::PrivateMessageResponse,
+  websocket::{SendUserRoomMessage, UserOperation},
+};
 use lemmy_db::{
   community::{CommunityFollower, CommunityFollowerForm},
   naive_now,
index e9184c33a5bf2f8ad81630e5ae87c39e8c6b2a1d..db489622f4ef5f864b81a4b21a7a6d71068ea24c 100644 (file)
@@ -32,7 +32,7 @@ use activitystreams_ext::{Ext1, Ext2};
 use actix_web::{body::Body, HttpResponse};
 use anyhow::{anyhow, Context};
 use chrono::NaiveDateTime;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{activity::do_insert_activity, user::User_};
 use lemmy_utils::{
   apub::get_apub_protocol_string,
index be9e2304b564d89a84529c1c32925dc8cb3aaa74..d2fa7dc5952fe7903feac9bac0096b38e7006a62 100644 (file)
@@ -35,7 +35,7 @@ use activitystreams::{
 use activitystreams_ext::Ext1;
 use actix_web::{body::Body, web, HttpResponse};
 use anyhow::Context;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   community::Community,
   post::{Post, PostForm},
index 6ae30a3f493528c6ad7d8e14d86ca653ad56d96f..00196bfd789f30a35c939b8dbd2abb2c4e2e50c8 100644 (file)
@@ -27,7 +27,7 @@ use activitystreams::{
   prelude::*,
 };
 use anyhow::Context;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   private_message::{PrivateMessage, PrivateMessageForm},
   user::User_,
index 54daadb968e530dd3b4727b8f427f509ada7bba2..5bd6d2579cbc0d113b5e6e4d41e14a23f0656b0e 100644 (file)
@@ -27,7 +27,7 @@ use activitystreams::{
 use activitystreams_ext::Ext1;
 use actix_web::{body::Body, web, HttpResponse};
 use anyhow::Context;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   naive_now,
   user::{UserForm, User_},
index 11b8df7cb618b1eeced54d14ed3e7d7fe5789671..2bab3552aed4c1bf25f49dfc0f4c233d2afc450a 100644 (file)
@@ -1,7 +1,5 @@
 #![recursion_limit = "512"]
 #[macro_use]
-extern crate strum_macros;
-#[macro_use]
 extern crate lazy_static;
 extern crate actix;
 extern crate actix_web;
index 6ec2b81eecfb23fa6fd0eab5240cbd670a086311..39ab014de9875e77831794e5774c45f3c367731b 100644 (file)
@@ -16,7 +16,7 @@ use diesel::{
   PgConnection,
 };
 use lazy_static::lazy_static;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::get_database_url_from_env;
 use lemmy_rate_limit::{rate_limiter::RateLimiter, RateLimit};
 use lemmy_server::{
index 3435b54385f0c0d71f51549e118539d95da36e3e..fffb7cdf06dc2bd2fa50e400a21983f9127725ca 100644 (file)
@@ -1,6 +1,6 @@
 use crate::{api::Perform, LemmyContext};
 use actix_web::{error::ErrorBadRequest, *};
-use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*};
+use lemmy_structs::{comment::*, community::*, post::*, site::*, user::*};
 use lemmy_rate_limit::RateLimit;
 use serde::Deserialize;
 
index 1d86414906217beff7117b12308591332947eeb1..c73b8e0518b2cef3c541aaac7bd1608eb8746352 100644 (file)
@@ -3,7 +3,7 @@ use actix_web::{error::ErrorBadRequest, *};
 use anyhow::anyhow;
 use chrono::{DateTime, NaiveDateTime, Utc};
 use diesel::PgConnection;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{
   comment_view::{ReplyQueryBuilder, ReplyView},
   community::Community,
index 2273fae544aedb25808819b159835b2ae03724a8..20e55cca7f2bc6b40bfb8327c0d7144fc2bee2e8 100644 (file)
@@ -1,7 +1,7 @@
 use crate::{version, LemmyContext};
 use actix_web::{body::Body, error::ErrorBadRequest, *};
 use anyhow::anyhow;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::site_view::SiteView;
 use lemmy_utils::{apub::get_apub_protocol_string, settings::Settings, LemmyError};
 use serde::{Deserialize, Serialize};
index 458fa0f378208e5ba10db26cbdda2df42799831e..1ea38867f490fdbe3e795463d0a45438df361780 100644 (file)
@@ -1,7 +1,7 @@
 use crate::LemmyContext;
 use actix_web::{error::ErrorBadRequest, web::Query, *};
 use anyhow::anyhow;
-use lemmy_api_structs::blocking;
+use lemmy_structs::blocking;
 use lemmy_db::{community::Community, user::User_};
 use lemmy_utils::{
   settings::Settings,
index 540af34faa36c704a2e316f76145c4c7d4362b42..aaa7ef37aead80dd841467b11baba14bc80e06a6 100644 (file)
@@ -1,13 +1,8 @@
-use crate::{
-  websocket::{
-    chat_server::ChatServer,
-    messages::{Connect, Disconnect, StandardMessage, WSMessage},
-  },
-  LemmyContext,
-};
+use crate::{websocket::chat_server::ChatServer, LemmyContext};
 use actix::prelude::*;
 use actix_web::*;
 use actix_web_actors::ws;
+use lemmy_structs::websocket::{Connect, Disconnect, StandardMessage, WSMessage};
 use lemmy_utils::utils::get_ip;
 use log::{debug, error, info};
 use std::time::{Duration, Instant};
index 2da107217b597208bf0187275366fe286f478d52..13106d9d2e892e62910d76f56f7901097fc53fd4 100644 (file)
@@ -1,9 +1,5 @@
 use crate::{
-  websocket::{
-    handlers::{do_user_operation, to_json_string, Args},
-    messages::*,
-    UserOperation,
-  },
+  websocket::handlers::{do_user_operation, to_json_string, Args},
   LemmyContext,
 };
 use actix::prelude::*;
@@ -13,7 +9,7 @@ use diesel::{
   r2d2::{ConnectionManager, Pool},
   PgConnection,
 };
-use lemmy_api_structs::{comment::*, community::*, post::*, site::*, user::*};
+use lemmy_structs::{comment::*, community::*, post::*, site::*, user::*, websocket::*};
 use lemmy_rate_limit::RateLimit;
 use lemmy_utils::{
   location_info,
index a65e88bb552a9c2e3337952060b3baa81fecc1a2..b3c8d5410a29417fa5660c95339ca182efe5d402 100644 (file)
@@ -1,14 +1,11 @@
 use crate::{
   api::Perform,
-  websocket::{
-    chat_server::{ChatServer, SessionInfo},
-    messages::*,
-    UserOperation,
-  },
+  websocket::chat_server::{ChatServer, SessionInfo},
   LemmyContext,
 };
 use actix::{Actor, Context, Handler, ResponseFuture};
 use actix_web::web;
+use lemmy_structs::websocket::*;
 use lemmy_db::naive_now;
 use lemmy_rate_limit::RateLimit;
 use lemmy_utils::{ConnectionId, IPAddr, LemmyError};
index 42793a7862a62f05e19b54294c9834a3b070ca19..e892f78f8f4c9fe597e1eb44ab9b4d8501b86797 100644 (file)
@@ -1,67 +1,2 @@
 pub mod chat_server;
 pub mod handlers;
-pub mod messages;
-
-#[derive(EnumString, ToString, Debug, Clone)]
-pub enum UserOperation {
-  Login,
-  Register,
-  GetCaptcha,
-  CreateCommunity,
-  CreatePost,
-  ListCommunities,
-  ListCategories,
-  GetPost,
-  GetCommunity,
-  CreateComment,
-  EditComment,
-  DeleteComment,
-  RemoveComment,
-  MarkCommentAsRead,
-  SaveComment,
-  CreateCommentLike,
-  GetPosts,
-  CreatePostLike,
-  EditPost,
-  DeletePost,
-  RemovePost,
-  LockPost,
-  StickyPost,
-  SavePost,
-  EditCommunity,
-  DeleteCommunity,
-  RemoveCommunity,
-  FollowCommunity,
-  GetFollowedCommunities,
-  GetUserDetails,
-  GetReplies,
-  GetUserMentions,
-  MarkUserMentionAsRead,
-  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,
-  PostJoin,
-  CommunityJoin,
-}