From f34d87d60aa1307d32879cf2ad490ec1f52d0c6f Mon Sep 17 00:00:00 2001 From: Sam Rijs Date: Sun, 4 Feb 2018 01:41:29 +1100 Subject: [PATCH] set up favicon --- assets/favicon.png | Bin 0 -> 1338 bytes src/server/assets.rs | 2 ++ src/server/mod.rs | 9 ++++++++- src/server/views/html/mod.rs | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 assets/favicon.png diff --git a/assets/favicon.png b/assets/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..a57c480b6ed3b74747cf24bc25a780cbf29f3d9f GIT binary patch literal 1338 zcmV-A1;zS_P)s=T!acU_>CV`;ZRMrk>ZN*Z+qP}nwyn%d^&3w#w(Z)J zTJLty+o}30yIbFPV%-1Ky`}Em`*!FZ==)#vE?&O__lNfE*|YAy4jf?Jpy!}Hefsoa z8MGIldj;y9_uw5ncB~4H`=R|D&b^-K+_`hDyoB%3qem-%&*vcC6vyv$%qw`*b6W(x zk^|&G_^ov?v`fCEeQg9Bb%ybzrJXu;YLE{D-g7))F?vh&x*s7Bo(ttQMdjZAT(klB zkC{rsV*%5S2Pr{Ht`QK}xe$}2t5r<@Hza1j=PDWym6!pmRV;xm5;Ncc{<4&68L(Yq z1~B|(8PyC}DbawfDvkl)NGyR86*oY4NHpLP6*FL*L<39}SAyjb*a`^-Y-rlFX(d(9 z0nU-o`&VkJww5hhRz#3-f$%GkX*IHmg)Nv|m&F2|S){NBi%j#ePlr{MH5Lp(u=_+T zevn}kQvELg%d%L(3>GbXj>QUBLF`Y8ntNHyq|h~NexR-BQaDk70p~e_V?_u!0ilvgXqSt0-;MkGQXPWwLCvYoy(ntll$pl65vM{Q;_+q& z=2Xxt>J= z^)y8r;Qg%;$(-~)++;0~6mEL(=HmOh(o6<`3D9u6MmJPn$+O3Z-o zv{Vg2z5p?CBI}G$pvK<}SZMm?)xUYQbMJ?&b{Mb@h&6zh!g+r)VE&Y9JT;}%zrVY4 z?^ALU4^q5hDazmx3BCVq>hz~1BFO+|gbwZOxEsXbrr6#u7~=@vICOAbS@2vmc&z*- zvH4=^d7lOc$ut1tz|D>Zd=sdIK&b!&5?KD$PLuw@>2eJqPo|0mr@<}wfoSe_e`~Su z>5zWqM~h}iHNdu>P8rPa2crveV8Eh`@Z5l6GE(jsK<>;GQ}W~nnedDU_!oHEXVY5P zMY_}s2wSJQ*eValxbS(_;QX@%BQ>|pN3Au|48Wl4Ha@n%-wtM+1HB5+dAMK0_4DJ` zp>sT44%2PxF*)^5HfXrmsov%9ur*B58sH91)n-ugy;yi_Pjb9b)&O6a4E+5RNPxoR zMosmGEVy3K++WfZD?Ls5_ClZxOn5WLE58*=r@r%1IC&*U@Cp6L!`f{u@Bjb+ literal 0 HcmV?d00001 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";