From 48d9d886c078a04ead31a9d10744a085307444fa Mon Sep 17 00:00:00 2001
From: HsiangNianian
Date: Tue, 13 Jan 2026 20:19:34 +0800
Subject: feat: implement Microsoft account token refresh and storage
management; add Java detection functionality
---
ui/src/App.svelte | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
(limited to 'ui')
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"
/>
+
+
+ {#if javaInstallations.length > 0}
+ Detected Java Installations:
- 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.
-- cgit v1.2.3-70-g09d2