From 096e6d4f01073fdeda7f47c5234cbe4abb3eb938 Mon Sep 17 00:00:00 2001 From: kirbylife Date: Sun, 15 Dec 2019 17:24:19 -0600 Subject: [PATCH] added favicon --- src/main.rs | 9 ++++++++- static/favicon.ico | Bin 0 -> 1406 bytes 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 static/favicon.ico diff --git a/src/main.rs b/src/main.rs index 5e6a922..2bcd7be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,9 +18,11 @@ extern crate tera; use comrak::{markdown_to_html, ComrakOptions}; use controllers::{get_post, get_posts, MAX_POSTS_PER_PAGE}; use misc::get_context; +use rocket::response::NamedFile; use rocket::Request; use rocket_contrib::serve::StaticFiles; use rocket_contrib::templates::Template; +use std::path::Path; use std::vec::Vec; #[get("/?")] @@ -72,10 +74,15 @@ fn not_found_404(req: &Request) -> Template { Template::render("404", context) } +#[get("/favicon.ico")] +fn favicon() -> Option { + NamedFile::open(Path::new("static/favicon.ico")).ok() +} + fn main() { rocket::ignite() .attach(Template::fairing()) - .mount("/", routes![index, show_post]) + .mount("/", routes![index, show_post, favicon]) .mount("/admin", routes![admin::index]) .mount("/static", StaticFiles::from("static")) .register(catchers![not_found_404]) diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..a1695e2e4338ed1288079f80d0d8acf27ddafdcb GIT binary patch literal 1406 zcmeH{J!{%g7{!04Hqn3DYMb|_ZEVvd=Jjv><|Bx+;Nl`8F5Pu-5u9Aq#Z6pX`~oV7 z?&=2+QFjFq#6|I4dX;LY426z9m*;TL;W-!X86HrHqt_!)!>_k+3>ZZV34`dR{#scq z7OYk)Hk%E*-HyZI!0B}2a=CE3-FQ46yk0LppAWy^PaqH=7z`2$g$RekL?RKQ(I~N4 zjCedwB9S1OOp;2aNT<_eG8wYjEV*2cd_GU1P@q^WQYw`wm&;Tt6{^)LwOWmOy-uUi zpxJEFYPD#$+jKe|y4^0lUXOmi&tNcMI2jTn!|OePbi(