From 179047b834ef179173b33e8de1f27110cc26df32 Mon Sep 17 00:00:00 2001 From: Etienne Lescot Date: Wed, 13 May 2026 16:10:05 +0200 Subject: [PATCH] fix: isolate macOS native capture by platform --- electron-builder.json5 | 9 ++++++++- electron/ipc/handlers.ts | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/electron-builder.json5 b/electron-builder.json5 index dc6687d..8ad4a80 100644 --- a/electron-builder.json5 +++ b/electron-builder.json5 @@ -46,6 +46,13 @@ ], "icon": "icons/icons/mac/icon.icns", "artifactName": "${productName}-Mac-${arch}-${version}-Installer.${ext}", + "extraResources": [ + { + "from": "electron/native/bin", + "to": "electron/native/bin", + "filter": ["darwin-*/*"] + } + ], "extendInfo": { "NSAudioCaptureUsageDescription": "OpenScreen needs audio capture permission to record system audio.", "NSMicrophoneUsageDescription": "OpenScreen needs microphone access to record voice audio.", @@ -73,7 +80,7 @@ { "from": "electron/native/bin", "to": "electron/native/bin", - "filter": ["**/*"] + "filter": ["win32-*/*"] } ] }, diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 1a5ba0b..b12a08a 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -1759,6 +1759,10 @@ export function registerIpcHandlers( }); ipcMain.handle("pause-native-mac-recording", async () => { + if (process.platform !== "darwin") { + return { success: false, error: "Native macOS capture requires macOS." }; + } + const proc = nativeMacCaptureProcess; if (!proc) { return { success: false, error: "Native macOS capture is not running." }; @@ -1781,6 +1785,10 @@ export function registerIpcHandlers( }); ipcMain.handle("resume-native-mac-recording", async () => { + if (process.platform !== "darwin") { + return { success: false, error: "Native macOS capture requires macOS." }; + } + const proc = nativeMacCaptureProcess; if (!proc) { return { success: false, error: "Native macOS capture is not running." }; @@ -1887,6 +1895,10 @@ export function registerIpcHandlers( }); ipcMain.handle("stop-native-mac-recording", async (_, discard?: boolean) => { + if (process.platform !== "darwin") { + return { success: false, error: "Native macOS capture requires macOS." }; + } + const proc = nativeMacCaptureProcess; const preferredPath = nativeMacCaptureTargetPath; const recordingId = nativeMacCaptureRecordingId ?? Date.now(); @@ -1971,6 +1983,10 @@ export function registerIpcHandlers( "attach-native-mac-webcam-recording", async (_, payload: AttachNativeMacWebcamRecordingInput) => { try { + if (process.platform !== "darwin") { + return { success: false, error: "Native macOS webcam attachment requires macOS." }; + } + const screenVideoPath = normalizeVideoSourcePath(payload.screenVideoPath); if (!screenVideoPath || !isPathWithinDir(screenVideoPath, RECORDINGS_DIR)) { return {