also mount domain_validation into /custom_domains/

This commit is contained in:
Igor Galić 2019-08-20 11:47:24 +02:00
parent f67ce93d94
commit df47cddb87
No known key found for this signature in database
GPG Key ID: ACFEFF7F6A123A86
2 changed files with 23 additions and 5 deletions

View File

@ -200,6 +200,14 @@ Then try to restart Plume
let valid_domains: HashMap<String, Instant> = 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![

View File

@ -99,7 +99,8 @@ pub fn new(rockets: PlumeRocket, _user: User) -> Ructe {
))
}
#[get("/domain_validation/<validation_id>")]
// mounted as /domain_validation/
#[get("/<validation_id>")]
pub fn domain_validation(
validation_id: String,
valid_domains: State<Mutex<HashMap<String, Instant>>>,
@ -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("/<custom_domain>?<page>", 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("/<validation_id>")]
pub fn domain_validation(
validation_id: String,
valid_domains: State<Mutex<HashMap<String, Instant>>>,
) -> Status {
super::domain_validation(validation_id, valid_domains)
}
}
#[get("/blogs/new", rank = 2)]