diff options
author | 53hornet <atc@53hor.net> | 2022-01-01 12:27:41 -0500 |
---|---|---|
committer | 53hornet <atc@53hor.net> | 2022-01-01 12:27:41 -0500 |
commit | d7472320a00fa0bfd6b9be904e0730461f093f61 (patch) | |
tree | eadbbfd9a3b82eaafff30d0114fa7c0c7ca66e7d /src/routes | |
parent | 5d2c25bf3b196321ded7b7c7ac9ab9a2021fe9c3 (diff) | |
download | twinh-d7472320a00fa0bfd6b9be904e0730461f093f61.tar.xz twinh-d7472320a00fa0bfd6b9be904e0730461f093f61.zip |
Diffstat (limited to 'src/routes')
-rw-r--r-- | src/routes/mod.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/routes/mod.rs b/src/routes/mod.rs index be07aa0..1948657 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -9,6 +9,7 @@ use serde::{Deserialize, Serialize}; pub async fn router(req: Request<Body>) -> Result<Response<Body>, TwinHError> { match (req.method(), req.uri().path()) { + (&Method::GET, "/favicon.ico") | (&Method::GET, "/favicon.svg") => favicon(), (&Method::GET, "/") => index(req).await, (&Method::GET, "/cars") => cars(req).await, (&Method::GET, "/login") => login().await, @@ -128,6 +129,14 @@ async fn cars(req: Request<Body>) -> Result<Response<Body>, TwinHError> { todo!() } +fn favicon() -> Result<Response<Body>, TwinHError> { + let resp = Response::builder() + .header(hyper::header::CONTENT_TYPE, "image/svg+xml") + .body(templates::FAVICON.into()) + .unwrap(); + Ok(resp) +} + async fn index(req: Request<Body>) -> Result<Response<Body>, TwinHError> { let query = req.uri().query().unwrap_or_default(); let filter = serde_urlencoded::de::from_str::<PartsQuery>(query).unwrap(); |