This commit is contained in:
parent
8e2cbc9a0f
commit
1d23df37d8
3 changed files with 19 additions and 5 deletions
|
@ -43,8 +43,15 @@
|
||||||
url: "http://localhost:8080/"
|
url: "http://localhost:8080/"
|
||||||
# Set a custom pictrs API key. ( Required for deleting images )
|
# Set a custom pictrs API key. ( Required for deleting images )
|
||||||
api_key: "string"
|
api_key: "string"
|
||||||
# Cache remote images
|
# By default the thumbnails for external links are stored in pict-rs. This ensures that they
|
||||||
cache_remote_images: true
|
# 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 sending configuration. All options except login/password are mandatory
|
||||||
email: {
|
email: {
|
||||||
|
|
|
@ -124,7 +124,7 @@ pub(crate) async fn fetch_pictrs(
|
||||||
let pictrs_config = settings.pictrs_config()?;
|
let pictrs_config = settings.pictrs_config()?;
|
||||||
is_image_content_type(client, image_url).await?;
|
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
|
// fetch remote non-pictrs images for persistent thumbnail link
|
||||||
let fetch_url = format!(
|
let fetch_url = format!(
|
||||||
"{}image/download?url={}",
|
"{}image/download?url={}",
|
||||||
|
|
|
@ -79,9 +79,16 @@ pub struct PictrsConfig {
|
||||||
#[default(None)]
|
#[default(None)]
|
||||||
pub api_key: Option<String>,
|
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)]
|
#[default(true)]
|
||||||
pub cache_remote_images: bool,
|
pub cache_external_link_previews: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
|
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document)]
|
||||||
|
|
Loading…
Reference in a new issue