summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix <me@nutomic.com>2020-05-16 16:04:08 +0200
committerFelix <me@nutomic.com>2020-05-16 20:04:17 +0200
commit9e61c3be94c623b43b2e87ed060bfebc041d1eaa (patch)
treef622a2e429363febf43e021038c67ae8d55dfb1d
parent3a4973ad68562f9ccb4a9f4442333e0478bc7b04 (diff)
Rework imports
-rw-r--r--server/.rustfmt.toml5
-rw-r--r--server/Cargo.lock26
-rw-r--r--server/Cargo.toml6
-rw-r--r--server/src/api/comment.rs39
-rw-r--r--server/src/api/community.rs39
-rw-r--r--server/src/api/mod.rs45
-rw-r--r--server/src/api/post.rs37
-rw-r--r--server/src/api/site.rs33
-rw-r--r--server/src/api/user.rs54
-rw-r--r--server/src/apub/activities.rs8
-rw-r--r--server/src/apub/comment.rs34
-rw-r--r--server/src/apub/community.rs40
-rw-r--r--server/src/apub/community_inbox.rs21
-rw-r--r--server/src/apub/extensions/group_extensions.rs6
-rw-r--r--server/src/apub/extensions/page_extension.rs3
-rw-r--r--server/src/apub/extensions/signatures.rs9
-rw-r--r--server/src/apub/fetcher.rs41
-rw-r--r--server/src/apub/mod.rs73
-rw-r--r--server/src/apub/post.rs36
-rw-r--r--server/src/apub/private_message.rs26
-rw-r--r--server/src/apub/shared_inbox.rs38
-rw-r--r--server/src/apub/user.rs31
-rw-r--r--server/src/apub/user_inbox.rs30
-rw-r--r--server/src/db/activity.rs9
-rw-r--r--server/src/db/category.rs11
-rw-r--r--server/src/db/code_migrations.rs22
-rw-r--r--server/src/db/comment.rs19
-rw-r--r--server/src/db/comment_view.rs16
-rw-r--r--server/src/db/community.rs14
-rw-r--r--server/src/db/community_view.rs5
-rw-r--r--server/src/db/mod.rs4
-rw-r--r--server/src/db/moderator.rs30
-rw-r--r--server/src/db/moderator_views.rs4
-rw-r--r--server/src/db/password_reset_request.rs12
-rw-r--r--server/src/db/post.rs21
-rw-r--r--server/src/db/post_view.rs15
-rw-r--r--server/src/db/private_message.rs15
-rw-r--r--server/src/db/private_message_view.rs5
-rw-r--r--server/src/db/site.rs5
-rw-r--r--server/src/db/site_view.rs3
-rw-r--r--server/src/db/user.rs17
-rw-r--r--server/src/db/user_mention.rs16
-rw-r--r--server/src/db/user_mention_view.rs5
-rw-r--r--server/src/db/user_view.rs5
-rw-r--r--server/src/lib.rs17
-rw-r--r--server/src/main.rs6
-rw-r--r--server/src/rate_limit/mod.rs25
-rw-r--r--server/src/rate_limit/rate_limiter.rs7
-rw-r--r--server/src/routes/api.rs15
-rw-r--r--server/src/routes/federation.rs23
-rw-r--r--server/src/routes/feeds.rs37
-rw-r--r--server/src/routes/index.rs4
-rw-r--r--server/src/routes/mod.rs37
-rw-r--r--server/src/routes/nodeinfo.rs11
-rw-r--r--server/src/routes/webfinger.rs7
-rw-r--r--server/src/routes/websocket.rs11
-rw-r--r--server/src/settings.rs5
-rw-r--r--server/src/websocket/mod.rs12
-rw-r--r--server/src/websocket/server.rs21
59 files changed, 849 insertions, 322 deletions
diff --git a/server/.rustfmt.toml b/server/.rustfmt.toml
index 684a7f8a..f3efdc30 100644
--- a/server/.rustfmt.toml
+++ b/server/.rustfmt.toml
@@ -1,2 +1,5 @@
tab_spaces = 2
-edition="2018" \ No newline at end of file
+edition="2018"
+imports_layout="HorizontalVertical"
+merge_imports=true
+reorder_imports=true
diff --git a/server/Cargo.lock b/server/Cargo.lock
index 714422b6..cc43028b 100644
--- a/server/Cargo.lock
+++ b/server/Cargo.lock
@@ -2,9 +2,9 @@
# It is not intended for manual editing.
[[package]]
name = "activitystreams"
-version = "0.6.0"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dd5b29a0f2c64cc56f2b79ec29cab68a9dab3b714d811a55668d072f18a8638e"
+checksum = "464cb473bfb402b857cc15b1153974c203a43f1485da4dda15cd17a738548958"
dependencies = [
"activitystreams-derive",
"chrono",
@@ -27,6 +27,17 @@ dependencies = [
]
[[package]]
+name = "activitystreams-new"
+version = "0.1.0"
+source = "git+https://git.asonix.dog/asonix/activitystreams-sketch#3f75e56190bd2e942621e8265435c74132639a47"
+dependencies = [
+ "activitystreams",
+ "serde 1.0.106",
+ "serde_json 1.0.51",
+ "typed-builder",
+]
+
+[[package]]
name = "actix"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1544,6 +1555,7 @@ name = "lemmy_server"
version = "0.0.1"
dependencies = [
"activitystreams",
+ "activitystreams-new",
"actix",
"actix-files",
"actix-rt",
@@ -2993,6 +3005,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d"
[[package]]
+name = "typed-builder"
+version = "0.5.1"
+source = "git+https://git.asonix.dog/asonix/typed-builder#3dadcaaa6184ef720093c8f0632a7d423d2537b0"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
name = "typenum"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/server/Cargo.toml b/server/Cargo.toml
index ab76d06f..2c11c191 100644
--- a/server/Cargo.toml
+++ b/server/Cargo.toml
@@ -4,11 +4,15 @@ version = "0.0.1"
authors = ["Dessalines <happydooby@gmail.com>"]
edition = "2018"
+[patch.crates-io]
+typed-builder = { git = "https://git.asonix.dog/asonix/typed-builder" }
+
[dependencies]
diesel = { version = "1.4.4", features = ["postgres","chrono","r2d2","64-column-tables","serde_json"] }
diesel_migrations = "1.4.0"
dotenv = "0.15.0"
-activitystreams = "0.6.0"
+activitystreams = "0.6.2"
+activitystreams-new = { version = "0.1.0", git = "https://git.asonix.dog/asonix/activitystreams-sketch" }
bcrypt = "0.6.2"
chrono = { version = "0.4.7", features = ["serde"] }
failure = "0.1.5"
diff --git a/server/src/api/comment.rs b/server/src/api/comment.rs
index 0660a52c..40f87ac9 100644
--- a/server/src/api/comment.rs
+++ b/server/src/api/comment.rs
@@ -1,4 +1,41 @@
-use super::*;
+use crate::{
+ api::{APIError, Oper, Perform},
+ apub::{ApubLikeableType, ApubObjectType},
+ db::{
+ comment::*,
+ comment_view::*,
+ community_view::*,
+ moderator::*,
+ post::*,
+ site_view::*,
+ user::*,
+ user_mention::*,
+ user_view::*,
+ Crud,
+ Likeable,
+ ListingType,
+ Saveable,
+ SortType,
+ },
+ extract_usernames,
+ naive_now,
+ remove_slurs,
+ send_email,
+ settings::Settings,
+ websocket::{
+ server::{JoinCommunityRoom, SendComment},
+ UserOperation,
+ WebsocketInfo,
+ },
+};
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use failure::Error;
+use log::error;
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
#[derive(Serialize, Deserialize)]
pub struct CreateComment {
diff --git a/server/src/api/community.rs b/server/src/api/community.rs
index 55c55ee1..cb412fcc 100644
--- a/server/src/api/community.rs
+++ b/server/src/api/community.rs
@@ -1,4 +1,41 @@
-use super::*;
+use crate::{
+ api::{APIError, Oper, Perform},
+ apub::{
+ extensions::signatures::generate_actor_keypair,
+ make_apub_endpoint,
+ ActorType,
+ EndpointType,
+ },
+ db::{
+ community::*,
+ community_view::*,
+ moderator::*,
+ site::*,
+ user::*,
+ user_view::*,
+ Bannable,
+ Crud,
+ Followable,
+ Joinable,
+ SortType,
+ },
+ naive_from_unix,
+ naive_now,
+ slur_check,
+ slurs_vec_to_str,
+ websocket::{
+ server::{JoinCommunityRoom, SendCommunityRoomMessage},
+ UserOperation,
+ WebsocketInfo,
+ },
+};
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use failure::Error;
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
#[derive(Serialize, Deserialize)]
pub struct GetCommunity {
diff --git a/server/src/api/mod.rs b/server/src/api/mod.rs
index 9112a3be..5120e9bc 100644
--- a/server/src/api/mod.rs
+++ b/server/src/api/mod.rs
@@ -1,46 +1,9 @@
-use crate::db::category::*;
-use crate::db::comment::*;
-use crate::db::comment_view::*;
-use crate::db::community::*;
-use crate::db::community_view::*;
-use crate::db::moderator::*;
-use crate::db::moderator_views::*;
-use crate::db::password_reset_request::*;
-use crate::db::post::*;
-use crate::db::post_view::*;
-use crate::db::private_message::*;
-use crate::db::private_message_view::*;
-use crate::db::site::*;
-use crate::db::site_view::*;
-use crate::db::user::*;
-use crate::db::user_mention::*;
-use crate::db::user_mention_view::*;
-use crate::db::user_view::*;
-use crate::db::*;
-use crate::{
- extract_usernames, fetch_iframely_and_pictshare_data, generate_random_string, naive_from_unix,
- naive_now, remove_slurs, send_email, slur_check, slurs_vec_to_str,
+use crate::websocket::WebsocketInfo;
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
};
-
-use crate::apub::{
- extensions::signatures::generate_actor_keypair,
- fetcher::search_by_apub_id,
- {make_apub_endpoint, ActorType, ApubLikeableType, ApubObjectType, EndpointType},
-};
-use crate::settings::Settings;
-use crate::websocket::{
- server::{
- JoinCommunityRoom, JoinPostRoom, JoinUserRoom, SendAllMessage, SendComment,
- SendCommunityRoomMessage, SendPost, SendUserRoomMessage,
- },
- UserOperation, WebsocketInfo,
-};
-use diesel::r2d2::{ConnectionManager, Pool};
-use diesel::PgConnection;
use failure::Error;
-use log::{debug, error, info};
-use serde::{Deserialize, Serialize};
-use std::str::FromStr;
pub mod comment;
pub mod community;
diff --git a/server/src/api/post.rs b/server/src/api/post.rs
index 42c35074..9bbde791 100644
--- a/server/src/api/post.rs
+++ b/server/src/api/post.rs
@@ -1,4 +1,39 @@
-use super::*;
+use crate::{
+ api::{APIError, Oper, Perform},
+ apub::{ApubLikeableType, ApubObjectType},
+ db::{
+ comment_view::*,
+ community_view::*,
+ moderator::*,
+ post::*,
+ post_view::*,
+ site::*,
+ site_view::*,
+ user::*,
+ user_view::*,
+ Crud,
+ Likeable,
+ ListingType,
+ Saveable,
+ SortType,
+ },
+ fetch_iframely_and_pictshare_data,
+ naive_now,
+ slur_check,
+ slurs_vec_to_str,
+ websocket::{
+ server::{JoinCommunityRoom, JoinPostRoom, SendPost},
+ UserOperation,
+ WebsocketInfo,
+ },
+};
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use failure::Error;
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
#[derive(Serialize, Deserialize, Debug)]
pub struct CreatePost {
diff --git a/server/src/api/site.rs b/server/src/api/site.rs
index 1a4ed0be..faee30cb 100644
--- a/server/src/api/site.rs
+++ b/server/src/api/site.rs
@@ -1,5 +1,36 @@
use super::user::Register;
-use super::*;
+use crate::{
+ api::{APIError, Oper, Perform},
+ apub::fetcher::search_by_apub_id,
+ db::{
+ category::*,
+ comment_view::*,
+ community_view::*,
+ moderator::*,
+ moderator_views::*,
+ post_view::*,
+ site::*,
+ site_view::*,
+ user::*,
+ user_view::*,
+ Crud,
+ SearchType,
+ SortType,
+ },
+ naive_now,
+ settings::Settings,
+ slur_check,
+ slurs_vec_to_str,
+ websocket::{server::SendAllMessage, UserOperation, WebsocketInfo},
+};
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use failure::Error;
+use log::{debug, info};
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
#[derive(Serialize, Deserialize)]
pub struct ListCategories {}
diff --git a/server/src/api/user.rs b/server/src/api/user.rs
index b5336609..18d30985 100644
--- a/server/src/api/user.rs
+++ b/server/src/api/user.rs
@@ -1,5 +1,57 @@
-use super::*;
+use crate::{
+ api::{APIError, Oper, Perform},
+ apub::{
+ extensions::signatures::generate_actor_keypair,
+ make_apub_endpoint,
+ ApubObjectType,
+ EndpointType,
+ },
+ db::{
+ comment::*,
+ comment_view::*,
+ community::*,
+ community_view::*,
+ moderator::*,
+ password_reset_request::*,
+ post::*,
+ post_view::*,
+ private_message::*,
+ private_message_view::*,
+ site::*,
+ site_view::*,
+ user::*,
+ user_mention::*,
+ user_mention_view::*,
+ user_view::*,
+ Crud,
+ Followable,
+ Joinable,
+ ListingType,
+ SortType,
+ },
+ generate_random_string,
+ naive_from_unix,
+ naive_now,
+ remove_slurs,
+ send_email,
+ settings::Settings,
+ slur_check,
+ slurs_vec_to_str,
+ websocket::{
+ server::{JoinUserRoom, SendAllMessage, SendUserRoomMessage},
+ UserOperation,
+ WebsocketInfo,
+ },
+};
use bcrypt::verify;
+use diesel::{
+ r2d2::{ConnectionManager, Pool},
+ PgConnection,
+};
+use failure::Error;
+use log::error;
+use serde::{Deserialize, Serialize};
+use std::str::FromStr;
#[derive(Serialize, Deserialize, Debug)]
pub struct Login {
diff --git a/server/src/apub/activities.rs b/server/src/apub/activities.rs
index 23ae9698..655e4a7a 100644
--- a/server/src/apub/activities.rs
+++ b/server/src/apub/activities.rs
@@ -1,4 +1,10 @@
-use super::*;
+use crate::apub::{extensions::signatures::sign, is_apub_id_valid, ActorType};
+use activitystreams::{context, object::properties::ObjectProperties, public};
+use failure::{Error, _core::fmt::Debug};
+use isahc::prelude::*;
+use log::debug;
+use serde::Serialize;
+use url::Url;
pub fn populate_object_props(
props: &mut ObjectProperties,
diff --git a/server/src/apub/comment.rs b/server/src/apub/comment.rs
index df41f67b..97f9c272 100644
--- a/server/src/apub/comment.rs
+++ b/server/src/apub/comment.rs
@@ -1,4 +1,36 @@
-use super::*;
+use crate::{
+ apub::{
+ activities::{populate_object_props, send_activity},
+ create_apub_response,
+ create_apub_tombstone_response,
+ create_tombstone,
+ fetcher::get_or_fetch_and_upsert_remote_user,
+ ActorType,
+ ApubLikeableType,
+ ApubObjectType,
+ FromApub,
+ ToApub,
+ },
+ convert_datetime,
+ db::{
+ activity::insert_activity,
+ comment::{Comment, CommentForm},
+ community::Community,
+ post::Post,
+ user::User_,
+ Crud,
+ },
+ routes::DbPoolParam,
+};
+use activitystreams::{
+ activity::{Create, Delete, Dislike, Like, Remove, Undo, Update},
+ context,
+ object::{kind::NoteType, properties::ObjectProperties, Note, Tombstone},
+};
+use actix_web::{body::Body, web::Path, HttpResponse, Result};
+use diesel::PgConnection;
+use failure::Error;
+use serde::Deserialize;
#[derive(Deserialize)]
pub struct CommentQuery {
diff --git a/server/src/apub/community.rs b/server/src/apub/community.rs
index f4e8848f..12ce2800 100644
--- a/server/src/apub/community.rs
+++ b/server/src/apub/community.rs
@@ -1,4 +1,42 @@
-use super::*;
+use crate::{
+ apub::{
+ activities::{populate_object_props, send_activity},
+ create_apub_response,
+ create_apub_tombstone_response,
+ create_tombstone,
+ extensions::{group_extensions::GroupExtension, signatures::PublicKey},
+ fetcher::get_or_fetch_and_upsert_remote_user,
+ get_shared_inbox,
+ ActorType,
+ FromApub,
+ GroupExt,
+ ToApub,
+ },
+ convert_datetime,
+ db::{
+ activity::insert_activity,
+ community::{Community, CommunityForm},
+ community_view::{CommunityFollowerView, CommunityModeratorView},
+ user::User_,
+ },
+ naive_now,
+ routes::DbPoolParam,
+};
+use activitystreams::{
+ activity::{Accept, Delete, Follow, Remove, Undo},
+ actor::{kind::GroupType, properties::ApActorProperties, Group},
+ collection::UnorderedCollection,
+ context,
+ endpoint::EndpointProperties,
+ ext::Extensible,
+ object::{properties::ObjectProperties, Tombstone},
+ BaseBox,
+};
+use actix_web::{body::Body, web::Path, HttpResponse, Result};
+use diesel::PgConnection;
+use failure::Error;
+use itertools::Itertools;
+use serde::Deserialize;
#[derive(Deserialize)]
pub struct CommunityQuery {
diff --git a/server/src/apub/community_inbox.rs b/server/src/apub/community_inbox.rs
index 6c35ce0a..2ae2e0eb 100644
--- a/server/src/apub/community_inbox.rs
+++ b/server/src/apub/community_inbox.rs
@@ -1,4 +1,23 @@
-use super::*;
+use crate::{
+ apub::{
+ extensions::signatures::verify,
+ fetcher::{get_or_fetch_and_upsert_remote_community, get_or_fetch_and_upsert_remote_user},
+ ActorType,
+ },
+ db::{
+ activity::insert_activity,
+ community::{Community, CommunityFollower, CommunityFollowerForm},
+ user::User_,
+ Followable,
+ },
+ routes::{ChatServerParam, DbPoolParam},
+};
+use activitystreams::activity::{Follow, Undo};
+use actix_web::{web, HttpRequest, HttpResponse, Result};
+use diesel::PgConnection;
+use failure::{Error, _core::fmt::Debug};
+use log::debug;
+use serde::Deserialize;
#[serde(untagged)]
#[derive(Deserialize, Debug)]
diff --git a/server/src/apub/extensions/group_extensions.rs b/server/src/apub/extensions/group_extensions.rs
index 10cee5c7..ece97706 100644
--- a/server/src/apub/extensions/group_extensions.rs
+++ b/server/src/apub/extensions/group_extensions.rs
@@ -1,7 +1,5 @@
-use crate::db::category::Category;
-use crate::db::Crud;
-use activitystreams::ext::Extension;
-use activitystreams::Actor;
+use crate::db::{category::Category, Crud};
+use activitystreams::{ext::Extension, Actor};
use diesel::PgConnection;
use failure::Error;
use serde::{Deserialize, Serialize};
diff --git a/server/src/apub/extensions/page_extension.rs b/server/src/apub/extensions/page_extension.rs
index 435a869a..484807e3 100644
--- a/server/src/apub/extensions/page_extension.rs
+++ b/server/src/apub/extensions/page_extension.rs
@@ -1,5 +1,4 @@
-use activitystreams::ext::Extension;
-use activitystreams::Base;
+use activitystreams::{ext::Extension, Base};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
diff --git a/server/src/apub/extensions/signatures.rs b/server/src/apub/extensions/signatures.rs
index e8630f21..a7848827 100644
--- a/server/src/apub/extensions/signatures.rs
+++ b/server/src/apub/extensions/signatures.rs
@@ -5,9 +5,12 @@ use failure::Error;
use http::request::Builder;
use http_signature_normalization::Config;
use log::debug;
-use openssl::hash::MessageDigest;
-use openssl::sign::{Signer, Verifier};
-use openssl::{pkey::PKey, rsa::Rsa};
+use openssl::{
+ hash::MessageDigest,
+ pkey::PKey,
+ rsa::Rsa,
+ sign::{Signer, Verifier},
+};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
diff --git a/server/src/apub/fetcher.rs b/server/src/apub/fetcher.rs
index 994e75f2..9379dd96 100644
--- a/server/src/apub/fetcher.rs
+++ b/server/src/apub/fetcher.rs
@@ -1,4 +1,43 @@
-use super::*;
+use activitystreams::object::Note;
+use actix_web::Result;
+use diesel::{result::Error::NotFound, PgConnection};
+use failure::{Error, _core::fmt::Debug};
+use isahc::prelude::*;
+use log::debug;
+use serde::Deserialize;
+use std::time::Duration;
+use url::Url;
+
+use crate::{
+ api::site::SearchResponse,
+ db::{
+ comment::{Comment, CommentForm},
+ comment_view::CommentView,
+ community::{Community, CommunityForm, CommunityModerator, CommunityModeratorForm},
+ community_view::CommunityView,
+ post::{Post, PostForm},
+ post_view::PostView,
+ user::{UserForm, User_},
+ Crud,
+ Joinable,
+ SearchType,
+ },
+ naive_now,
+ routes::nodeinfo::{NodeInfo, NodeInfoWellKnown},
+};
+
+use crate::{
+ apub::{
+ get_apub_protocol_string,
+ is_apub_id_valid,
+ FromApub,
+ GroupExt,
+ PageExt,
+ PersonExt,
+ APUB_JSON_CONTENT_TYPE,
+ },
+ db::user_view::UserView,
+};
// Fetch nodeinfo metadata from a remote instance.
fn _fetch_node_info(domain: &str) -> Result<NodeInfo, Error> {
diff --git a/server/src/apub/mod.rs b/server/src/apub/mod.rs
index 6ff6a0f8..fdd78109 100644
--- a/server/src/apub/mod.rs
+++ b/server/src/apub/mod.rs
@@ -10,68 +10,29 @@ pub mod shared_inbox;
pub mod user;
pub mod user_inbox;
-use crate::api::community::CommunityResponse;
-use crate::db::activity::insert_activity;
-use crate::websocket::server::SendCommunityRoomMessage;
-use activitystreams::object::kind::{NoteType, PageType};
+use crate::{
+ apub::extensions::{
+ group_extensions::GroupExtension,
+ page_extension::PageExtension,
+ signatures::{PublicKey, PublicKeyExtension},
+ },
+ convert_datetime,
+ db::user::User_,
+ Settings,
+};
use activitystreams::{
- activity::{Accept, Create, Delete, Dislike, Follow, Like, Remove, Undo, Update},
- actor::{kind::GroupType, properties::ApActorProperties, Group, Person},
- collection::UnorderedCollection,
- context,
- endpoint::EndpointProperties,
- ext::{Ext, Extensible},
- object::{properties::ObjectProperties, Note, Page, Tombstone},
- public, BaseBox,
+ activity::Follow,
+ actor::{properties::ApActorProperties, Group, Person},
+ ext::Ext,
+ object::{Page, Tombstone},
};
-use actix_web::body::Body;
-use actix_web::web::Path;
-use actix_web::{web, HttpRequest, HttpResponse, Result};
-use diesel::result::Error::NotFound;
+use actix_web::{body::Body, HttpResponse, Result};
+use chrono::NaiveDateTime;
use diesel::PgConnection;
use failure::Error;
-use failure::_core::fmt::Debug;
-use isahc::prelude::*;
-use itertools::Itertools;
-use log::debug;
-use serde::{Deserialize, Serialize};
-use std::time::Duration;
+use serde::Serialize;
use url::Url;
-use crate::api::comment::CommentResponse;
-use crate::api::post::PostResponse;
-use crate::api::site::SearchResponse;
-use crate::api::user::PrivateMessageResponse;
-use crate::db::comment::{Comment, CommentForm, CommentLike, CommentLikeForm