Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix(web): detect real Tauri runtime on localhost (#7962)

Full Stack Engineer104c62ca58d4
diff --git a/web-app/src/lib/platform/utils.ts b/web-app/src/lib/platform/utils.ts
index ff083acf6..2ded34fdf 100644
--- a/web-app/src/lib/platform/utils.ts
+++ b/web-app/src/lib/platform/utils.ts
@@ -11,6 +11,22 @@ export const isPlatformTauri = (): boolean => {
if (IS_WEB_APP === true || (IS_WEB_APP as unknown as string) === 'true') {
return false
}
+
+ // In dev, web can be built with Tauri flags but still opened in a regular browser.
+ // Only treat as Tauri when a runtime bridge is actually present.
+ if (typeof window !== 'undefined') {
+ const w = window as Window & {
+ __TAURI__?: unknown
+ __TAURI_INTERNALS__?: unknown
+ }
+ const hasTauriBridge =
+ typeof w.__TAURI__ !== 'undefined' ||
+ typeof w.__TAURI_INTERNALS__ !== 'undefined'
+ if (!hasTauriBridge) {
+ return false
+ }
+ }
+
return true
}