From cc504f781e34570aeecb88ec7c6fdfb9a60c3be0 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 30 Sep 2022 21:51:52 -0800 Subject: [PATCH 1/3] add favicon resource --- templates/favicon.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 templates/favicon.svg diff --git a/templates/favicon.svg b/templates/favicon.svg new file mode 100644 index 0000000..f65dd39 --- /dev/null +++ b/templates/favicon.svg @@ -0,0 +1,3 @@ + + + From ef5d07392b19bb17a1f331b16e357bd13e2f72ba Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 30 Sep 2022 21:52:08 -0800 Subject: [PATCH 2/3] add in template and as static resource --- src/endpoints/static_resources.rs | 13 +++++++++++++ templates/header.html | 1 + 2 files changed, 14 insertions(+) diff --git a/src/endpoints/static_resources.rs b/src/endpoints/static_resources.rs index 9a5318e..728d617 100644 --- a/src/endpoints/static_resources.rs +++ b/src/endpoints/static_resources.rs @@ -8,6 +8,12 @@ struct WaterCSS<'a> { _marker: PhantomData<&'a ()>, } +#[derive(Template)] +#[template(path = "favicon.svg", escape = "none")] +struct Favicon<'a> { + _marker: PhantomData<&'a ()>, +} + #[get("/static/{resource}")] pub async fn static_resources(resource_id: web::Path) -> HttpResponse { match resource_id.into_inner().as_str() { @@ -18,6 +24,13 @@ pub async fn static_resources(resource_id: web::Path) -> HttpResponse { .render() .unwrap(), ), + "favicon.svg" => HttpResponse::Ok().content_type("image/svg+xml").body( + Favicon { + _marker: Default::default(), + } + .render() + .unwrap(), + ), _ => HttpResponse::NotFound().content_type("text/html").finish(), } } diff --git a/templates/header.html b/templates/header.html index 37d2de0..46bb7dc 100644 --- a/templates/header.html +++ b/templates/header.html @@ -9,6 +9,7 @@ + {% if !args.pure_html %} {%- endif %} From 487de0fcf72db09d7e9d22608ee73a602c3018ca Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 22 Oct 2022 10:02:52 -0800 Subject: [PATCH 3/3] use gray favicon --- templates/favicon.svg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/templates/favicon.svg b/templates/favicon.svg index f65dd39..9a306c0 100644 --- a/templates/favicon.svg +++ b/templates/favicon.svg @@ -1,3 +1,5 @@ - + + +