From 961c7f1fcbe03b27797f0e8ee6608bb8cea6fa4e Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 8 Jan 2025 10:27:12 +0100 Subject: [PATCH] wip --- config/defaults.hjson | 1 + crates/routes/src/images/mod.rs | 9 +++++++++ src/api_routes_v4.rs | 1 + 3 files changed, 11 insertions(+) diff --git a/config/defaults.hjson b/config/defaults.hjson index d6c24cce8..c13b70907 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -71,6 +71,7 @@ # TODO: Unfortunately pictrs can only resize images to fit in a*a square, no rectangle. # Otherwise we have to use crop, or use max_width/max_height which throws error # if image is larger. + # TODO: whats a sensible default here? max_banner_size: 512 # Prevent users from uploading images for posts or embedding in markdown. Avatars, icons and # banners can still be uploaded. diff --git a/crates/routes/src/images/mod.rs b/crates/routes/src/images/mod.rs index 52d3d89df..1d3260e44 100644 --- a/crates/routes/src/images/mod.rs +++ b/crates/routes/src/images/mod.rs @@ -9,6 +9,15 @@ pub mod download; pub mod upload; mod utils; +pub async fn delete_community_icon( + data: Json, + context: Data, + local_user_view: LocalUserView, +) -> LemmyResult> { + todo!() +} + +// TODO: get rid of delete tokens and allow deletion by admin or uploader pub async fn delete_image( data: Json, context: Data, diff --git a/src/api_routes_v4.rs b/src/api_routes_v4.rs index 253167983..3572f8ebf 100644 --- a/src/api_routes_v4.rs +++ b/src/api_routes_v4.rs @@ -207,6 +207,7 @@ pub fn config(cfg: &mut ServiceConfig, rate_limit: &RateLimitCell) { .route("/ban_user", post().to(ban_from_community)) .route("/mod", post().to(add_mod_to_community)) .route("/icon", post().to(upload_community_icon)) + .route("/icon", delete().to(delete_community_icon)) .route("/banner", post().to(upload_community_banner)) .service( scope("/pending_follows")