7309d78344
Checks for updates on startup (silent, badge on button if available) and on manual click. Downloads new portable .exe to temp dir, creates a batch script to swap the running executable after quit, then relaunches. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
// Expose protected methods that allow the renderer process to use
|
|
// the ipcRenderer without exposing the entire object
|
|
contextBridge.exposeInMainWorld('electronAPI', {
|
|
getDevices: (params) => ipcRenderer.invoke('api-get-devices', params),
|
|
getAuthInfo: (params) => ipcRenderer.invoke('api-get-auth-info', params),
|
|
|
|
// Camera proxy functionality
|
|
launchCookieCameraProxy: (params) => ipcRenderer.invoke('camera-proxy-cookie-launch', params),
|
|
stopCameraProxy: (processId) => ipcRenderer.invoke('camera-proxy-stop', { processId }),
|
|
|
|
// Extension cookie bridge (push from main process)
|
|
onExtensionCookie: (callback) => {
|
|
ipcRenderer.on('extension-cookie-received', (event, data) => {
|
|
try {
|
|
callback(data);
|
|
} catch (error) {
|
|
console.error('Extension cookie handler error:', error);
|
|
}
|
|
});
|
|
},
|
|
|
|
// Self-update functionality
|
|
checkForUpdates: () => ipcRenderer.invoke('check-for-updates'),
|
|
downloadAndInstallUpdate: (params) => ipcRenderer.invoke('download-and-install-update', params),
|
|
getCurrentVersion: () => ipcRenderer.invoke('get-current-version'),
|
|
onUpdateDownloadProgress: (callback) => {
|
|
ipcRenderer.on('update-download-progress', (event, data) => {
|
|
try {
|
|
callback(data);
|
|
} catch (error) {
|
|
console.error('Update download progress handler error:', error);
|
|
}
|
|
});
|
|
}
|
|
}); |