diff options
Diffstat (limited to 'app/src/oauth.rs')
-rw-r--r-- | app/src/oauth.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/oauth.rs b/app/src/oauth.rs index 795d5dc..9334eac 100644 --- a/app/src/oauth.rs +++ b/app/src/oauth.rs @@ -1,12 +1,13 @@ use std::{collections::HashMap, sync::Arc}; use serde::Deserialize; +use tauri::async_runtime::RuntimeHandle; use tokio::sync::Mutex; use tokio::sync::oneshot::{channel, Sender, Receiver}; use uuid::Uuid; use crate::OAUTH_CLIENT_NAME; #[derive(Clone)] -pub struct OAuthController (Arc<Mutex<OAuthInternal>>); +pub struct OAuthController (Arc<Mutex<OAuthInternal>>, RuntimeHandle); type ServerDomain = String; type AccountIdentifier = String; @@ -50,11 +51,11 @@ pub struct AddServerResult { } impl OAuthController { - pub fn new() -> Self { + pub fn new(runtime_handle: RuntimeHandle) -> Self { Self(Arc::new(Mutex::new(OAuthInternal { servers: HashMap::new(), open_callbacks: HashMap::new(), - }))) + })), runtime_handle) } pub async fn add_server(&self, instance_domain: &str) -> Result<AddServerResult, String> { @@ -110,7 +111,7 @@ impl OAuthController { } pub fn resolve_code(&self, state: StateCode, auth_code: String) { - let runtime = tokio::runtime::Handle::current(); + let runtime = self.1.clone(); let inner_self = self.0.clone(); let state = state.clone(); |