diff --git a/src/orangutan-server/src/main.rs b/src/orangutan-server/src/main.rs index 23bab64..cdaee9a 100644 --- a/src/orangutan-server/src/main.rs +++ b/src/orangutan-server/src/main.rs @@ -56,7 +56,7 @@ fn rocket() -> _ { update_content_github, update_content_other, ]) - .register("/", catchers![not_found]) + .register("/", catchers![unauthorized, not_found]) .manage(ObjectReader::new()) .attach(AdHoc::on_liftoff("Tracing subsciber", |_| { Box::pin(async move { @@ -307,8 +307,7 @@ fn update_content_other(source: &str) -> BadRequest { BadRequest(format!("Source '{source}' is not supported.")) } -#[catch(404)] -async fn not_found() -> Result { +async fn _not_found() -> Result { let website_id = WebsiteId::default(); let website_dir = match generate_website_if_needed(&website_id) { Ok(dir) => dir, @@ -328,6 +327,16 @@ async fn not_found() -> Result { }) } +#[catch(401)] +async fn unauthorized() -> Result { + _not_found().await +} + +#[catch(404)] +async fn not_found() -> Result { + _not_found().await +} + fn allowed_profiles<'r>(path: &String) -> Option> { let path = path.rsplit_once("@").unwrap_or((path, "")).0; let data_file = data_file(&Path::new(path).to_path_buf());