Skip to content

Commit fd5b1ec

Browse files
committed
fix(main): serve /favicon.png
1 parent 810fdac commit fd5b1ec

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/main.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ async fn favicon() -> Result<Response<Body>, String> {
5252
)
5353
}
5454

55+
async fn favicon_png() -> Result<Response<Body>, String> {
56+
Ok(
57+
Response::builder()
58+
.status(200)
59+
.header("content-type", "image/png")
60+
.header("Cache-Control", "public, max-age=1209600, s-maxage=86400")
61+
.body(full(include_bytes!("../static/favicon.png").as_ref()))
62+
.unwrap_or_default(),
63+
)
64+
}
65+
5566
async fn font() -> Result<Response<Body>, String> {
5667
Ok(
5768
Response::builder()
@@ -241,6 +252,7 @@ async fn main() {
241252
.boxed()
242253
});
243254
app.at("/favicon.ico").get(|_| favicon().boxed());
255+
app.at("/favicon.png").get(|_| favicon_png().boxed());
244256
app.at("/logo.png").get(|_| pwa_logo().boxed());
245257
app.at("/Inter.var.woff2").get(|_| font().boxed());
246258
app.at("/touch-icon-iphone.png").get(|_| iphone_logo().boxed());

0 commit comments

Comments
 (0)