Allow searching from custom_domain

This commit is contained in:
Igor Galić 2019-05-30 18:26:55 +02:00 committed by Igor Galić
parent 92fbd174eb
commit 8e7f789969
No known key found for this signature in database
GPG Key ID: ACFEFF7F6A123A86
2 changed files with 16 additions and 2 deletions

View File

@ -202,6 +202,7 @@ Then try to restart Plume
routes![ routes![
routes::blogs::custom_details, routes::blogs::custom_details,
routes::blogs::custom_activity_details, routes::blogs::custom_activity_details,
routes::search::custom_search,
], ],
) )
.mount( .mount(

View File

@ -49,8 +49,7 @@ macro_rules! param_to_query {
} }
} }
#[get("/search?<query..>")] fn search_guts(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
pub fn search(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let query = query.map(Form::into_inner).unwrap_or_default(); let query = query.map(Form::into_inner).unwrap_or_default();
let page = query.page.unwrap_or_default(); let page = query.page.unwrap_or_default();
@ -83,3 +82,17 @@ pub fn search(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
)) ))
} }
} }
#[get("/search?<query..>")]
pub fn search(query: Option<Form<SearchQuery>>, rockets: PlumeRocket) -> Ructe {
search_guts(query, rockets)
}
#[get("/<_custom_domain>/search?<query..>")]
pub fn custom_search(
_custom_domain: String,
query: Option<Form<SearchQuery>>,
rockets: PlumeRocket,
) -> Ructe {
search_guts(query, rockets)
}