Add custom_details and custom_activity_details as first routes
how this works: we use find_by_host() to find the Host in question, the defer to the existing function! Caveat: Currently, we, in that function, we do another lookup DB lookup for the Blog, even thou we already know it. It might be wise, to have both of those another wrapper here?!
This commit is contained in:
@@ -197,6 +197,13 @@ Then try to restart Plume
|
||||
});
|
||||
|
||||
let rocket = rocket::custom(CONFIG.rocket.clone().unwrap())
|
||||
.mount(
|
||||
"/custom_domains/",
|
||||
routes![
|
||||
routes::blogs::custom_details,
|
||||
routes::blogs::custom_activity_details,
|
||||
],
|
||||
)
|
||||
.mount(
|
||||
"/",
|
||||
routes![
|
||||
|
||||
@@ -19,6 +19,16 @@ use plume_models::{
|
||||
use routes::{errors::ErrorPage, Page, RespondOrRedirect};
|
||||
use template_utils::{IntoContext, Ructe};
|
||||
|
||||
#[get("/<custom_domain>?<page>", rank = 2)]
|
||||
pub fn custom_details(
|
||||
custom_domain: String,
|
||||
page: Option<Page>,
|
||||
rockets: PlumeRocket,
|
||||
) -> Result<Ructe, ErrorPage> {
|
||||
let blog = Blog::find_by_host(&rockets, Host::new(custom_domain))?;
|
||||
details(blog.fqn, page, rockets)
|
||||
}
|
||||
|
||||
#[get("/~/<name>?<page>", rank = 2)]
|
||||
pub fn details(name: String, page: Option<Page>, rockets: PlumeRocket) -> Result<Ructe, ErrorPage> {
|
||||
let page = page.unwrap_or_default();
|
||||
@@ -38,6 +48,16 @@ pub fn details(name: String, page: Option<Page>, rockets: PlumeRocket) -> Result
|
||||
)))
|
||||
}
|
||||
|
||||
#[get("/<custom_domain>", rank = 1)]
|
||||
pub fn custom_activity_details(
|
||||
custom_domain: String,
|
||||
rockets: PlumeRocket,
|
||||
_ap: ApRequest,
|
||||
) -> Option<ActivityStream<CustomGroup>> {
|
||||
let blog = Blog::find_by_host(&rockets, Host::new(custom_domain)).ok()?;
|
||||
activity_details(blog.fqn, rockets, _ap)
|
||||
}
|
||||
|
||||
#[get("/~/<name>", rank = 1)]
|
||||
pub fn activity_details(
|
||||
name: String,
|
||||
|
||||
Reference in New Issue
Block a user