diff options
| author | Carpenter, Adam (CORP) <adam.carpenter@adp.com> | 2021-12-09 11:56:49 -0500 | 
|---|---|---|
| committer | Carpenter, Adam (CORP) <adam.carpenter@adp.com> | 2021-12-09 11:56:49 -0500 | 
| commit | 8cf1549a87c984337eb013a67e8e211cfe18cd24 (patch) | |
| tree | b244cf4bcc05282bfd1b57b4b5d226f1596e6d1b /angelsharkd | |
| parent | 5e82b9ed1f7f236d596500478588dd2f84231fef (diff) | |
| download | altruistic-angelshark-8cf1549a87c984337eb013a67e8e211cfe18cd24.tar.xz altruistic-angelshark-8cf1549a87c984337eb013a67e8e211cfe18cd24.zip | |
chore: cleanup, remove commented code, naming
Diffstat (limited to 'angelsharkd')
| -rw-r--r-- | angelsharkd/src/routes/extensions/mod.rs | 6 | ||||
| -rw-r--r-- | angelsharkd/src/routes/extensions/simple_search/mod.rs | 4 | 
2 files changed, 4 insertions, 6 deletions
| diff --git a/angelsharkd/src/routes/extensions/mod.rs b/angelsharkd/src/routes/extensions/mod.rs index cada47f..54053af 100644 --- a/angelsharkd/src/routes/extensions/mod.rs +++ b/angelsharkd/src/routes/extensions/mod.rs @@ -8,7 +8,7 @@ mod simple_search;  /// The extension filter; consists of all compiled optional Angelshark extension  /// filters combined under `/extensions`. -pub fn filter(_config: &Config) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone { +pub fn filter(config: &Config) -> impl Filter<Extract = impl Reply, Error = Rejection> + Clone {      // Note: this next line deals with the common edge case of having no      // extensions loaded with feature flags. It ensures that the the type      // checking is right when the return `.and()` is called below. @@ -17,14 +17,14 @@ pub fn filter(_config: &Config) -> impl Filter<Extract = impl Reply, Error = Rej      // Block to enable simple_search extension feature. Instantiates a      // searchable haystack and configures filters to handle search requests.      #[cfg(feature = "simple_search")] -    let haystack = simple_search::Haystack::new(_config.runner.clone()); +    let haystack = simple_search::Haystack::new(config.runner.clone());      #[cfg(feature = "simple_search")]      let filters = filters          .or(simple_search::search_filter(haystack.clone()))          .or(simple_search::refresh_filter(haystack));      #[cfg(feature = "simple_deprov")] -    let filters = filters.or(simple_deprov::filter()); +    let filters = filters.or(simple_deprov::filter(config.runner.clone()));      path("extensions").and(filters)  } diff --git a/angelsharkd/src/routes/extensions/simple_search/mod.rs b/angelsharkd/src/routes/extensions/simple_search/mod.rs index 5b5dc8e..350edc8 100644 --- a/angelsharkd/src/routes/extensions/simple_search/mod.rs +++ b/angelsharkd/src/routes/extensions/simple_search/mod.rs @@ -21,7 +21,7 @@ pub fn search_filter(          .and(post())          .and(content_length_limit(1024 * 16))          .and(json()) -        .and_then(move |terms: Needles| search(haystack.to_owned(), terms)) +        .and_then(move |needles: Needles| search(haystack.to_owned(), needles))          .with(with::header(header::PRAGMA, "no-cache"))          .with(with::header(header::CACHE_CONTROL, "no-store, max-age=0"))          .with(with::header(header::X_FRAME_OPTIONS, "DENY")) @@ -39,8 +39,6 @@ pub fn refresh_filter(  /// Runs the search request to find all needles in the haystack and converts the  /// results into a reply.  async fn search(haystack: Haystack, needles: Needles) -> Result<impl Reply, Infallible> { -    // Ok(haystack.search(Vec::new())?) -    // if let Ok(matches = haystack.search(needle);      match haystack.search(needles) {          Ok(matches) => Ok(reply::with_status(reply::json(&matches), StatusCode::OK)),          Err(e) => Ok(reply::with_status( |