added embedded images at pasta view

This commit is contained in:
Schrottkatze 2023-02-27 00:47:40 +01:00
parent 51751e3ee2
commit 1ebbe5d922
3 changed files with 14 additions and 0 deletions

View file

@ -21,6 +21,10 @@ pub async fn info(data: web::Data<AppState>) -> HttpResponse {
let pastas = data.pastas.lock().await;
// TODO: status report more sophisticated
// maybe:
// - detect weird/invalid configurations?
// - detect server storage issues
// - detect performance problems?
let mut status = "OK";
let mut message = "";

View file

@ -30,6 +30,12 @@ impl PastaFile {
pub fn name(&self) -> &str {
&self.name
}
/// Check if file is an image for embedding
pub fn is_image(&self) -> bool {
let guess = mime_guess::from_path(&self.name).first_or_text_plain();
guess.type_() == "image"
}
}
#[derive(Serialize, Deserialize)]