add website favicons
This commit is contained in:
@@ -11,6 +11,8 @@ use crate::website::pages::index::page_index;
|
||||
mod pages;
|
||||
|
||||
const STYLES_CSS: &str = include_str!("../../web/styles.css");
|
||||
const FAVICON_SVG: &str = include_str!("../../assets/logo.svg");
|
||||
const FAVICON_X64: &[u8] = include_bytes!("../../assets/logo-x64.png");
|
||||
|
||||
pub async fn website_service(req: Request<Body>) -> Result<Response, Infallible> {
|
||||
let path = req.uri().path().trim_start_matches("/");
|
||||
@@ -18,6 +20,8 @@ pub async fn website_service(req: Request<Body>) -> Result<Response, Infallible>
|
||||
Ok(match path {
|
||||
"" | "index" | "index.html" | "index.htm" => page_index().await,
|
||||
"styles.css" => ([(header::CONTENT_TYPE, "text/css")], STYLES_CSS).into_response(),
|
||||
"favicon.svg" => ([(header::CONTENT_TYPE, "image/svg+xml")], FAVICON_SVG).into_response(),
|
||||
"favicon-x64.png" => ([(header::CONTENT_TYPE, "image/png")], FAVICON_X64).into_response(),
|
||||
_ => StatusCode::NOT_FOUND.into_response(),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user