vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

commit a79334ea4c1b18e534bc5d66e1a2746c83a567c7
parent 274ea9a4f24456a6a6cc60eddcc0a796fd6b7c69
Author: TheMardy <martijnhanegraaf@hotmail.nl>
Date:   Sat, 16 Feb 2019 03:44:30 +0100

Added static email image routes

Diffstat:
Msrc/api/web.rs | 14+++++++++++++-
Asrc/static/images/logo-gray.png | 0
Asrc/static/images/mail-github.png | 0
3 files changed, 13 insertions(+), 1 deletion(-)

diff --git 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<Route> { 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<String> { Json(format_date(&Utc::now().naive_utc())) } + +#[get("/images/<filename>")] +fn images(filename: String) -> Result<Content<Vec<u8>>, 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 Binary files differ. diff --git a/src/static/images/mail-github.png b/src/static/images/mail-github.png Binary files differ.