diff --git a/src/api/web.rs b/src/api/web.rs index 9b08a723..5c341cc6 100644 --- a/src/api/web.rs +++ b/src/api/web.rs @@ -9,11 +9,12 @@ use rocket_contrib::json::Json; use serde_json::Value; use crate::util::Cached; +use crate::error::Error; use crate::CONFIG; pub fn routes() -> Vec { if CONFIG.web_vault_enabled() { - routes![web_index, app_id, web_files, attachments, alive] + routes![web_index, app_id, web_files, attachments, alive, images] } else { routes![attachments, alive] } @@ -62,3 +63,13 @@ fn alive() -> Json { Json(format_date(&Utc::now().naive_utc())) } + +#[get("/images/")] +fn images(filename: String) -> Result>, Error> { + let image_type = ContentType::new("image", "x-icon"); + match filename.as_ref() { + "mail-github.png" => Ok(Content(image_type , include_bytes!("../static/images/mail-github.png").to_vec())), + "logo-gray.png" => Ok(Content(image_type, include_bytes!("../static/images/logo-gray.png").to_vec())), + _ => err!("Image not found") + } +} \ No newline at end of file diff --git a/src/static/images/logo-gray.png b/src/static/images/logo-gray.png new file mode 100644 index 00000000..05c3e534 Binary files /dev/null and b/src/static/images/logo-gray.png differ diff --git a/src/static/images/mail-github.png b/src/static/images/mail-github.png new file mode 100644 index 00000000..07935f11 Binary files /dev/null and b/src/static/images/mail-github.png differ