From b355ac6b6f9cb80b4eb6cabf47e11977cf2aa540 Mon Sep 17 00:00:00 2001 From: jordan Date: Sat, 26 Aug 2023 14:22:29 +0100 Subject: [PATCH] Merge pull request #14 from stappersg/favicon Added favicon.ico--- src/main.rs | 15 +++++++++++++++ statics/README.md | 5 +++++ statics/favicon.ico | 0 3 files changed, 20 insertions(+) diff --git a/src/main.rs b/src/main.rs index 60ae593..e895a45 100644 --- a/src/main.rs +++ a/src/main.rs @@ -92,6 +92,17 @@ .into_boxed_bytes(), ); + let static_favicon = |content: &'static [u8]| { + move || async move { + let mut resp = Response::new(Body::from(content)); + resp.headers_mut().insert( + http::header::CONTENT_TYPE, + HeaderValue::from_static("image/x-icon"), + ); + resp + } + }; + let static_css = |content: &'static [u8]| { move || async move { let mut resp = Response::new(Body::from(content)); @@ -114,6 +125,10 @@ ) .route("/highlight.css", get(static_css(css))) .route("/highlight-dark.css", get(static_css(dark_css))) + .route( + "/favicon.ico", + get(static_favicon(include_bytes!("../statics/favicon.ico"))), + ) .fallback(methods::repo::service) .layer(layer_fn(LoggingMiddleware)) .layer(Extension(Arc::new(Git::new(syntax_set)))) diff --git a/statics/README.md b/statics/README.md new file mode 100644 index 0000000..313fd47 100644 --- /dev/null +++ a/statics/README.md @@ -1,0 +1,5 @@ +Current favicon.ico was retrieved +by `wget https://www.git-scm.com/favicon.ico` + +When you have a better favicon.ico for this project +contact us. diff --git a/statics/favicon.ico b/statics/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..145b4b057df8753aadf185882a3d6e97d8f3c4a2 100644 Binary files /dev/null and a/statics/favicon.ico differ -- rgit 0.1.3