feat: allow http head requests

This commit is contained in:
neri 2023-04-14 10:00:44 +02:00
parent 39e72a8eb6
commit 7d332b7c31
1 changed files with 14 additions and 11 deletions

View File

@ -80,24 +80,27 @@ async fn main() -> std::io::Result<()> {
.app_data(db.clone())
.app_data(expiry_watch_sender.clone())
.app_data(config.clone())
.service(web::resource("/").route(web::get().to(upload::index)))
.service(
web::resource("/")
.route(web::get().to(upload::index))
.route(web::head().to(upload::index)),
)
.service(web::resource("/upload").route(web::post().to(upload::upload)))
.service(
web::resource(["/upload/{id}", "/upload/{id}/{name}"])
.route(web::get().to(upload::uploaded)),
.route(web::get().to(upload::uploaded))
.route(web::head().to(upload::uploaded)),
)
.service(Files::new("/static", "static").disable_content_disposition())
.default_service(web::route().to(not_found))
.service(
web::resource([
"/{id:[a-z0-9]{5}}",
"/{id:[a-z0-9]{5}}/{name}",
])
web::resource(["/{id:[a-z0-9]{5}}", "/{id:[a-z0-9]{5}}/{name}"])
.wrap(Condition::new(
config.enable_rate_limit,
Governor::new(&governor_conf),
))
.route(web::get().to(download::download)),
.route(web::get().to(download::download))
.route(web::head().to(download::download)),
)
}
})