Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix(permissions): re-validate mic and system audio permissions against OS on mount

Gabriel Stein48b9ef40f770
diff --git a/preload.js b/preload.js
index e60562040..ea7e49c4e 100644
--- a/preload.js
+++ b/preload.js
@@ -361,6 +361,7 @@ contextBridge.exposeInMainWorld("electronAPI", {
// System settings helpers for microphone/audio permissions
requestMicrophoneAccess: () => ipcRenderer.invoke("request-microphone-access"),
+ checkMicrophoneAccess: () => ipcRenderer.invoke("check-microphone-access"),
checkSystemAudioAccess: () => ipcRenderer.invoke("check-system-audio-access"),
requestSystemAudioAccess: () => ipcRenderer.invoke("request-system-audio-access"),
openMicrophoneSettings: () => ipcRenderer.invoke("open-microphone-settings"),
diff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.js
index bd2a529a2..70594962a 100644
--- a/src/helpers/ipcHandlers.js
+++ b/src/helpers/ipcHandlers.js
@@ -2051,13 +2051,23 @@ class IPCHandlers {
return { granted };
});
+ ipcMain.handle("check-microphone-access", () => {
+ if (process.platform !== "darwin") {
+ return { granted: true, status: "granted" };
+ }
+ const { systemPreferences } = require("electron");
+ const status = systemPreferences.getMediaAccessStatus("microphone");
+ return { granted: status === "granted", status };
+ });
+
ipcMain.handle("check-system-audio-access", () => {
if (process.platform !== "darwin") {
return { granted: true, status: "granted", mode: "unsupported" };
}
if (this.audioTapManager?.isSupported()) {
- const status = this.audioTapManager.getPermissionStatus();
+ const { systemPreferences } = require("electron");
+ const status = systemPreferences.getMediaAccessStatus("screen");
return { granted: status === "granted", status, mode: "native" };
}
@@ -2073,13 +2083,17 @@ class IPCHandlers {
return { granted: false, status: "unsupported", mode: "unsupported" };
}
- try {
- const result = await this.audioTapManager.requestAccess();
- return { ...result, mode: "native" };
- } catch (error) {
- debugLogger.error("System audio permission request failed", { error: error.message });
- return { granted: false, status: "unknown", mode: "native", error: error.message };
+ const { systemPreferences } = require("electron");
+ const status = systemPreferences.getMediaAccessStatus("screen");
+ if (status === "granted") {
+ return { granted: true, status: "granted", mode: "native" };
}
+
+ // Permission not yet granted — open System Settings so the user can toggle it manually.
+ // Unlike microphone, macOS does not show a system prompt for screen/audio recording;
+ // the user must enable it in System Settings.
+ await openSystemSettings("systemAudio");
+ return { granted: false, status, mode: "native" };
});
// Auth: clear all session cookies for sign-out.
diff --git a/src/hooks/usePermissions.ts b/src/hooks/usePermissions.ts
index 93d0c7d33..63dc86e1d 100644
--- a/src/hooks/usePermissions.ts
+++ b/src/hooks/usePermissions.ts
@@ -258,6 +258,15 @@ export const usePermissions = (
checkPasteToolsAvailability();
}, [checkPasteToolsAvailability]);
+ // On macOS, re-validate microphone permission on mount to override stale
+ // localStorage values (e.g. after TCC reset or app update).
+ useEffect(() => {
+ if (getPlatform() !== "darwin") return;
+ window.electronAPI?.checkMicrophoneAccess?.().then((result) => {
+ if (result) setMicPermissionGranted(result.granted);
+ });
+ }, [setMicPermissionGranted]);
+
// On macOS, re-validate accessibility permission on mount to override stale
// localStorage values (e.g. after app update changes the code signature).
useEffect(() => {
diff --git a/src/types/electron.ts b/src/types/electron.ts
index b90a0f4c4..9fe576366 100644
--- a/src/types/electron.ts
+++ b/src/types/electron.ts
@@ -117,7 +117,7 @@ export interface AudioDiagnosticsResult {
export interface SystemAudioAccessResult {
granted: boolean;
- status: "granted" | "denied" | "unknown" | "unsupported";
+ status: "granted" | "denied" | "not-determined" | "restricted" | "unknown" | "unsupported";
mode: "native" | "unsupported";
error?: string;
}
@@ -739,6 +739,7 @@ declare global {
// System settings helpers
requestMicrophoneAccess?: () => Promise<{ granted: boolean }>;
+ checkMicrophoneAccess?: () => Promise<{ granted: boolean; status: string }>;
checkSystemAudioAccess?: () => Promise<SystemAudioAccessResult>;
requestSystemAudioAccess?: () => Promise<SystemAudioAccessResult>;
openMicrophoneSettings?: () => Promise<{ success: boolean; error?: string }>;