diff --git a/src/application/routes/app/mod.rs b/src/application/routes/app/mod.rs index a70a4fd..be27bd0 100644 --- a/src/application/routes/app/mod.rs +++ b/src/application/routes/app/mod.rs @@ -73,6 +73,9 @@ pub(super) fn router() -> axum::Router { .route("/static/favicon-light.svg", get(favicon_light)) .route("/static/favicon-dark.svg", get(favicon_dark)) .route("/static/og-image.png", get(og_image)) + .route("/static/app-icon-192.png", get(app_icon_192)) + .route("/static/app-icon-512.png", get(app_icon_512)) + .route("/static/site.webmanifest", get(site_webmanifest)) .route("/health", get(health)) } @@ -210,6 +213,36 @@ async fn og_image() -> impl IntoResponse { ) } +async fn app_icon_192() -> impl IntoResponse { + ( + [ + ("content-type", "image/png"), + ("cache-control", "public, max-age=604800"), + ], + include_bytes!("../../../../static/app-icon-192.png").as_slice(), + ) +} + +async fn app_icon_512() -> impl IntoResponse { + ( + [ + ("content-type", "image/png"), + ("cache-control", "public, max-age=604800"), + ], + include_bytes!("../../../../static/app-icon-512.png").as_slice(), + ) +} + +async fn site_webmanifest() -> impl IntoResponse { + ( + [ + ("content-type", "application/manifest+json; charset=utf-8"), + ("cache-control", "public, max-age=604800"), + ], + include_str!("../../../../static/site.webmanifest"), + ) +} + async fn health() -> impl IntoResponse { ([("content-type", "application/json")], r#"{"status":"ok"}"#) } diff --git a/static/app-icon-192.png b/static/app-icon-192.png new file mode 100644 index 0000000..6c3bb19 Binary files /dev/null and b/static/app-icon-192.png differ diff --git a/static/app-icon-512.png b/static/app-icon-512.png new file mode 100644 index 0000000..63a2981 Binary files /dev/null and b/static/app-icon-512.png differ diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000..73390db --- /dev/null +++ b/static/site.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Brewlog", + "short_name": "Brewlog", + "icons": [ + { "src": "/static/app-icon-192.png", "sizes": "192x192", "type": "image/png" }, + { "src": "/static/app-icon-512.png", "sizes": "512x512", "type": "image/png" } + ], + "start_url": "/", + "display": "standalone", + "background_color": "#fafaf9", + "theme_color": "#c2410c" +} diff --git a/templates/base.html b/templates/base.html index 5697e31..80de718 100644 --- a/templates/base.html +++ b/templates/base.html @@ -35,6 +35,10 @@ type="image/svg+xml" href="/static/favicon-light.svg" /> + + + +