From e55fc74ba95bf674790849ebdea6d3c282f08e6c Mon Sep 17 00:00:00 2001 From: squarepots <46488165+squarepots@users.noreply.github.com> Date: Fri, 18 Sep 2026 19:34:41 +0800 Subject: [PATCH 1/3] fix(web): avoid Tauri window access in browser mode --- src/App.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 6b11a1e2..f8687ec3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -65,7 +65,7 @@ type AutoWarmupLedger = Record< lastAutoWindowKind?: AutoWarmupWindowKind; } >; -const appWindow = getCurrentWindow(); +const getAppWindow = () => getCurrentWindow(); const isMacOs = typeof navigator !== "undefined" && /(Mac|iPhone|iPod|iPad)/i.test(navigator.userAgent); @@ -388,14 +388,14 @@ function App() { const handleTitlebarDrag = useCallback( (event: React.MouseEvent) => { if (!isTauriRuntime() || event.button !== 0) return; - void appWindow.startDragging(); + void getAppWindow().startDragging(); }, [] ); const handleTitlebarDoubleClick = useCallback(() => { if (!isTauriRuntime()) return; - void appWindow.toggleMaximize(); + void getAppWindow().toggleMaximize(); }, []); const toggleMask = (accountId: string) => { @@ -526,7 +526,7 @@ function App() { const syncMaximizedState = async () => { try { - setIsWindowMaximized(await appWindow.isMaximized()); + setIsWindowMaximized(await getAppWindow().isMaximized()); } catch (err) { console.error("Failed to read window state:", err); } @@ -1354,11 +1354,11 @@ function App() { onDoubleClick={handleTitlebarDoubleClick} className={`h-full flex-1 select-none cursor-default ${isMacOs ? "ml-18 mr-2" : "mr-3"}`} /> - {!isMacOs && ( + {isTauriRuntime() && !isMacOs && (