From 836ab03ccf24f9f8b866bd5b4e0520ade7a89bd2 Mon Sep 17 00:00:00 2001
From: JesusPerez <jpl@jesusperez.pro>
Date: Tue, 12 Oct 2021 11:11:37 +0100
Subject: [PATCH] chore: home filter

---
 src/filters.rs | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/src/filters.rs b/src/filters.rs
index 64ad11f..c211e82 100644
--- a/src/filters.rs
+++ b/src/filters.rs
@@ -67,6 +67,18 @@ impl CollFilters {
       prfx: String::from(prfx),
     }
   }
+	pub fn filters_home(
+		&self,
+		db: DataDBs,
+		cloud: Cloud,
+		cors: warp::cors::Builder,
+		path: &str,
+		//) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
+	) -> BoxedFilter<(impl warp::Reply,)> { 
+    let url_path: &'static str = Box::leak(format!("{}",&path).into_boxed_str());
+		self.home(db.clone(),cloud.clone(),url_path,cors.clone())
+			.boxed()
+	}
 	pub fn filters_defs(
 		&self,
 		db: DataDBs,
@@ -125,6 +137,30 @@ impl CollFilters {
 			.or(self.liveness(db.clone(),cloud.clone(),liveness_path,cors.clone()))
 			.or(self.apps(db.clone(),cloud.clone(),apps_path,cors.clone()))
 			.boxed()
+  }
+	pub fn home(
+    &self,
+    db: DataDBs,
+		cloud: Cloud,
+    path: &'static str, 
+    cors: warp::cors::Builder,
+  //) -> impl Filter<Extract = impl warp::Reply, Error = warp::Rejection> + Clone {
+  ) -> BoxedFilter<(impl warp::Reply,)> {
+    let prfx = self.prfx.to_owned();
+		warp::path(path)
+			.and(warp::get())
+			// .and(warp::query::<KloudQueryConfigFilters>())
+			.and(headers_cloned())
+			.and(method())
+			// .and_then(user_authentication)
+			// .and(warp::header::optional::<String>("authorization"))
+			// .and(warp::header::optional::<String>("accept-language"))
+			.and(self.with_db(db))
+			.and(warp::any().map(move || cloud.to_owned()))
+			.and(warp::any().map(move || prfx.to_owned()))
+      .and_then(handlers::h_home::home)
+      .with(cors)
+      .boxed()
   }
   /// GET /ta?offset=3&limit=5
   pub fn list(