mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-08 10:47:48 +08:00
- /api/log-save accepted only drawio, png and svg, so saving as Editable SVG (xmlsvg) got a 400 and was never recorded in Langfuse - The default download name and the template export name used the UTC date, which is the previous day on mornings in East Asia - Remove the Electron openFile/saveFile IPC handlers, their preload bindings and types; nothing in the app calls them
31 lines
968 B
TypeScript
31 lines
968 B
TypeScript
import { contextBridge, ipcRenderer } from "electron"
|
|
|
|
/**
|
|
* Expose safe APIs to the renderer process
|
|
*/
|
|
contextBridge.exposeInMainWorld("electronAPI", {
|
|
// Platform information
|
|
platform: process.platform,
|
|
|
|
// Check if running in Electron
|
|
isElectron: true,
|
|
|
|
// Application version
|
|
getVersion: () => ipcRenderer.invoke("get-version"),
|
|
|
|
// Window controls (optional, for custom title bar)
|
|
minimize: () => ipcRenderer.send("window-minimize"),
|
|
maximize: () => ipcRenderer.send("window-maximize"),
|
|
close: () => ipcRenderer.send("window-close"),
|
|
|
|
// Proxy settings
|
|
getProxy: () => ipcRenderer.invoke("get-proxy"),
|
|
setProxy: (config: { httpProxy?: string; httpsProxy?: string }) =>
|
|
ipcRenderer.invoke("set-proxy", config),
|
|
|
|
// User locale settings
|
|
getUserLocale: () => ipcRenderer.invoke("get-user-locale"),
|
|
setUserLocale: (locale: string) =>
|
|
ipcRenderer.invoke("set-user-locale", locale),
|
|
})
|