Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.
Rust downloadmanagerguihacktoberfesthomebrewlightweightlinuxlinux-distributionlocal-firstmacosmacos-packagemedia-toolboxopen-sourcerustsveltetauritrendingtrending-repositorieswindowswindows-desktopytdlp
feat: add platform-specific handling for OAuth authentication
Tonho739f635b1c6d
diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rsindex f4be35e7..93d9e9d0 100644--- a/src-tauri/src/core/auth.rs+++ b/src-tauri/src/core/auth.rs@@ -363,7 +363,10 @@ impl PlatformAuth for SpotifyAuth {urlencoding::encode(&challenge),);+ #[cfg(desktop)]open::that(&auth_url).map_err(|e| anyhow!("Failed to open browser: {}", e))?;+ #[cfg(not(desktop))]+ return Err(anyhow!("OAuth browser flow is not available on this platform"));let code = Self::wait_for_callback(listener).await?;let session = self.exchange_code(&code, &verifier, &redirect_uri).await?;@@ -440,6 +443,7 @@ impl PlatformAuth for BrowserCookieAuth {false}+ #[cfg(desktop)]async fn authenticate(&self,_params: HashMap<String, String>,@@ -515,6 +519,14 @@ impl PlatformAuth for BrowserCookieAuth {Ok(session)}+ #[cfg(not(desktop))]+ async fn authenticate(+ &self,+ _params: HashMap<String, String>,+ ) -> anyhow::Result<AuthSession> {+ Err(anyhow!("Browser-based authentication is not available on this platform"))+ }+async fn logout(&self) -> anyhow::Result<()> {let mut guard = self.session.lock().await;*guard = None;