add in template and as static resource
This commit is contained in:
parent
cc504f781e
commit
ef5d07392b
2 changed files with 14 additions and 0 deletions
|
@ -8,6 +8,12 @@ struct WaterCSS<'a> {
|
||||||
_marker: PhantomData<&'a ()>,
|
_marker: PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "favicon.svg", escape = "none")]
|
||||||
|
struct Favicon<'a> {
|
||||||
|
_marker: PhantomData<&'a ()>,
|
||||||
|
}
|
||||||
|
|
||||||
#[get("/static/{resource}")]
|
#[get("/static/{resource}")]
|
||||||
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
||||||
match resource_id.into_inner().as_str() {
|
match resource_id.into_inner().as_str() {
|
||||||
|
@ -18,6 +24,13 @@ pub async fn static_resources(resource_id: web::Path<String>) -> HttpResponse {
|
||||||
.render()
|
.render()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
),
|
),
|
||||||
|
"favicon.svg" => HttpResponse::Ok().content_type("image/svg+xml").body(
|
||||||
|
Favicon {
|
||||||
|
_marker: Default::default(),
|
||||||
|
}
|
||||||
|
.render()
|
||||||
|
.unwrap(),
|
||||||
|
),
|
||||||
_ => HttpResponse::NotFound().content_type("text/html").finish(),
|
_ => HttpResponse::NotFound().content_type("text/html").finish(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
|
||||||
{% if !args.pure_html %}
|
{% if !args.pure_html %}
|
||||||
<link rel="stylesheet" href="/static/water.css">
|
<link rel="stylesheet" href="/static/water.css">
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in a new issue