gaming-hub/electron/preload.js
Daniel 9fd0992fc4 Fix Electron update: Squirrel feed URL, version display, error details
- Fix: Squirrel.Windows feed URL /updates → /downloads (Squirrel appends /RELEASES)
- Show Desktop App + Server version in update modal
- Display actual error message in failed state
- Dynamic Electron version via app.getVersion() instead of hardcoded
- Sync electron/package.json version with VERSION file (1.5.8)
- Add "Später" button on update-ready, timeout error message
- Style: version info, error detail box, secondary button

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 19:23:30 +01:00

14 lines
795 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'),
installUpdate: () => ipcRenderer.send('install-update'),
setStreaming: (active) => ipcRenderer.send('streaming-status', active),
});