(path, operation = 'operation')
| 449 | let electronUiPort = null; |
| 450 | let wss = null; // WebSocket server |
| 451 | let wsClients = null; // WebSocket clients Set |
| 452 | |
| 453 | // Store pending context menu actions for server mode (browser access) |
| 454 | const pendingContextMenus = new Map(); |
| 455 | let contextMenuRequestIdCounter = 0; |
| 456 | |
| 457 | // Handler registry for WebSocket IPC calls in server mode |
| 458 | // This allows us to directly invoke handlers without going through the renderer |
| 459 | const ipcHandlerRegistry = new Map(); |
| 460 | |
| 461 | // Auto-register every ipcMain.handle into the WebSocket registry. |
| 462 | // Without this, Docker/server-mode falls back to executeJavaScript on the hidden |
| 463 | // window for unregistered channels (e.g. getThumbnail) — which hangs/times out. |
| 464 | const _ipcMainHandle = ipcMain.handle.bind(ipcMain); |
| 465 | ipcMain.handle = (channel, handler) => { |
| 466 | ipcHandlerRegistry.set(channel, handler); |
| 467 | return _ipcMainHandle(channel, handler); |
| 468 | }; |
| 469 | |
| 470 | // Helper function to register IPC handlers and add them to the registry |
| 471 | function registerIpcHandler(channel, handler) { |
| 472 | ipcMain.handle(channel, handler); |
no test coverage detected