🏡 index : ~doyle/rgit.git

author jordan <jordan@doyle.la> 2023-08-26 14:22:29.0 +01:00:00
committer GitHub <noreply@github.com> 2023-08-26 14:22:29.0 +01:00:00
commit
b355ac6b6f9cb80b4eb6cabf47e11977cf2aa540 [patch]
tree
135337d37934f18383dc7829c6abe76c5baea026
parent
dab5dc392d77ed3d8c2ac78028bdb815e8c99314
parent
de15ccabda6c64d7ff93cfb31374edd1de56d79e
download
b355ac6b6f9cb80b4eb6cabf47e11977cf2aa540.tar.gz

Merge pull request #14 from stappersg/favicon

Added 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