Files
peji c3c3fc83e3 Add site-grouped device list in sidebar
Fetch device sites from /api/v1/deviceSites in parallel with devices,
then group cameras by site with collapsible headers. Search now also
matches site names. Falls back to flat list if sites API is unavailable.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:27:05 +00:00

38 lines
1.5 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),
getDeviceSites: (params) => ipcRenderer.invoke('api-get-device-sites', 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);
}
});
}
});