also mount domain_validation into /custom_domains/
This commit is contained in:
parent
f67ce93d94
commit
df47cddb87
12
src/main.rs
12
src/main.rs
@ -200,6 +200,14 @@ Then try to restart Plume
|
|||||||
|
|
||||||
let valid_domains: HashMap<String, Instant> = HashMap::new();
|
let valid_domains: HashMap<String, Instant> = HashMap::new();
|
||||||
let rocket = rocket::custom(CONFIG.rocket.clone().unwrap())
|
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(
|
.mount(
|
||||||
"/custom_domains/",
|
"/custom_domains/",
|
||||||
routes![
|
routes![
|
||||||
@ -209,10 +217,6 @@ Then try to restart Plume
|
|||||||
routes::search::custom::search,
|
routes::search::custom::search,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
.mount(
|
|
||||||
"/domain_validation/",
|
|
||||||
routes![routes::blogs::domain_validation,],
|
|
||||||
)
|
|
||||||
.mount(
|
.mount(
|
||||||
"/",
|
"/",
|
||||||
routes![
|
routes![
|
||||||
|
@ -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(
|
pub fn domain_validation(
|
||||||
validation_id: String,
|
validation_id: String,
|
||||||
valid_domains: State<Mutex<HashMap<String, Instant>>>,
|
valid_domains: State<Mutex<HashMap<String, Instant>>>,
|
||||||
@ -132,7 +133,11 @@ pub fn domain_validation(
|
|||||||
pub mod custom {
|
pub mod custom {
|
||||||
use plume_common::activity_pub::{ActivityStream, ApRequest};
|
use plume_common::activity_pub::{ActivityStream, ApRequest};
|
||||||
use plume_models::{blogs::Blog, blogs::CustomGroup, blogs::Host, PlumeRocket};
|
use plume_models::{blogs::Blog, blogs::CustomGroup, blogs::Host, PlumeRocket};
|
||||||
|
use rocket::{http::Status, State};
|
||||||
use routes::{errors::ErrorPage, Page, RespondOrRedirect};
|
use routes::{errors::ErrorPage, Page, RespondOrRedirect};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::sync::Mutex;
|
||||||
|
use std::time::Instant;
|
||||||
|
|
||||||
#[get("/<custom_domain>?<page>", rank = 2)]
|
#[get("/<custom_domain>?<page>", rank = 2)]
|
||||||
pub fn details(
|
pub fn details(
|
||||||
@ -153,6 +158,15 @@ pub mod custom {
|
|||||||
let blog = Blog::find_by_host(&rockets, Host::new(custom_domain)).ok()?;
|
let blog = Blog::find_by_host(&rockets, Host::new(custom_domain)).ok()?;
|
||||||
super::activity_detail_guts(blog, rockets, _ap)
|
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)]
|
#[get("/blogs/new", rank = 2)]
|
||||||
|
Loading…
Reference in New Issue
Block a user