From 0dcff2e6479a4b44684f93c24391bf07acbddd8c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 12 Nov 2020 11:54:31 -0600 Subject: [PATCH 1/2] Version v0.8.4 --- ansible/VERSION | 2 +- docker/dev/docker-compose.yml | 2 +- docker/federation/docker-compose.yml | 10 +++++----- docker/prod/docker-compose.yml | 4 ++-- docker/travis/docker_push.sh | 4 ++-- lemmy_api/src/version.rs | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ansible/VERSION b/ansible/VERSION index e18f84527..5b63634d0 100644 --- a/ansible/VERSION +++ b/ansible/VERSION @@ -1 +1 @@ -v0.8.3 +v0.8.4 diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index 1bd2c3c99..bf25c2592 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -16,7 +16,7 @@ services: - postgres - iframely lemmy-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 ports: - "1235:1234" restart: always diff --git a/docker/federation/docker-compose.yml b/docker/federation/docker-compose.yml index 002cd4e93..a96c89fc9 100644 --- a/docker/federation/docker-compose.yml +++ b/docker/federation/docker-compose.yml @@ -29,7 +29,7 @@ services: - ./volumes/pictrs_alpha:/mnt lemmy-alpha-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 environment: - LEMMY_INTERNAL_HOST=lemmy-alpha:8541 - LEMMY_EXTERNAL_HOST=localhost:8541 @@ -68,7 +68,7 @@ services: - ./volumes/postgres_alpha:/var/lib/postgresql/data lemmy-beta-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 environment: - LEMMY_INTERNAL_HOST=lemmy-beta:8551 - LEMMY_EXTERNAL_HOST=localhost:8551 @@ -107,7 +107,7 @@ services: - ./volumes/postgres_beta:/var/lib/postgresql/data lemmy-gamma-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 environment: - LEMMY_INTERNAL_HOST=lemmy-gamma:8561 - LEMMY_EXTERNAL_HOST=localhost:8561 @@ -147,7 +147,7 @@ services: # An instance with only an allowlist for beta lemmy-delta-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 environment: - LEMMY_INTERNAL_HOST=lemmy-delta:8571 - LEMMY_EXTERNAL_HOST=localhost:8571 @@ -187,7 +187,7 @@ services: # An instance who has a blocklist, with lemmy-alpha blocked lemmy-epsilon-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 environment: - LEMMY_INTERNAL_HOST=lemmy-epsilon:8581 - LEMMY_EXTERNAL_HOST=localhost:8581 diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index faf822a99..7f5c61bf3 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -12,7 +12,7 @@ services: restart: always lemmy: - image: dessalines/lemmy:v0.8.3 + image: dessalines/lemmy:v0.8.4 ports: - "127.0.0.1:8536:8536" restart: always @@ -26,7 +26,7 @@ services: - iframely lemmy-ui: - image: dessalines/lemmy-ui:v0.8.3 + image: dessalines/lemmy-ui:v0.8.4 ports: - "1235:1234" restart: always diff --git a/docker/travis/docker_push.sh b/docker/travis/docker_push.sh index 914b0333a..a881758cf 100644 --- a/docker/travis/docker_push.sh +++ b/docker/travis/docker_push.sh @@ -1,5 +1,5 @@ #!/bin/sh echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin docker tag dessalines/lemmy:travis \ - dessalines/lemmy:v0.8.3 -docker push dessalines/lemmy:v0.8.3 + dessalines/lemmy:v0.8.4 +docker push dessalines/lemmy:v0.8.4 diff --git a/lemmy_api/src/version.rs b/lemmy_api/src/version.rs index 62080fd61..bc5be0c09 100644 --- a/lemmy_api/src/version.rs +++ b/lemmy_api/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "v0.8.3"; +pub const VERSION: &str = "v0.8.4"; From 8675fed49c51fc98b50af3fbe1d3caec4ab9e331 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Mon, 16 Nov 2020 16:44:04 +0100 Subject: [PATCH 2/2] Reduce visibility of some structs and methods (replaces #1266) --- lemmy_api/src/community.rs | 2 +- lemmy_api/src/lib.rs | 14 +++++++------- lemmy_apub/src/activities/mod.rs | 4 ++-- lemmy_apub/src/activities/send/mod.rs | 10 +++++----- lemmy_apub/src/extensions/mod.rs | 6 +++--- lemmy_apub/src/fetcher.rs | 2 +- lemmy_apub/src/objects/mod.rs | 10 +++++----- lemmy_rate_limit/src/rate_limiter.rs | 6 +++--- src/routes/feeds.rs | 2 +- src/routes/images.rs | 6 +++--- src/routes/nodeinfo.rs | 12 ++++++------ src/routes/webfinger.rs | 2 +- 12 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lemmy_api/src/community.rs b/lemmy_api/src/community.rs index a9e130b9b..a69f2ce97 100644 --- a/lemmy_api/src/community.rs +++ b/lemmy_api/src/community.rs @@ -843,7 +843,7 @@ impl Perform for TransferCommunity { } } -pub fn send_community_websocket( +fn send_community_websocket( res: &CommunityResponse, context: &Data, websocket_id: Option, diff --git a/lemmy_api/src/lib.rs b/lemmy_api/src/lib.rs index 0f0367cf1..dd9377822 100644 --- a/lemmy_api/src/lib.rs +++ b/lemmy_api/src/lib.rs @@ -34,7 +34,7 @@ pub trait Perform { ) -> Result; } -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, @@ -56,14 +56,14 @@ pub async fn is_admin(pool: &DbPool, user_id: i32) -> Result<(), LemmyError> { Ok(()) } -pub(in crate) async fn get_post(post_id: i32, pool: &DbPool) -> Result { +pub(crate) async fn get_post(post_id: i32, pool: &DbPool) -> Result { 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 { +pub(crate) async fn get_user_from_jwt(jwt: &str, pool: &DbPool) -> Result { let claims = match Claims::decode(&jwt) { Ok(claims) => claims.claims, 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, pool: &DbPool, ) -> Result, 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, community_id: i32, pool: &DbPool, @@ -100,7 +100,7 @@ pub(in crate) async fn check_community_ban( } } -pub(in crate) fn check_optional_url(item: &Option>) -> Result<(), LemmyError> { +pub(crate) fn check_optional_url(item: &Option>) -> Result<(), LemmyError> { if let Some(Some(item)) = &item { if Url::parse(item).is_err() { return Err(APIError::err("invalid_url").into()); @@ -109,7 +109,7 @@ pub(in crate) fn check_optional_url(item: &Option>) -> Result<(), Ok(()) } -pub(in crate) async fn linked_instances(pool: &DbPool) -> Result, LemmyError> { +pub(crate) async fn linked_instances(pool: &DbPool) -> Result, LemmyError> { let mut instances: Vec = Vec::new(); if Settings::get().federation.enabled { diff --git a/lemmy_apub/src/activities/mod.rs b/lemmy_apub/src/activities/mod.rs index afea56e22..8e25b5128 100644 --- a/lemmy_apub/src/activities/mod.rs +++ b/lemmy_apub/src/activities/mod.rs @@ -1,2 +1,2 @@ -pub mod receive; -pub mod send; +pub(crate) mod receive; +pub(crate) mod send; diff --git a/lemmy_apub/src/activities/send/mod.rs b/lemmy_apub/src/activities/send/mod.rs index 537103b6a..166855e20 100644 --- a/lemmy_apub/src/activities/send/mod.rs +++ b/lemmy_apub/src/activities/send/mod.rs @@ -2,11 +2,11 @@ use lemmy_utils::settings::Settings; 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` diff --git a/lemmy_apub/src/extensions/mod.rs b/lemmy_apub/src/extensions/mod.rs index fdd06e5b7..f4723a947 100644 --- a/lemmy_apub/src/extensions/mod.rs +++ b/lemmy_apub/src/extensions/mod.rs @@ -1,3 +1,3 @@ -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; diff --git a/lemmy_apub/src/fetcher.rs b/lemmy_apub/src/fetcher.rs index acf94ec9e..b4598ea37 100644 --- a/lemmy_apub/src/fetcher.rs +++ b/lemmy_apub/src/fetcher.rs @@ -87,7 +87,7 @@ where /// 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), Group(Box), Page(Box), diff --git a/lemmy_apub/src/objects/mod.rs b/lemmy_apub/src/objects/mod.rs index 56d02607c..8fd0e5679 100644 --- a/lemmy_apub/src/objects/mod.rs +++ b/lemmy_apub/src/objects/mod.rs @@ -9,11 +9,11 @@ use chrono::NaiveDateTime; 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( diff --git a/lemmy_rate_limit/src/rate_limiter.rs b/lemmy_rate_limit/src/rate_limiter.rs index 1c355acf3..bd089febd 100644 --- a/lemmy_rate_limit/src/rate_limiter.rs +++ b/lemmy_rate_limit/src/rate_limiter.rs @@ -4,13 +4,13 @@ use std::{collections::HashMap, time::SystemTime}; 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, @@ -20,7 +20,7 @@ pub enum RateLimitType { /// Rate limiting based on rate type and IP addr #[derive(Debug, Clone)] pub struct RateLimiter { - pub buckets: HashMap>, + buckets: HashMap>, } impl Default for RateLimiter { diff --git a/src/routes/feeds.rs b/src/routes/feeds.rs index f9111169a..303a824b1 100644 --- a/src/routes/feeds.rs +++ b/src/routes/feeds.rs @@ -22,7 +22,7 @@ use std::str::FromStr; use strum::ParseError; #[derive(Deserialize)] -pub struct Params { +struct Params { sort: Option, } diff --git a/src/routes/images.rs b/src/routes/images.rs index 98b13f995..deaf11ebf 100644 --- a/src/routes/images.rs +++ b/src/routes/images.rs @@ -24,19 +24,19 @@ pub fn config(cfg: &mut web::ServiceConfig, rate_limit: &RateLimit) { } #[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>, } #[derive(Deserialize)] -pub struct PictrsParams { +struct PictrsParams { format: Option, thumbnail: Option, } diff --git a/src/routes/nodeinfo.rs b/src/routes/nodeinfo.rs index c41be0e94..1d9525ef2 100644 --- a/src/routes/nodeinfo.rs +++ b/src/routes/nodeinfo.rs @@ -59,18 +59,18 @@ async fn node_info(context: web::Data) -> Result, @@ -78,14 +78,14 @@ pub struct NodeInfo { } #[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, @@ -93,6 +93,6 @@ pub struct NodeInfoUsage { } #[derive(Serialize, Deserialize, Debug)] -pub struct NodeInfoUsers { +struct NodeInfoUsers { pub total: i64, } diff --git a/src/routes/webfinger.rs b/src/routes/webfinger.rs index bef94e6f9..ba687abdf 100644 --- a/src/routes/webfinger.rs +++ b/src/routes/webfinger.rs @@ -12,7 +12,7 @@ use lemmy_websocket::LemmyContext; use serde::Deserialize; #[derive(Deserialize)] -pub struct Params { +struct Params { resource: String, }