const { contextBridge, ipcRenderer } = require('electron'); contextBridge.exposeInMainWorld('api', { status: () => ipcRenderer.invoke('core:status'), pair: (code, name) => ipcRenderer.invoke('core:pair', code, name), challenges: () => ipcRenderer.invoke('core:challenges'), solve: (id, value) => ipcRenderer.invoke('core:solve', id, value), getConfig: () => ipcRenderer.invoke('core:get-config'), saveConfig: (cfg) => ipcRenderer.invoke('core:save-config', cfg), restart: () => ipcRenderer.invoke('core:restart'), openDataDir: () => ipcRenderer.invoke('app:open-data-dir'), openWeb: (url) => ipcRenderer.invoke('app:open-web', url), setAutoStart: (on) => ipcRenderer.invoke('app:set-autostart', on), getAutoStart: () => ipcRenderer.invoke('app:get-autostart'), quit: () => ipcRenderer.invoke('app:quit'), onCoreReady: (cb) => ipcRenderer.on('core-ready', cb), onCoreError: (cb) => ipcRenderer.on('core-error', cb), onCoreExit: (cb) => ipcRenderer.on('core-exit', cb), });