From d25a22bf223726fc5f69e79a9ed60770e96623b3 Mon Sep 17 00:00:00 2001 From: bangonicdd <157843588+bangonicdd2@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:09:31 +0900 Subject: [PATCH] fix: conditionally initializing getCurrentWebviewWindow --- src/ts/storage/globalApi.ts | 3 ++- src/ts/util.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ts/storage/globalApi.ts b/src/ts/storage/globalApi.ts index 11637cc4..9af06234 100644 --- a/src/ts/storage/globalApi.ts +++ b/src/ts/storage/globalApi.ts @@ -43,7 +43,6 @@ import { encodeCapKeySafe } from "./mobileStorage"; import { updateLorebooks } from "../characters"; import { initMobileGesture } from "../hotkey"; import { fetch as TauriHTTPFetch } from '@tauri-apps/plugin-http'; -const appWindow = getCurrentWebviewWindow() //@ts-ignore export const isTauri = !!window.__TAURI_INTERNALS__ @@ -53,6 +52,8 @@ export const forageStorage = new AutoStorage() export const googleBuild = false export const isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) +const appWindow = isTauri ? getCurrentWebviewWindow() : null + interface fetchLog{ body:string header:string diff --git a/src/ts/util.ts b/src/ts/util.ts index f0f4724f..e98eba82 100644 --- a/src/ts/util.ts +++ b/src/ts/util.ts @@ -8,7 +8,7 @@ import { basename } from "@tauri-apps/api/path" import { createBlankChar, getCharImage } from "./characters" import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'; import { isTauri } from "./storage/globalApi" -const appWindow = getCurrentWebviewWindow() +const appWindow = isTauri ? getCurrentWebviewWindow() : null export const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1