From 7c771d2113581449c0166ac5608ea6be56bafd40 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Fri, 13 Dec 2024 15:28:16 +0100 Subject: [PATCH] fix ts bindings --- config/defaults.hjson | 4 ++++ crates/api_common/src/image.rs | 4 ++++ crates/utils/src/settings/structs.rs | 4 ++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/config/defaults.hjson b/config/defaults.hjson index c1cb8d06b..aaf2a94d8 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -67,6 +67,10 @@ # Maximum size for user avatar, community icon and site icon. max_avatar_size: 512 # Maximum size for user, community and site banner. + # + # 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. max_banner_size: 512 } # Email sending configuration. All options except login/password are mandatory diff --git a/crates/api_common/src/image.rs b/crates/api_common/src/image.rs index df033f285..c28832921 100644 --- a/crates/api_common/src/image.rs +++ b/crates/api_common/src/image.rs @@ -9,7 +9,9 @@ use url::Url; #[cfg_attr(feature = "full", derive(TS))] #[cfg_attr(feature = "full", ts(export))] pub struct ImageGetParams { + #[cfg_attr(feature = "full", ts(optional))] pub file_type: Option, + #[cfg_attr(feature = "full", ts(optional))] pub max_size: Option, } @@ -27,7 +29,9 @@ pub struct DeleteImageParams { #[cfg_attr(feature = "full", ts(export))] pub struct ImageProxyParams { pub url: String, + #[cfg_attr(feature = "full", ts(optional))] pub file_type: Option, + #[cfg_attr(feature = "full", ts(optional))] pub max_size: Option, } diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index 304884393..28710e8ca 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -110,8 +110,8 @@ pub struct PictrsConfig { pub max_avatar_size: u32, /// Maximum size for user, community and site banner. - /// - /// TODO: Unfortunately pictrs can only resize images to fit in a*a square, no rectangle. + /// + /// 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. #[default(512)]