File size: 635 Bytes
af1bee9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
'use strict';
// Minimal, validated bridge. The renderer gets NO Node.js access (contextIsolation + sandbox + nodeIntegration off).
const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('fptDesktop', {
  version: '1.0.0',
  notify: (title, body) => ipcRenderer.send('fpt:notify', { title: String(title), body: String(body) }),
  openSettings: () => ipcRenderer.send('fpt:open-settings'),
  // Only honoured by the main process for the local settings page:
  getConfig: () => ipcRenderer.invoke('fpt:get-config'),
  saveConfig: (cfg) => ipcRenderer.invoke('fpt:save-config', cfg),
});