New app:selfupdate IPC (main process): npm run build + cargo build --release with the augmented PATH, then kill the backend child, reset the spawn flag so the next request starts the NEW binary, and reloadIgnoringCache every window. The Electron shell keeps running — no manual restart. Settings install now triggers it automatically when restart_required. Honest limits: a change to the Electron main process itself still needs one manual relaunch, and packaged builds report that bundle replacement is the update path.
9 lines
449 B
TypeScript
9 lines
449 B
TypeScript
import { contextBridge, ipcRenderer } from 'electron';
|
|
|
|
contextBridge.exposeInMainWorld('backend', {
|
|
request: (method: string, params?: Record<string, unknown>): Promise<unknown> =>
|
|
ipcRenderer.invoke('backend:request', { method, params }),
|
|
copyText: (text: string): Promise<void> => ipcRenderer.invoke('clipboard:write', text),
|
|
selfUpdate: (): Promise<{ reloaded: boolean; note: string }> =>
|
|
ipcRenderer.invoke('app:selfupdate'),
|
|
});
|