mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 00:55:28 +00:00
add memory cache for gemini identities search
This commit is contained in:
parent
d9bf85884b
commit
f347c28f6f
4 changed files with 75 additions and 13 deletions
|
|
@ -37,21 +37,18 @@ impl Identity {
|
|||
}
|
||||
}
|
||||
|
||||
/// Get `pem` record match `request`
|
||||
///
|
||||
/// https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates
|
||||
/// Get `pem` record match `request` according to
|
||||
/// [Gemini protocol specification](https://geminiprotocol.net/docs/protocol-specification.gmi#client-certificates)
|
||||
/// * this function work with memory cache not database
|
||||
pub fn gemini(&self, request: &str) -> Option<String> {
|
||||
// @TODO apply protocol rules to certificate selection
|
||||
for profile_identity_gemini_id in self.gemini.auth.memory.starts_with(request) {
|
||||
if let Ok(gemini_records) = self.gemini.database.records() {
|
||||
for gemini_record in gemini_records {
|
||||
if gemini_record.id == profile_identity_gemini_id {
|
||||
return Some(gemini_record.pem);
|
||||
}
|
||||
}
|
||||
if let Ok(pem) = self.gemini.memory.get(profile_identity_gemini_id) {
|
||||
return Some(pem);
|
||||
}
|
||||
}
|
||||
None
|
||||
} // @TODO apply protocol rules to selection
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue