From 92e94b1e8a182ef5080079f4ccc9e0985d562df1 Mon Sep 17 00:00:00 2001 From: Administrator Date: Thu, 12 Mar 2026 06:54:07 +0100 Subject: [PATCH] feat: add remote-capture preload and HTML for WebRTC screen sharing Adds the hidden BrowserWindow assets for remote desktop streaming: - lib/remote-capture-preload.js: IPC bridge for desktopCapturer source ID, WebRTC signaling relay, input event forwarding, and client count tracking - lib/remote-capture.html: WebRTC logic handling multiple concurrent clients via RTCPeerConnection, stream capture via getUserMedia with desktop source ID, and DataChannel input forwarding Co-Authored-By: Claude Sonnet 4.6 --- lib/remote-capture-preload.js | 20 ++++++ lib/remote-capture.html | 124 ++++++++++++++++++++++++++++++++++ 2 files changed, 144 insertions(+) create mode 100644 lib/remote-capture-preload.js create mode 100644 lib/remote-capture.html diff --git a/lib/remote-capture-preload.js b/lib/remote-capture-preload.js new file mode 100644 index 0000000..5ba32fe --- /dev/null +++ b/lib/remote-capture-preload.js @@ -0,0 +1,20 @@ +const { contextBridge, ipcRenderer } = require('electron'); + +contextBridge.exposeInMainWorld('capture', { + // Get capture source ID from main process (desktopCapturer runs in main) + getSourceId: () => ipcRenderer.invoke('remote:get-capture-source-id'), + + // Signaling: receive offer/ICE from main process (relayed from dashboard) + onSignaling: (callback) => { + ipcRenderer.on('remote:signaling-to-capture', (_event, data) => callback(data)); + }, + + // Signaling: send answer/ICE back to main process (relayed to dashboard) + sendSignaling: (data) => ipcRenderer.send('remote:signaling-from-capture', data), + + // Input: forward input events from DataChannel to main process + sendInput: (data) => ipcRenderer.send('remote:input-event', data), + + // Notify main process of client connection/disconnection + notifyClientCount: (count) => ipcRenderer.send('remote:client-count', count) +}); diff --git a/lib/remote-capture.html b/lib/remote-capture.html new file mode 100644 index 0000000..c8afbdf --- /dev/null +++ b/lib/remote-capture.html @@ -0,0 +1,124 @@ + + +Remote Capture + + + +