Riley
a074564458
* Asyncify more * I guess these changed * Clean PR a bit * Convert more away from failure error * config changes for testing federation * It was DNS So actix-web's client relies on TRust DNS Resolver to figure out where to send data, but TRust DNS Resolver seems to not play nice with docker, which expressed itself as not resolving the name to an IP address _the first time_ when making a request. The fix was literally to make the request again (which I limited to 3 times total, and not exceeding the request timeout in total) * Only retry for connecterror Since TRust DNS Resolver was causing ConnectError::Timeout, this change limits the retry to only this error, returning immediately for any other error * Use http sig norm 0.4.0-alpha for actix-web 3.0 support * Blocking function, retry http requests * cargo +nightly fmt * Only create one pictrs dir * Don't yarn build * cargo +nightly fmt
73 lines
1.3 KiB
Rust
73 lines
1.3 KiB
Rust
pub mod server;
|
|
|
|
use crate::ConnectionId;
|
|
use actix::prelude::*;
|
|
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;
|
|
use std::{
|
|
collections::{HashMap, HashSet},
|
|
str::FromStr,
|
|
};
|
|
|
|
#[derive(EnumString, ToString, Debug, Clone)]
|
|
pub enum UserOperation {
|
|
Login,
|
|
Register,
|
|
CreateCommunity,
|
|
CreatePost,
|
|
ListCommunities,
|
|
ListCategories,
|
|
GetPost,
|
|
GetCommunity,
|
|
CreateComment,
|
|
EditComment,
|
|
SaveComment,
|
|
CreateCommentLike,
|
|
GetPosts,
|
|
CreatePostLike,
|
|
EditPost,
|
|
SavePost,
|
|
EditCommunity,
|
|
FollowCommunity,
|
|
GetFollowedCommunities,
|
|
GetUserDetails,
|
|
GetReplies,
|
|
GetUserMentions,
|
|
EditUserMention,
|
|
GetModlog,
|
|
BanFromCommunity,
|
|
AddModToCommunity,
|
|
CreateSite,
|
|
EditSite,
|
|
GetSite,
|
|
AddAdmin,
|
|
BanUser,
|
|
Search,
|
|
MarkAllAsRead,
|
|
SaveUserSettings,
|
|
TransferCommunity,
|
|
TransferSite,
|
|
DeleteAccount,
|
|
PasswordReset,
|
|
PasswordChange,
|
|
CreatePrivateMessage,
|
|
EditPrivateMessage,
|
|
GetPrivateMessages,
|
|
UserJoin,
|
|
GetComments,
|
|
GetSiteConfig,
|
|
SaveSiteConfig,
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct WebsocketInfo {
|
|
pub chatserver: Addr<ChatServer>,
|
|
pub id: Option<ConnectionId>,
|
|
}
|