Add cached TOTP search (#77)
This commit is contained in:
1 parent
1ce7b7814b
commit
87f9e7be98
7 files changed
+156
-7
No files matched your search
@@ -423,14 +423,25 @@ impl<'a> MobileTotpService<'a> {
|
||||
&self,
|
||||
shared: &BTreeSet<EntryPath>,
|
||||
cache_path: &Path,
|
||||
) -> Option<MobileTotpPage> {
|
||||
self.search_cached_page(shared, cache_path, "")
|
||||
}
|
||||
|
||||
pub fn search_cached_page(
|
||||
&self,
|
||||
shared: &BTreeSet<EntryPath>,
|
||||
cache_path: &Path,
|
||||
query: &str,
|
||||
) -> Option<MobileTotpPage> {
|
||||
let store = store_identity(self.repository.root_path(), cache_path);
|
||||
let (catalog, _) = load_cache(cache_path, &store);
|
||||
let query = query.trim().to_lowercase();
|
||||
let mut rows: Vec<_> = catalog?
|
||||
.entries
|
||||
.into_iter()
|
||||
.filter(|(_, record)| record.is_totp)
|
||||
.filter_map(|(path, _)| EntryPath::parse(&path).ok())
|
||||
.filter(|path| query.is_empty() || path.to_string().to_lowercase().contains(&query))
|
||||
.map(|path| cached_row(&path, shared.contains(&path)))
|
||||
.collect();
|
||||
sort_rows(&mut rows);
|
||||
|
||||
Reference in new issue
Block a user