}
}
-pub fn send_community_websocket(
+fn send_community_websocket(
res: &CommunityResponse,
context: &Data<LemmyContext>,
websocket_id: Option<ConnectionId>,
) -> Result<Self::Response, LemmyError>;
}
-pub(in crate) async fn is_mod_or_admin(
+pub(crate) async fn is_mod_or_admin(
pool: &DbPool,
user_id: i32,
community_id: i32,
Ok(())
}
-pub(in crate) async fn get_post(post_id: i32, pool: &DbPool) -> Result<Post, LemmyError> {
+pub(crate) async fn get_post(post_id: i32, pool: &DbPool) -> Result<Post, LemmyError> {
match blocking(pool, move |conn| Post::read(conn, post_id)).await? {
Ok(post) => Ok(post),
Err(_e) => Err(APIError::err("couldnt_find_post").into()),
}
}
-pub(in crate) async fn get_user_from_jwt(jwt: &str, pool: &DbPool) -> Result<User_, LemmyError> {
+pub(crate) async fn get_user_from_jwt(jwt: &str, pool: &DbPool) -> Result<User_, LemmyError> {
let claims = match Claims::decode(&jwt) {
Ok(claims) => claims.claims,
Err(_e) => return Err(APIError::err("not_logged_in").into()),
Ok(user)
}
-pub(in crate) async fn get_user_from_jwt_opt(
+pub(crate) async fn get_user_from_jwt_opt(
jwt: &Option<String>,
pool: &DbPool,
) -> Result<Option<User_>, LemmyError> {
}
}
-pub(in crate) async fn check_community_ban(
+pub(crate) async fn check_community_ban(
user_id: i32,
community_id: i32,
pool: &DbPool,
}
}
-pub(in crate) fn check_optional_url(item: &Option<Option<String>>) -> Result<(), LemmyError> {
+pub(crate) fn check_optional_url(item: &Option<Option<String>>) -> Result<(), LemmyError> {
if let Some(Some(item)) = &item {
if Url::parse(item).is_err() {
return Err(APIError::err("invalid_url").into());
Ok(())
}
-pub(in crate) async fn linked_instances(pool: &DbPool) -> Result<Vec<String>, LemmyError> {
+pub(crate) async fn linked_instances(pool: &DbPool) -> Result<Vec<String>, LemmyError> {
let mut instances: Vec<String> = Vec::new();
if Settings::get().federation.enabled {
-pub mod receive;
-pub mod send;
+pub(crate) mod receive;
+pub(crate) mod send;
use url::{ParseError, Url};
use uuid::Uuid;
-pub mod comment;
-pub mod community;
-pub mod post;
-pub mod private_message;
-pub mod user;
+pub(crate) mod comment;
+pub(crate) mod community;
+pub(crate) mod post;
+pub(crate) mod private_message;
+pub(crate) mod user;
/// Generate a unique ID for an activity, in the format:
/// `http(s)://example.com/receive/create/202daf0a-1489-45df-8d2e-c8a3173fed36`
-pub mod group_extensions;
-pub mod page_extension;
-pub mod signatures;
+pub(crate) mod group_extensions;
+pub(crate) mod page_extension;
+pub(crate) mod signatures;
/// The types of ActivityPub objects that can be fetched directly by searching for their ID.
#[serde(untagged)]
#[derive(serde::Deserialize, Debug)]
-pub enum SearchAcceptedObjects {
+enum SearchAcceptedObjects {
Person(Box<PersonExt>),
Group(Box<GroupExt>),
Page(Box<PageExt>),
use lemmy_utils::{location_info, utils::convert_datetime, LemmyError};
use url::Url;
-pub mod comment;
-pub mod community;
-pub mod post;
-pub mod private_message;
-pub mod user;
+pub(crate) mod comment;
+pub(crate) mod community;
+pub(crate) mod post;
+pub(crate) mod private_message;
+pub(crate) mod user;
/// Updated is actually the deletion time
fn create_tombstone<T>(
use strum::IntoEnumIterator;
#[derive(Debug, Clone)]
-pub struct RateLimitBucket {
+struct RateLimitBucket {
last_checked: SystemTime,
allowance: f64,
}
#[derive(Eq, PartialEq, Hash, Debug, EnumIter, Copy, Clone, AsRefStr)]
-pub enum RateLimitType {
+pub(crate) enum RateLimitType {
Message,
Register,
Post,
/// Rate limiting based on rate type and IP addr
#[derive(Debug, Clone)]
pub struct RateLimiter {
- pub buckets: HashMap<RateLimitType, HashMap<IPAddr, RateLimitBucket>>,
+ buckets: HashMap<RateLimitType, HashMap<IPAddr, RateLimitBucket>>,
}
impl Default for RateLimiter {
use strum::ParseError;
#[derive(Deserialize)]
-pub struct Params {
+struct Params {
sort: Option<String>,
}
}
#[derive(Debug, Serialize, Deserialize)]
-pub struct Image {
+struct Image {
file: String,
delete_token: String,
}
#[derive(Debug, Serialize, Deserialize)]
-pub struct Images {
+struct Images {
msg: String,
files: Option<Vec<Image>>,
}
#[derive(Deserialize)]
-pub struct PictrsParams {
+struct PictrsParams {
format: Option<String>,
thumbnail: Option<String>,
}
}
#[derive(Serialize, Deserialize, Debug)]
-pub struct NodeInfoWellKnown {
+struct NodeInfoWellKnown {
pub links: NodeInfoWellKnownLinks,
}
#[derive(Serialize, Deserialize, Debug)]
-pub struct NodeInfoWellKnownLinks {
+struct NodeInfoWellKnownLinks {
pub rel: Url,
pub href: Url,
}
#[derive(Serialize, Deserialize, Debug)]
-pub struct NodeInfo {
+struct NodeInfo {
pub version: String,
pub software: NodeInfoSoftware,
pub protocols: Vec<String>,
}
#[derive(Serialize, Deserialize, Debug)]
-pub struct NodeInfoSoftware {
+struct NodeInfoSoftware {
pub name: String,
pub version: String,
}
#[derive(Serialize, Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
-pub struct NodeInfoUsage {
+struct NodeInfoUsage {
pub users: NodeInfoUsers,
pub local_posts: i64,
pub local_comments: i64,
}
#[derive(Serialize, Deserialize, Debug)]
-pub struct NodeInfoUsers {
+struct NodeInfoUsers {
pub total: i64,
}
use serde::Deserialize;
#[derive(Deserialize)]
-pub struct Params {
+struct Params {
resource: String,
}