2022-06-03 16:24:34 +00:00
|
|
|
use actix_web::{get, web, HttpResponse};
|
|
|
|
use askama::Template;
|
|
|
|
use std::marker::PhantomData;
|
|
|
|
|
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "water.css", escape = "none")]
|
|
|
|
struct WaterCSS<'a> {
|
|
|
|
_marker: PhantomData<&'a ()>,
|
|
|
|
}
|
|
|
|
|
2022-10-01 05:52:08 +00:00
|
|
|
#[derive(Template)]
|
|
|
|
#[template(path = "favicon.svg", escape = "none")]
|
|
|
|
struct Favicon<'a> {
|
|
|
|
_marker: PhantomData<&'a ()>,
|
|
|
|
}
|
|
|
|
|
2022-06-03 16:24:34 +00:00
|
|
|
#[get("/static/{resource}")]
|
|
|
|
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
|
|
|
match resource_id.into_inner().as_str() {
|
2022-06-04 20:50:34 +00:00
|
|
|
"water.css" => HttpResponse::Ok().content_type("text/css").body(
|
2022-06-03 16:24:34 +00:00
|
|
|
WaterCSS {
|
|
|
|
_marker: Default::default(),
|
|
|
|
}
|
|
|
|
.render()
|
|
|
|
.unwrap(),
|
|
|
|
),
|
2022-10-01 05:52:08 +00:00
|
|
|
"favicon.svg" => HttpResponse::Ok().content_type("image/svg+xml").body(
|
|
|
|
Favicon {
|
|
|
|
_marker: Default::default(),
|
|
|
|
}
|
|
|
|
.render()
|
|
|
|
.unwrap(),
|
|
|
|
),
|
2022-06-03 16:24:34 +00:00
|
|
|
_ => HttpResponse::NotFound().content_type("text/html").finish(),
|
|
|
|
}
|
|
|
|
}
|