diff --git a/src/main.rs b/src/main.rs index 42640992..7ea006cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -200,6 +200,14 @@ Then try to restart Plume let valid_domains: HashMap = HashMap::new(); let rocket = rocket::custom(CONFIG.rocket.clone().unwrap()) + .mount( + "/custom_domains/domain_validation/", + routes![routes::blogs::custom::domain_validation,], + ) + .mount( + "/domain_validation/", + routes![routes::blogs::domain_validation,], + ) .mount( "/custom_domains/", routes![ @@ -209,10 +217,6 @@ Then try to restart Plume routes::search::custom::search, ], ) - .mount( - "/domain_validation/", - routes![routes::blogs::domain_validation,], - ) .mount( "/", routes![ diff --git a/src/routes/blogs.rs b/src/routes/blogs.rs index 54e85561..6cbcd460 100644 --- a/src/routes/blogs.rs +++ b/src/routes/blogs.rs @@ -99,7 +99,8 @@ pub fn new(rockets: PlumeRocket, _user: User) -> Ructe { )) } -#[get("/domain_validation/")] +// mounted as /domain_validation/ +#[get("/")] pub fn domain_validation( validation_id: String, valid_domains: State>>, @@ -132,7 +133,11 @@ pub fn domain_validation( pub mod custom { use plume_common::activity_pub::{ActivityStream, ApRequest}; use plume_models::{blogs::Blog, blogs::CustomGroup, blogs::Host, PlumeRocket}; + use rocket::{http::Status, State}; use routes::{errors::ErrorPage, Page, RespondOrRedirect}; + use std::collections::HashMap; + use std::sync::Mutex; + use std::time::Instant; #[get("/?", rank = 2)] pub fn details( @@ -153,6 +158,15 @@ pub mod custom { let blog = Blog::find_by_host(&rockets, Host::new(custom_domain)).ok()?; super::activity_detail_guts(blog, rockets, _ap) } + + // mounted as /custom_domains/domain_validation/ + #[get("/")] + pub fn domain_validation( + validation_id: String, + valid_domains: State>>, + ) -> Status { + super::domain_validation(validation_id, valid_domains) + } } #[get("/blogs/new", rank = 2)]