diff --git a/config/defaults.hjson b/config/defaults.hjson index 46e4e0a41c3f9d0de56686587c192512bf4bd409..04e34f978d2472a8ef09cab844f637386aa88519 100644 --- a/config/defaults.hjson +++ b/config/defaults.hjson @@ -43,8 +43,15 @@ url: "http://localhost:8080/" # Set a custom pictrs API key. ( Required for deleting images ) api_key: "string" - # Cache remote images - cache_remote_images: true + # By default the thumbnails for external links are stored in pict-rs. This ensures that they + # can be reliably retrieved and can be resized using pict-rs APIs. However it also increases + # storage usage. In case this is disabled, the Opengraph image is directly returned as + # thumbnail. + # + # In some countries it is forbidden to copy preview images from newspaper articles and only + # hotlinking is allowed. If that is the case for your instance, make sure that this setting is + # disabled. + cache_external_link_previews: true } # Email sending configuration. All options except login/password are mandatory email: { diff --git a/crates/api_common/src/request.rs b/crates/api_common/src/request.rs index 11ef4002e9164dca5e7320a87526d53534c12b22..e4de2e75131359c33e4c157866a9ee3bcf1242b7 100644 --- a/crates/api_common/src/request.rs +++ b/crates/api_common/src/request.rs @@ -124,7 +124,7 @@ pub(crate) async fn fetch_pictrs( let pictrs_config = settings.pictrs_config()?; is_image_content_type(client, image_url).await?; - if pictrs_config.cache_remote_images { + if pictrs_config.cache_external_link_previews { // fetch remote non-pictrs images for persistent thumbnail link let fetch_url = format!( "{}image/download?url={}", diff --git a/crates/utils/src/settings/structs.rs b/crates/utils/src/settings/structs.rs index a31b3605e110be287cd8261c78c81fff7c9bffdd..3664417be36ce4d8ff5eaae3f4e20bdf016caebb 100644 --- a/crates/utils/src/settings/structs.rs +++ b/crates/utils/src/settings/structs.rs @@ -79,9 +79,16 @@ pub struct PictrsConfig { #[default(None)] pub api_key: Option<String>, - /// Cache remote images + /// By default the thumbnails for external links are stored in pict-rs. This ensures that they + /// can be reliably retrieved and can be resized using pict-rs APIs. However it also increases + /// storage usage. In case this is disabled, the Opengraph image is directly returned as + /// thumbnail. + /// + /// In some countries it is forbidden to copy preview images from newspaper articles and only + /// hotlinking is allowed. If that is the case for your instance, make sure that this setting is + /// disabled. #[default(true)] - pub cache_remote_images: bool, + pub cache_external_link_previews: bool, } #[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]