diff options
Diffstat (limited to 'src/routes/static.rs')
-rw-r--r-- | src/routes/static.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/routes/static.rs b/src/routes/static.rs index 60a0084..d319efe 100644 --- a/src/routes/static.rs +++ b/src/routes/static.rs @@ -1,3 +1,4 @@ +use hitide_icons::ICONS_MAP; use std::sync::Arc; const FILE_MAIN_CSS: &[u8] = include_bytes!("../../res/main.css"); @@ -20,6 +21,14 @@ async fn handler_static_get( ); Ok(resp) + } else if let Some(icon) = ICONS_MAP.get(params.0.as_str()) { + let mut resp = hyper::Response::new(icon.content.into()); + resp.headers_mut().insert( + hyper::header::CONTENT_TYPE, + hyper::header::HeaderValue::from_static("image/svg+xml"), + ); + + Ok(resp) } else { Err(crate::Error::RoutingError(trout::RoutingFailure::NotFound)) } |