From 771908a33451af0da8764f93a02fc3811aee550d Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 22 Jan 2025 19:32:44 +0200 Subject: [PATCH] add scope alias for Titan protocol --- src/profile/identity/gemini/auth/memory.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/profile/identity/gemini/auth/memory.rs b/src/profile/identity/gemini/auth/memory.rs index e8b434bc..7288fa2a 100644 --- a/src/profile/identity/gemini/auth/memory.rs +++ b/src/profile/identity/gemini/auth/memory.rs @@ -66,7 +66,7 @@ impl Memory { // Get all records starts with `scope` for (scope, &profile_identity_gemini_id) in self.index.borrow().iter() { - if request.starts_with(scope) { + if alias(request).starts_with(scope) { result.push(Auth { profile_identity_gemini_id, scope: scope.clone(), @@ -81,3 +81,12 @@ impl Memory { result.first().cloned() } } + +// Tools + +// @TODO optional +fn alias(request: &str) -> String { + request + .replace("gemini://", "titan://") + .replace("titan://", "gemini://") +}