diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000..a57c480 Binary files /dev/null and b/assets/favicon.png differ diff --git a/src/server/assets.rs b/src/server/assets.rs index 8eecfe6..c5aa657 100644 --- a/src/server/assets.rs +++ b/src/server/assets.rs @@ -9,3 +9,5 @@ pub static BADGE_UNKNOWN_SVG: &'static [u8; 972] = pub static STATIC_STYLE_CSS: &'static str = include_str!(concat!(env!("OUT_DIR"), "/style.css")); +pub static STATIC_FAVICON_PNG: &'static [u8; 1338] = + include_bytes!("../../assets/favicon.png"); diff --git a/src/server/mod.rs b/src/server/mod.rs index 7bc018e..181f340 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -22,7 +22,8 @@ enum StatusFormat { #[derive(Clone, Copy)] enum StaticFile { - StyleCss + StyleCss, + FaviconPng } enum Route { @@ -44,6 +45,7 @@ impl Server { router.add("/", Route::Index); router.add("/static/style.css", Route::Static(StaticFile::StyleCss)); + router.add("/static/favicon.png", Route::Static(StaticFile::FaviconPng)); router.add("/repo/:site/:qual/:name", Route::Status(StatusFormat::Html)); router.add("/repo/:site/:qual/:name/status.json", Route::Status(StatusFormat::Json)); @@ -163,6 +165,11 @@ impl Server { Response::new() .with_header(ContentType("text/css".parse().unwrap())) .with_body(assets::STATIC_STYLE_CSS) + }, + StaticFile::FaviconPng => { + Response::new() + .with_header(ContentType("image/png".parse().unwrap())) + .with_body(assets::STATIC_FAVICON_PNG.to_vec()) } } } diff --git a/src/server/views/html/mod.rs b/src/server/views/html/mod.rs index d624947..a4be773 100644 --- a/src/server/views/html/mod.rs +++ b/src/server/views/html/mod.rs @@ -21,6 +21,7 @@ fn render_html(title: &str, body: B) -> Response { meta charset="utf-8"; meta name="viewport" content="width=device-width, initial-scale=1"; title (title) + link rel="icon" type="image/png" href="/static/favicon.png"; link rel="stylesheet" type="text/css" href="/static/style.css"; link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600"; link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Source+Code+Pro";