mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-15 00:43:59 +00:00
Merge pull request 'Reduce visibility of some structs and methods (replaces #1266)' (#132) from reduce-visibility into main
Reviewed-on: https://yerbamate.ml/LemmyNet/lemmy/pulls/132
This commit is contained in:
commit
eee394cf85
18 changed files with 50 additions and 50 deletions
|
@ -1 +1 @@
|
||||||
v0.8.3
|
v0.8.4
|
||||||
|
|
|
@ -16,7 +16,7 @@ services:
|
||||||
- postgres
|
- postgres
|
||||||
- iframely
|
- iframely
|
||||||
lemmy-ui:
|
lemmy-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
ports:
|
ports:
|
||||||
- "1235:1234"
|
- "1235:1234"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -29,7 +29,7 @@ services:
|
||||||
- ./volumes/pictrs_alpha:/mnt
|
- ./volumes/pictrs_alpha:/mnt
|
||||||
|
|
||||||
lemmy-alpha-ui:
|
lemmy-alpha-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
environment:
|
environment:
|
||||||
- LEMMY_INTERNAL_HOST=lemmy-alpha:8541
|
- LEMMY_INTERNAL_HOST=lemmy-alpha:8541
|
||||||
- LEMMY_EXTERNAL_HOST=localhost:8541
|
- LEMMY_EXTERNAL_HOST=localhost:8541
|
||||||
|
@ -68,7 +68,7 @@ services:
|
||||||
- ./volumes/postgres_alpha:/var/lib/postgresql/data
|
- ./volumes/postgres_alpha:/var/lib/postgresql/data
|
||||||
|
|
||||||
lemmy-beta-ui:
|
lemmy-beta-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
environment:
|
environment:
|
||||||
- LEMMY_INTERNAL_HOST=lemmy-beta:8551
|
- LEMMY_INTERNAL_HOST=lemmy-beta:8551
|
||||||
- LEMMY_EXTERNAL_HOST=localhost:8551
|
- LEMMY_EXTERNAL_HOST=localhost:8551
|
||||||
|
@ -107,7 +107,7 @@ services:
|
||||||
- ./volumes/postgres_beta:/var/lib/postgresql/data
|
- ./volumes/postgres_beta:/var/lib/postgresql/data
|
||||||
|
|
||||||
lemmy-gamma-ui:
|
lemmy-gamma-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
environment:
|
environment:
|
||||||
- LEMMY_INTERNAL_HOST=lemmy-gamma:8561
|
- LEMMY_INTERNAL_HOST=lemmy-gamma:8561
|
||||||
- LEMMY_EXTERNAL_HOST=localhost:8561
|
- LEMMY_EXTERNAL_HOST=localhost:8561
|
||||||
|
@ -147,7 +147,7 @@ services:
|
||||||
|
|
||||||
# An instance with only an allowlist for beta
|
# An instance with only an allowlist for beta
|
||||||
lemmy-delta-ui:
|
lemmy-delta-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
environment:
|
environment:
|
||||||
- LEMMY_INTERNAL_HOST=lemmy-delta:8571
|
- LEMMY_INTERNAL_HOST=lemmy-delta:8571
|
||||||
- LEMMY_EXTERNAL_HOST=localhost:8571
|
- LEMMY_EXTERNAL_HOST=localhost:8571
|
||||||
|
@ -187,7 +187,7 @@ services:
|
||||||
|
|
||||||
# An instance who has a blocklist, with lemmy-alpha blocked
|
# An instance who has a blocklist, with lemmy-alpha blocked
|
||||||
lemmy-epsilon-ui:
|
lemmy-epsilon-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
environment:
|
environment:
|
||||||
- LEMMY_INTERNAL_HOST=lemmy-epsilon:8581
|
- LEMMY_INTERNAL_HOST=lemmy-epsilon:8581
|
||||||
- LEMMY_EXTERNAL_HOST=localhost:8581
|
- LEMMY_EXTERNAL_HOST=localhost:8581
|
||||||
|
|
|
@ -12,7 +12,7 @@ services:
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
lemmy:
|
lemmy:
|
||||||
image: dessalines/lemmy:v0.8.3
|
image: dessalines/lemmy:v0.8.4
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:8536:8536"
|
- "127.0.0.1:8536:8536"
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -26,7 +26,7 @@ services:
|
||||||
- iframely
|
- iframely
|
||||||
|
|
||||||
lemmy-ui:
|
lemmy-ui:
|
||||||
image: dessalines/lemmy-ui:v0.8.3
|
image: dessalines/lemmy-ui:v0.8.4
|
||||||
ports:
|
ports:
|
||||||
- "1235:1234"
|
- "1235:1234"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
docker tag dessalines/lemmy:travis \
|
docker tag dessalines/lemmy:travis \
|
||||||
dessalines/lemmy:v0.8.3
|
dessalines/lemmy:v0.8.4
|
||||||
docker push dessalines/lemmy:v0.8.3
|
docker push dessalines/lemmy:v0.8.4
|
||||||
|
|
|
@ -843,7 +843,7 @@ impl Perform for TransferCommunity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_community_websocket(
|
fn send_community_websocket(
|
||||||
res: &CommunityResponse,
|
res: &CommunityResponse,
|
||||||
context: &Data<LemmyContext>,
|
context: &Data<LemmyContext>,
|
||||||
websocket_id: Option<ConnectionId>,
|
websocket_id: Option<ConnectionId>,
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub trait Perform {
|
||||||
) -> Result<Self::Response, LemmyError>;
|
) -> Result<Self::Response, LemmyError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate) async fn is_mod_or_admin(
|
pub(crate) async fn is_mod_or_admin(
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
user_id: i32,
|
user_id: i32,
|
||||||
community_id: i32,
|
community_id: i32,
|
||||||
|
@ -56,14 +56,14 @@ pub async fn is_admin(pool: &DbPool, user_id: i32) -> Result<(), LemmyError> {
|
||||||
Ok(())
|
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? {
|
match blocking(pool, move |conn| Post::read(conn, post_id)).await? {
|
||||||
Ok(post) => Ok(post),
|
Ok(post) => Ok(post),
|
||||||
Err(_e) => Err(APIError::err("couldnt_find_post").into()),
|
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) {
|
let claims = match Claims::decode(&jwt) {
|
||||||
Ok(claims) => claims.claims,
|
Ok(claims) => claims.claims,
|
||||||
Err(_e) => return Err(APIError::err("not_logged_in").into()),
|
Err(_e) => return Err(APIError::err("not_logged_in").into()),
|
||||||
|
@ -77,7 +77,7 @@ pub(in crate) async fn get_user_from_jwt(jwt: &str, pool: &DbPool) -> Result<Use
|
||||||
Ok(user)
|
Ok(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate) async fn get_user_from_jwt_opt(
|
pub(crate) async fn get_user_from_jwt_opt(
|
||||||
jwt: &Option<String>,
|
jwt: &Option<String>,
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
) -> Result<Option<User_>, LemmyError> {
|
) -> Result<Option<User_>, LemmyError> {
|
||||||
|
@ -87,7 +87,7 @@ pub(in crate) async fn get_user_from_jwt_opt(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(in crate) async fn check_community_ban(
|
pub(crate) async fn check_community_ban(
|
||||||
user_id: i32,
|
user_id: i32,
|
||||||
community_id: i32,
|
community_id: i32,
|
||||||
pool: &DbPool,
|
pool: &DbPool,
|
||||||
|
@ -100,7 +100,7 @@ pub(in crate) async fn check_community_ban(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 let Some(Some(item)) = &item {
|
||||||
if Url::parse(item).is_err() {
|
if Url::parse(item).is_err() {
|
||||||
return Err(APIError::err("invalid_url").into());
|
return Err(APIError::err("invalid_url").into());
|
||||||
|
@ -109,7 +109,7 @@ pub(in crate) fn check_optional_url(item: &Option<Option<String>>) -> Result<(),
|
||||||
Ok(())
|
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();
|
let mut instances: Vec<String> = Vec::new();
|
||||||
|
|
||||||
if Settings::get().federation.enabled {
|
if Settings::get().federation.enabled {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
pub const VERSION: &str = "v0.8.3";
|
pub const VERSION: &str = "v0.8.4";
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
pub mod receive;
|
pub(crate) mod receive;
|
||||||
pub mod send;
|
pub(crate) mod send;
|
||||||
|
|
|
@ -2,11 +2,11 @@ use lemmy_utils::settings::Settings;
|
||||||
use url::{ParseError, Url};
|
use url::{ParseError, Url};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
pub mod comment;
|
pub(crate) mod comment;
|
||||||
pub mod community;
|
pub(crate) mod community;
|
||||||
pub mod post;
|
pub(crate) mod post;
|
||||||
pub mod private_message;
|
pub(crate) mod private_message;
|
||||||
pub mod user;
|
pub(crate) mod user;
|
||||||
|
|
||||||
/// Generate a unique ID for an activity, in the format:
|
/// Generate a unique ID for an activity, in the format:
|
||||||
/// `http(s)://example.com/receive/create/202daf0a-1489-45df-8d2e-c8a3173fed36`
|
/// `http(s)://example.com/receive/create/202daf0a-1489-45df-8d2e-c8a3173fed36`
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
pub mod group_extensions;
|
pub(crate) mod group_extensions;
|
||||||
pub mod page_extension;
|
pub(crate) mod page_extension;
|
||||||
pub mod signatures;
|
pub(crate) mod signatures;
|
||||||
|
|
|
@ -87,7 +87,7 @@ where
|
||||||
/// The types of ActivityPub objects that can be fetched directly by searching for their ID.
|
/// The types of ActivityPub objects that can be fetched directly by searching for their ID.
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
#[derive(serde::Deserialize, Debug)]
|
#[derive(serde::Deserialize, Debug)]
|
||||||
pub enum SearchAcceptedObjects {
|
enum SearchAcceptedObjects {
|
||||||
Person(Box<PersonExt>),
|
Person(Box<PersonExt>),
|
||||||
Group(Box<GroupExt>),
|
Group(Box<GroupExt>),
|
||||||
Page(Box<PageExt>),
|
Page(Box<PageExt>),
|
||||||
|
|
|
@ -9,11 +9,11 @@ use chrono::NaiveDateTime;
|
||||||
use lemmy_utils::{location_info, utils::convert_datetime, LemmyError};
|
use lemmy_utils::{location_info, utils::convert_datetime, LemmyError};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
pub mod comment;
|
pub(crate) mod comment;
|
||||||
pub mod community;
|
pub(crate) mod community;
|
||||||
pub mod post;
|
pub(crate) mod post;
|
||||||
pub mod private_message;
|
pub(crate) mod private_message;
|
||||||
pub mod user;
|
pub(crate) mod user;
|
||||||
|
|
||||||
/// Updated is actually the deletion time
|
/// Updated is actually the deletion time
|
||||||
fn create_tombstone<T>(
|
fn create_tombstone<T>(
|
||||||
|
|
|
@ -4,13 +4,13 @@ use std::{collections::HashMap, time::SystemTime};
|
||||||
use strum::IntoEnumIterator;
|
use strum::IntoEnumIterator;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RateLimitBucket {
|
struct RateLimitBucket {
|
||||||
last_checked: SystemTime,
|
last_checked: SystemTime,
|
||||||
allowance: f64,
|
allowance: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Hash, Debug, EnumIter, Copy, Clone, AsRefStr)]
|
#[derive(Eq, PartialEq, Hash, Debug, EnumIter, Copy, Clone, AsRefStr)]
|
||||||
pub enum RateLimitType {
|
pub(crate) enum RateLimitType {
|
||||||
Message,
|
Message,
|
||||||
Register,
|
Register,
|
||||||
Post,
|
Post,
|
||||||
|
@ -20,7 +20,7 @@ pub enum RateLimitType {
|
||||||
/// Rate limiting based on rate type and IP addr
|
/// Rate limiting based on rate type and IP addr
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RateLimiter {
|
pub struct RateLimiter {
|
||||||
pub buckets: HashMap<RateLimitType, HashMap<IPAddr, RateLimitBucket>>,
|
buckets: HashMap<RateLimitType, HashMap<IPAddr, RateLimitBucket>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for RateLimiter {
|
impl Default for RateLimiter {
|
||||||
|
|
|
@ -22,7 +22,7 @@ use std::str::FromStr;
|
||||||
use strum::ParseError;
|
use strum::ParseError;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Params {
|
struct Params {
|
||||||
sort: Option<String>,
|
sort: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,19 +24,19 @@ pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Image {
|
struct Image {
|
||||||
file: String,
|
file: String,
|
||||||
delete_token: String,
|
delete_token: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Images {
|
struct Images {
|
||||||
msg: String,
|
msg: String,
|
||||||
files: Option<Vec<Image>>,
|
files: Option<Vec<Image>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct PictrsParams {
|
struct PictrsParams {
|
||||||
format: Option<String>,
|
format: Option<String>,
|
||||||
thumbnail: Option<String>,
|
thumbnail: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,18 +59,18 @@ async fn node_info(context: web::Data<LemmyContext>) -> Result<HttpResponse, Err
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfoWellKnown {
|
struct NodeInfoWellKnown {
|
||||||
pub links: NodeInfoWellKnownLinks,
|
pub links: NodeInfoWellKnownLinks,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfoWellKnownLinks {
|
struct NodeInfoWellKnownLinks {
|
||||||
pub rel: Url,
|
pub rel: Url,
|
||||||
pub href: Url,
|
pub href: Url,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfo {
|
struct NodeInfo {
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub software: NodeInfoSoftware,
|
pub software: NodeInfoSoftware,
|
||||||
pub protocols: Vec<String>,
|
pub protocols: Vec<String>,
|
||||||
|
@ -78,14 +78,14 @@ pub struct NodeInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfoSoftware {
|
struct NodeInfoSoftware {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct NodeInfoUsage {
|
struct NodeInfoUsage {
|
||||||
pub users: NodeInfoUsers,
|
pub users: NodeInfoUsers,
|
||||||
pub local_posts: i64,
|
pub local_posts: i64,
|
||||||
pub local_comments: i64,
|
pub local_comments: i64,
|
||||||
|
@ -93,6 +93,6 @@ pub struct NodeInfoUsage {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct NodeInfoUsers {
|
struct NodeInfoUsers {
|
||||||
pub total: i64,
|
pub total: i64,
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ use lemmy_websocket::LemmyContext;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Params {
|
struct Params {
|
||||||
resource: String,
|
resource: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue