implement exit button as trait, set disconnect button status update by total

This commit is contained in:
yggverse 2025-01-29 20:37:56 +02:00
parent e1345a4922
commit 91cd9cbae9
4 changed files with 41 additions and 26 deletions

View file

@ -124,6 +124,11 @@ impl Auth {
.is_some_and(|auth| auth.profile_identity_id == profile_identity_id)
}
/// Check request string matches condition
pub fn total(&self, profile_identity_id: i64) -> usize {
self.memory.total(profile_identity_id)
}
/// Collect certificate scope vector from `Profile` database for `profile_identity_id`
pub fn scope(&self, profile_identity_id: i64) -> Vec<String> {
let mut scope = Vec::new();

View file

@ -79,4 +79,17 @@ impl Memory {
// Get first copy
result.first().cloned()
}
/// Get identity exactly match `scope`
/// * [Client certificates specification](https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates)
/// * see also parent `is_match_request`
pub fn total(&self, profile_identity_id: i64) -> usize {
let mut total = 0;
for (_, _profile_identity_id) in self.index.borrow().iter() {
if *_profile_identity_id == profile_identity_id {
total += 1
}
}
total
}
}