From 37fd20422363cca3a41f1f7f5ed51ded4c789ca7 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 11 Aug 2026 20:29:37 +0000 Subject: [PATCH] fix: detect Tauri v2 runtime correctly --- .gitignore | 14 ++++++++++++++ src/lib/tauri.ts | 10 ++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index cd3ae9c..432ebf9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,13 +7,27 @@ yarn-error.log* pnpm-debug.log* lerna-debug.log* +# Dependencies node_modules +site/node_modules + +# Build output dist dist-ssr +site/dist +site/.astro +out +.output + +# Environment variables +.env +.env.* +!.env.example *.local # Rust/Tauri src-tauri/target/ +src-tauri/.cargo/config.local.json # Editor directories and files .vscode/* diff --git a/src/lib/tauri.ts b/src/lib/tauri.ts index 3cedb7c..903509f 100644 --- a/src/lib/tauri.ts +++ b/src/lib/tauri.ts @@ -32,9 +32,15 @@ import type { ConsoleProxyInfo, } from '@/types/proxmox' -// Check if we're running in Tauri +// Check if we're running inside a Tauri webview. +// +// Tauri v2 injects the IPC bridge as `window.__TAURI_INTERNALS__` on every +// page it hosts (dev and prod). The old `window.__TAURI__` global was the +// Tauri v1 convention and no longer exists by default in v2 — checking for it +// made `isTauri()` return false inside the real app, silently falling back to +// the browser mock data. This mirrors `isTauri()` from `@tauri-apps/api/core`. export const isTauri = () => { - return '__TAURI__' in window + return '__TAURI_INTERNALS__' in window } // Mock responses for development without Tauri