// Preload script for the VNCmail+ desktop shell. Runs in an isolated // context with access to Node APIs, and exposes a minimal, explicit surface // to the renderer via contextBridge - the renderer never gets direct Node or // Electron access (contextIsolation + nodeIntegration: false, see main.ts). import { contextBridge, ipcRenderer } from "electron"; export interface ShowNotificationOptions { body?: string; tag?: string; } export interface ShowNotificationResult { shown: boolean; } contextBridge.exposeInMainWorld("vnc", { isElectron: true, // Routes to Electron's own Notification API in main.ts (ipcMain.handle // "vnc:show-notification"). This is the desktop shell's native // notification path - it does not replace lib/web-push.ts's Web Push // (VAPID) path, which is what the browser/PWA deployment still uses. showNotification: ( title: string, options?: ShowNotificationOptions, ): Promise => ipcRenderer.invoke("vnc:show-notification", title, options), });