Skip to content

armgit / Handy

Public Imported from GitHub
0

A free, open source, and extensible speech-to-text application that works completely offline.

fix: prioritize NonPackaged key in Windows mic permission check (#1284) (#1308)

Christoph Noetel3f24f4b26a16
diff --git a/src-tauri/src/commands/audio.rs b/src-tauri/src/commands/audio.rs
index e303627b..97cb52f1 100644
--- a/src-tauri/src/commands/audio.rs
+++ b/src-tauri/src/commands/audio.rs
@@ -87,14 +87,19 @@ fn get_windows_microphone_permission_status_impl() -> WindowsMicrophonePermissio
let app_access = read_registry_permission_access(HKEY_CURRENT_USER, MICROPHONE_PATH);
let desktop_app_access = read_registry_permission_access(HKEY_CURRENT_USER, DESKTOP_APPS_PATH);
- let overall_access = if [device_access, app_access, desktop_app_access]
- .into_iter()
- .any(|access| access == PermissionAccess::Denied)
- {
+ // Handy is a desktop app, so the NonPackaged key (desktop_app_access) is
+ // the relevant permission scope. The UWP master key (app_access) can be
+ // "deny" on systems with debloaters (e.g. O&O ShutUp10) without actually
+ // blocking desktop app microphone access.
+ let overall_access = if device_access == PermissionAccess::Denied {
+ PermissionAccess::Denied
+ } else if desktop_app_access == PermissionAccess::Denied {
+ PermissionAccess::Denied
+ } else if desktop_app_access == PermissionAccess::Allowed {
+ PermissionAccess::Allowed
+ } else if app_access == PermissionAccess::Denied {
PermissionAccess::Denied
- } else if [device_access, app_access, desktop_app_access]
- .into_iter()
- .all(|access| access == PermissionAccess::Allowed)
+ } else if device_access == PermissionAccess::Allowed && app_access == PermissionAccess::Allowed
{
PermissionAccess::Allowed
} else {