From 96607256fc48c541b2eb00f448b746e6998ae190 Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Tue, 12 Jan 2021 20:18:20 -0800 Subject: [PATCH] Add Favicon --- src/main.rs | 9 +++++---- static/favicon.ico | Bin 0 -> 789 bytes templates/base.html | 1 + templates/post.html | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 static/favicon.ico diff --git a/src/main.rs b/src/main.rs index 07a351e..b5520c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ // Import Crates -use actix_web::{get, middleware, web, App, HttpResponse, HttpServer}; // dev::Service +use actix_web::{middleware, web, App, HttpResponse, HttpServer}; // dev::Service // Reference local files mod post; @@ -21,9 +21,10 @@ async fn robots() -> HttpResponse { .body(include_str!("../static/robots.txt")) } -#[get("/favicon.ico")] async fn favicon() -> HttpResponse { - HttpResponse::Ok().body("") + HttpResponse::Ok() + .header("Cache-Control", "public, max-age=1209600, s-maxage=86400") + .body(include_bytes!("../static/favicon.ico").as_ref()) } #[actix_web::main] @@ -64,7 +65,7 @@ async fn main() -> std::io::Result<()> { .default_service(web::get().to(|| utils::error("Nothing here".to_string()))) // GENERAL SERVICES .route("/style.css/", web::get().to(style)) - .route("/favicon.ico/", web::get().to(HttpResponse::Ok)) + .route("/favicon.ico/", web::get().to(favicon)) .route("/robots.txt/", web::get().to(robots)) // SETTINGS SERVICE .route("/settings/", web::get().to(settings::get)) diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..4ba6bfc25096d08d91936ac3f0473b64463ddf4c GIT binary patch literal 789 zcmV+w1M2*VP)z=qa37iL`vLEH<>1Ct`s9%fNvOaVv( z%UbKhh6Ff{(_xHB0W%^J2}2wpqy(%0i(2ce&;o4R?h%o1K%x=i03jLReNZ)O1lYFy zMnt{?FPlMLCE^Si*IMt^72r5dFYu$;FgQ5qk2^a% z`2!S2M*MeHKF`(I7{p=#l)JhDs~{o?@8_Ncu)yDHGl4Tg;wqW+$pNHXzAJsktRrin zdFa{{_aFm5M>F_5h2(I|3|Ou~_8#`uag6#bU8uDC2PfwWhQO*yd?X z>2S3@ztM`7Qb)#^ap3HU$j5Kr4QkE;&$kcbma19E;M(!s+kv*A?2C(wY&;(S3Ooab zf`o=d3HSnh&|3crN_djXDQ;s+1IykHtBZRDRNy$yjqABFrdvenUeA?Mp-$PqD7XmE T`ywb;00000NkvXXu0mjffyr@+ literal 0 HcmV?d00001 diff --git a/templates/base.html b/templates/base.html index 4ac0cb1..b01e205 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,6 +8,7 @@ + {% endblock %} diff --git a/templates/post.html b/templates/post.html index 1a410df..4493f5a 100644 --- a/templates/post.html +++ b/templates/post.html @@ -27,7 +27,7 @@ {% endif %} {{ item.time }} -

{{ item.body }}

+
{{ item.body }}
{%- endmacro %}