fix: detect Tauri v2 runtime correctly
This commit is contained in:
+14
@@ -7,13 +7,27 @@ yarn-error.log*
|
|||||||
pnpm-debug.log*
|
pnpm-debug.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Dependencies
|
||||||
node_modules
|
node_modules
|
||||||
|
site/node_modules
|
||||||
|
|
||||||
|
# Build output
|
||||||
dist
|
dist
|
||||||
dist-ssr
|
dist-ssr
|
||||||
|
site/dist
|
||||||
|
site/.astro
|
||||||
|
out
|
||||||
|
.output
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
# Rust/Tauri
|
# Rust/Tauri
|
||||||
src-tauri/target/
|
src-tauri/target/
|
||||||
|
src-tauri/.cargo/config.local.json
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
|||||||
+8
-2
@@ -32,9 +32,15 @@ import type {
|
|||||||
ConsoleProxyInfo,
|
ConsoleProxyInfo,
|
||||||
} from '@/types/proxmox'
|
} 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 = () => {
|
export const isTauri = () => {
|
||||||
return '__TAURI__' in window
|
return '__TAURI_INTERNALS__' in window
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mock responses for development without Tauri
|
// Mock responses for development without Tauri
|
||||||
|
|||||||
Reference in New Issue
Block a user