Simplify static routes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Valentin Brandl 2022-02-01 19:41:17 +01:00
parent 7a9def97cb
commit c2fb288a07

View File

@ -462,10 +462,12 @@ async fn async_p404(repo_count: web::Data<AtomicUsize>) -> Result<HttpResponse>
p404(repo_count) p404(repo_count)
} }
#[get("/tacit-css.min.css")]
async fn css() -> HttpResponse { async fn css() -> HttpResponse {
HttpResponse::Ok().content_type("text/css").body(CSS) HttpResponse::Ok().content_type("text/css").body(CSS)
} }
#[get("/favicon.ico")]
async fn favicon32() -> HttpResponse { async fn favicon32() -> HttpResponse {
HttpResponse::Ok().content_type("image/png").body(FAVICON) HttpResponse::Ok().content_type("image/png").body(FAVICON)
} }
@ -484,8 +486,8 @@ async fn start_server(listener: TcpListener, settings: Settings) -> std::io::Res
.wrap(middleware::NormalizePath::new(TrailingSlash::Trim)) .wrap(middleware::NormalizePath::new(TrailingSlash::Trim))
.service(index) .service(index)
.service(health_check) .service(health_check)
.service(web::resource("/tacit-css.min.css").route(web::get().to(css))) .service(css)
.service(web::resource("/favicon.ico").route(web::get().to(favicon32))) .service(favicon32)
.service(generate) .service(generate)
.default_service(web::to(async_p404)); .default_service(web::to(async_p404));
let app = GitHub::register_service(app); let app = GitHub::register_service(app);