diff options
| -rw-r--r-- | src-tauri/src/core/auth.rs | 2 | ||||
| -rw-r--r-- | ui/src/App.svelte | 19 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src-tauri/src/core/auth.rs b/src-tauri/src/core/auth.rs index 255a7db..ede8f5a 100644 --- a/src-tauri/src/core/auth.rs +++ b/src-tauri/src/core/auth.rs @@ -82,7 +82,7 @@ pub fn generate_offline_uuid(username: &str) -> String { // --- Microsoft Auth Logic --- // Constants -const CLIENT_ID: &str = "499546d9-bbfe-4b9b-a086-eb3d75afb78f"; +const CLIENT_ID: &str = "fe165602-5410-4441-92f7-326e10a7cb82"; const SCOPE: &str = "XboxLive.Signin offline_access openid profile email"; #[derive(Debug, Serialize, Deserialize)] diff --git a/ui/src/App.svelte b/ui/src/App.svelte index 8ec0da1..c3848b2 100644 --- a/ui/src/App.svelte +++ b/ui/src/App.svelte @@ -1,5 +1,6 @@ <script lang="ts"> import { invoke } from "@tauri-apps/api/core"; + import { open } from "@tauri-apps/plugin-shell"; import { onMount } from "svelte"; import DownloadMonitor from "./lib/DownloadMonitor.svelte"; import GameConsole from "./lib/GameConsole.svelte"; @@ -143,6 +144,17 @@ msLoginLoading = true; try { deviceCodeData = await invoke("start_microsoft_login") as DeviceCodeResponse; + + // UX Improvements: Auto Copy & Auto Open + if (deviceCodeData) { + try { + await navigator.clipboard.writeText(deviceCodeData.user_code); + // alert("Code copied to clipboard: " + deviceCodeData.user_code); + } catch (e) { console.error("Clipboard failed", e); } + + openLink(deviceCodeData.verification_uri); + } + } catch(e) { alert("Failed to start Microsoft login: " + e); loginMode = 'select'; // Go back @@ -159,17 +171,14 @@ isLoginModalOpen = false; } catch(e) { alert("Login failed: " + e + "\n\nMake sure you authorized the app in your browser."); + // If it fails, users often want to retry checking without restarting the flow } finally { msLoginLoading = false; } } function openLink(url: string) { - // Use tauri open if possible, or window.open - invoke('start_microsoft_login').catch(() => window.open(url, '_blank')); - // Wait, we invoke 'start_microsoft_login' above already. - // Just use window.open for the verification URI - window.open(url, '_blank'); + open(url); } async function startGame() { |