mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-12-23 19:39:08 +00:00
Added static email image routes
This commit is contained in:
parent
274ea9a4f2
commit
a79334ea4c
@ -9,11 +9,12 @@ use rocket_contrib::json::Json;
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
use crate::util::Cached;
|
use crate::util::Cached;
|
||||||
|
use crate::error::Error;
|
||||||
use crate::CONFIG;
|
use crate::CONFIG;
|
||||||
|
|
||||||
pub fn routes() -> Vec<Route> {
|
pub fn routes() -> Vec<Route> {
|
||||||
if CONFIG.web_vault_enabled() {
|
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 {
|
} else {
|
||||||
routes![attachments, alive]
|
routes![attachments, alive]
|
||||||
}
|
}
|
||||||
@ -62,3 +63,13 @@ fn alive() -> Json<String> {
|
|||||||
|
|
||||||
Json(format_date(&Utc::now().naive_utc()))
|
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")
|
||||||
|
}
|
||||||
|
}
|
BIN
src/static/images/logo-gray.png
Normal file
BIN
src/static/images/logo-gray.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
src/static/images/mail-github.png
Normal file
BIN
src/static/images/mail-github.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in New Issue
Block a user