🏡 index : ~doyle/rgit.git

author Geert Stappers <stappers@stappers.it> 2023-08-25 17:35:42.0 +02:00:00
committer Geert Stappers <stappers@stappers.it> 2023-08-25 20:55:54.0 +02:00:00
commit
de15ccabda6c64d7ff93cfb31374edd1de56d79e [patch]
tree
7c7c92521823dc3c8c3f991078ed562138adbb99
parent
3ee96fb5bc8369dfcfec2b0d3f051cc69e8bd221
download
de15ccabda6c64d7ff93cfb31374edd1de56d79e.tar.gz

Added favicon.ico

Got it by `wget  https://www.git-scm.com/favicon.ico`

Diff

 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