diff --git a/surfsense_web/components/assistant-ui/thread.tsx b/surfsense_web/components/assistant-ui/thread.tsx index 023b0f7bc..389b9f204 100644 --- a/surfsense_web/components/assistant-ui/thread.tsx +++ b/surfsense_web/components/assistant-ui/thread.tsx @@ -317,7 +317,7 @@ const Composer: FC = () => { // Clipboard content const [clipboardText, setClipboardText] = useState(); useEffect(() => { - const api = (window as { electronAPI?: { getClipboardContent?: () => Promise } }).electronAPI; + const api = window.electronAPI; if (!api?.getClipboardContent) return; api.getClipboardContent().then((text) => { if (text) setClipboardText(text); diff --git a/surfsense_web/types/window.d.ts b/surfsense_web/types/window.d.ts index 4d4abc9c1..487e2058f 100644 --- a/surfsense_web/types/window.d.ts +++ b/surfsense_web/types/window.d.ts @@ -1,7 +1,21 @@ import type { PostHog } from "posthog-js"; +interface ElectronAPI { + versions: { + electron: string; + node: string; + chrome: string; + platform: string; + }; + openExternal: (url: string) => void; + getAppVersion: () => Promise; + getClipboardContent: () => Promise; + onDeepLink: (callback: (url: string) => void) => () => void; +} + declare global { interface Window { posthog?: PostHog; + electronAPI?: ElectronAPI; } }