Serve favicon
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2019-05-13 21:58:07 +02:00
parent a7441f79cb
commit 0a58a75cd1
No known key found for this signature in database
GPG Key ID: 30D341DD34118D7D

View File

@ -81,6 +81,7 @@ struct State {
}
const CSS: &str = include_str!("../static/tacit-css.min.css");
const FAVICON: &[u8] = include_bytes!("../static/favicon32.png");
#[derive(StructOpt, Debug)]
struct Opt {
@ -356,6 +357,11 @@ fn css() -> HttpResponse {
HttpResponse::Ok().content_type("text/css").body(CSS)
}
#[get("/favicon.ico")]
fn favicon32() -> HttpResponse {
HttpResponse::Ok().content_type("image/png").body(FAVICON)
}
fn main() -> std::io::Result<()> {
std::env::set_var("RUST_LOG", "actix_web=info,hoc=info");
pretty_env_logger::init();
@ -371,6 +377,7 @@ fn main() -> std::io::Result<()> {
.wrap(middleware::Logger::default())
.service(index)
.service(css)
.service(favicon32)
.service(generate)
.service(web::resource("/github/{user}/{repo}").to(calculate_hoc::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}").to(calculate_hoc::<Gitlab>))