diff options
| author | 2026-01-13 20:19:34 +0800 | |
|---|---|---|
| committer | 2026-01-13 20:19:34 +0800 | |
| commit | 48d9d886c078a04ead31a9d10744a085307444fa (patch) | |
| tree | 9d94019ec67f80a01c9587d330f287c2d05702f0 /ui/src/App.svelte | |
| parent | 5e09625902ad0fa1b1eb555a255a3720193dbb2c (diff) | |
| download | DropOut-48d9d886c078a04ead31a9d10744a085307444fa.tar.gz DropOut-48d9d886c078a04ead31a9d10744a085307444fa.zip | |
feat: implement Microsoft account token refresh and storage management; add Java detection functionality
Diffstat (limited to 'ui/src/App.svelte')
| -rw-r--r-- | ui/src/App.svelte | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/ui/src/App.svelte b/ui/src/App.svelte index 9e9d220..7bc056a 100644 --- a/ui/src/App.svelte +++ b/ui/src/App.svelte @@ -38,6 +38,8 @@ user_code: string; device_code: string; verification_uri: string; + expires_in: number; + interval: number; message?: string; } @@ -49,6 +51,12 @@ height: number; } + interface JavaInstallation { + path: string; + version: string; + is_64bit: boolean; + } + let versions: Version[] = []; let selectedVersion = ""; let currentAccount: Account | null = null; @@ -59,6 +67,8 @@ width: 854, height: 480, }; + let javaInstallations: JavaInstallation[] = []; + let isDetectingJava = false; // Login UI State let isLoginModalOpen = false; @@ -113,6 +123,27 @@ } } + async function detectJava() { + isDetectingJava = true; + try { + javaInstallations = await invoke("detect_java"); + if (javaInstallations.length === 0) { + status = "No Java installations found"; + } else { + status = `Found ${javaInstallations.length} Java installation(s)`; + } + } catch (e) { + console.error("Failed to detect Java:", e); + status = "Error detecting Java: " + e; + } finally { + isDetectingJava = false; + } + } + + function selectJava(path: string) { + settings.java_path = path; + } + // --- Auth Functions --- function openLoginModal() { @@ -422,9 +453,40 @@ class="bg-zinc-950 text-white flex-1 p-3 rounded border border-zinc-700 focus:border-indigo-500 outline-none font-mono text-sm" placeholder="e.g. java, /usr/bin/java" /> + <button + onclick={detectJava} + disabled={isDetectingJava} + class="bg-zinc-700 hover:bg-zinc-600 disabled:opacity-50 text-white px-4 py-2 rounded transition-colors whitespace-nowrap" + > + {isDetectingJava ? "Detecting..." : "Auto Detect"} + </button> </div> + + {#if javaInstallations.length > 0} + <div class="mt-4 space-y-2"> + <p class="text-xs text-zinc-400 uppercase font-bold">Detected Java Installations:</p> + {#each javaInstallations as java} + <button + onclick={() => selectJava(java.path)} + class="w-full text-left p-3 bg-zinc-950 rounded border transition-colors {settings.java_path === java.path ? 'border-indigo-500 bg-indigo-950/30' : 'border-zinc-700 hover:border-zinc-500'}" + > + <div class="flex justify-between items-center"> + <div> + <span class="text-white font-mono text-sm">{java.version}</span> + <span class="text-zinc-500 text-xs ml-2">{java.is_64bit ? "64-bit" : "32-bit"}</span> + </div> + {#if settings.java_path === java.path} + <span class="text-indigo-400 text-xs">Selected</span> + {/if} + </div> + <div class="text-zinc-500 text-xs font-mono truncate mt-1">{java.path}</div> + </button> + {/each} + </div> + {/if} + <p class="text-xs text-zinc-500 mt-2"> - The command or path to the Java Runtime Environment. + The command or path to the Java Runtime Environment. Click "Auto Detect" to find installed Java versions. </p> </div> |