From 8e7f7899693526a8a452f30a50f0845891c1538c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Thu, 30 May 2019 18:26:55 +0200 Subject: [PATCH] Allow searching from custom_domain --- src/main.rs | 1 + src/routes/search.rs | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c0fd2577..9c30c7b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -202,6 +202,7 @@ Then try to restart Plume routes![ routes::blogs::custom_details, routes::blogs::custom_activity_details, + routes::search::custom_search, ], ) .mount( diff --git a/src/routes/search.rs b/src/routes/search.rs index b605d103..11d921d7 100644 --- a/src/routes/search.rs +++ b/src/routes/search.rs @@ -49,8 +49,7 @@ macro_rules! param_to_query { } } -#[get("/search?")] -pub fn search(query: Option>, rockets: PlumeRocket) -> Ructe { +fn search_guts(query: Option>, rockets: PlumeRocket) -> Ructe { let conn = &*rockets.conn; let query = query.map(Form::into_inner).unwrap_or_default(); let page = query.page.unwrap_or_default(); @@ -83,3 +82,17 @@ pub fn search(query: Option>, rockets: PlumeRocket) -> Ructe { )) } } + +#[get("/search?")] +pub fn search(query: Option>, rockets: PlumeRocket) -> Ructe { + search_guts(query, rockets) +} + +#[get("/<_custom_domain>/search?")] +pub fn custom_search( + _custom_domain: String, + query: Option>, + rockets: PlumeRocket, +) -> Ructe { + search_guts(query, rockets) +}