diff --git a/filed/config/filed.toml.example b/filed/config/filed.toml.example index 9ab705d..a5df269 100644 --- a/filed/config/filed.toml.example +++ b/filed/config/filed.toml.example @@ -58,6 +58,11 @@ instance_motto="A minute file sharing service" # Used as the icon where icon images are not available instance_emoji="🌠" +# Custom logo +# This will be displayed at the main page +# It is best to use a webp or jpg image. +# custom_logo=/path/to/logo.webp + # API settings [api] diff --git a/filed/src/config/types.rs b/filed/src/config/types.rs index 050a1d2..6905dd7 100644 --- a/filed/src/config/types.rs +++ b/filed/src/config/types.rs @@ -1,5 +1,5 @@ use serde::{Serialize, Deserialize}; -use std::{error::Error, fs}; +use std::{error::Error, fs, path::Path}; use crate::env::Env; @@ -68,6 +68,10 @@ pub struct Branding { /// 🌠 blek! File #[serde(default)] pub instance_emoji: char, + + /// Custom logo to display on the main page + #[serde(default)] + pub custom_logo: Option } impl Default for Branding { @@ -76,6 +80,7 @@ impl Default for Branding { instance_name: "blek! File".into(), instance_motto: "A minute file sharing".into(), instance_emoji: '🌠', + custom_logo: None } } } @@ -142,6 +147,12 @@ impl FilesPolicy { impl Branding { fn validate(self: &Self) -> Result<(), String> { + if let Some(logo_path) = self.custom_logo.clone() { + let logo_path = Path::new(&logo_path); + if ! logo_path.is_file() { + return Err("Config parameter branding.custom_logo is not a file. It must be a valid path that should be accessible from fileD's filesystem".into()) + } + } Ok(()) } }