mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 21:48:21 -05:00
✨ feat: implement code to pass safe search option in the json results (#210)
This commit is contained in:
parent
81a21d0b26
commit
5c8cbee5d9
@ -122,6 +122,8 @@ pub struct SearchResults {
|
||||
/// search query was filtered when the safe search level set to 3 and it
|
||||
/// was present in the `Blocklist` file.
|
||||
pub filtered: bool,
|
||||
/// Stores the safe search level `safesearch` provided in the search url.
|
||||
pub safe_search_level: u8,
|
||||
}
|
||||
|
||||
impl SearchResults {
|
||||
@ -147,6 +149,7 @@ impl SearchResults {
|
||||
engine_errors_info: engine_errors_info.to_owned(),
|
||||
disallowed: Default::default(),
|
||||
filtered: Default::default(),
|
||||
safe_search_level: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,4 +181,9 @@ impl SearchResults {
|
||||
pub fn results(&mut self) -> Vec<SearchResult> {
|
||||
self.results.clone()
|
||||
}
|
||||
|
||||
/// A setter function to set the current page safe search level.
|
||||
pub fn set_safe_search_level(&mut self, safe_search_level: u8) {
|
||||
self.safe_search_level = safe_search_level;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user