gaming-hub/electron/preload.js
Daniel d909909591 Auto-Updater: Doppelstart verhindern + Download-Status sichtbar
- State-Tracking im Main-Prozess (idle/checking/downloading/ready)
- Manueller Check gibt aktuellen Status zurück statt Squirrel-Doppelstart
- Auto-Check nur wenn idle (kein Konflikt mit laufendem Download)
- Frontend synchronisiert Status beim Mount und Modal-Öffnen
- getUpdateStatus IPC für synchrone Status-Abfrage

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:27:35 +01:00

16 lines
952 B
JavaScript

const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
isElectron: true,
// Version comes from main process (reads package.json via app.getVersion())
version: ipcRenderer.sendSync('get-app-version'),
onUpdateAvailable: (callback) => ipcRenderer.on('update-available', callback),
onUpdateReady: (callback) => ipcRenderer.on('update-ready', callback),
onUpdateNotAvailable: (callback) => ipcRenderer.on('update-not-available', callback),
onUpdateError: (callback) => ipcRenderer.on('update-error', (_e, msg) => callback(msg)),
checkForUpdates: () => ipcRenderer.send('check-for-updates'),
getUpdateStatus: () => ipcRenderer.sendSync('get-update-status'),
installUpdate: () => ipcRenderer.send('install-update'),
setStreaming: (active) => ipcRenderer.send('streaming-status', active),
showNotification: (title, body) => ipcRenderer.send('show-notification', title, body),
});