Skip to content

Commit

Permalink
checks: Check for permissions not granted on macOS
Browse files Browse the repository at this point in the history
Check for any permissions that are not granted on macOS and list them
with a warning flag.
  • Loading branch information
prgmitchell committed Mar 15, 2024
1 parent fd1c141 commit 0c8ac55
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
25 changes: 25 additions & 0 deletions checks/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,28 @@ def checkRosettaTranslationStatus(lines):
if (len(search('Rosetta translation used: true', lines)) > 0):
return [LEVEL_WARNING, "Intel OBS on Apple Silicon Mac",
"You are running the Intel version of OBS on an Apple Silicon Mac. You may get improved performance using the Apple Silicon version of OBS."]


def checkMacPermissions(lines):
macPerms = search('[macOS] Permission for', lines)
deniedPermissions = []

for line in macPerms:
if 'denied' in line:
found = re.search(r'Permission for (.+) denied', line)
if found:
permissionName = found.group(1).title()
permissionDescription = {
"Audio Device Access": "<b>Microphone</b>: OBS requires this permission if you want to capture your microphone.",
"Video Device Access": "<b>Camera</b>: This permission is needed in order to capture content from a webcam or capture card.",
"Accessibility": "<b>Accessibility</b>: For keyboard shortcuts (hotkeys) to work while other apps are focused this permission is needed.",
"Screen Capture": "<b>Screen Recording</b>: OBS requires this permission to be able to capture your screen."
}.get(permissionName)

if permissionDescription:
deniedPermissions.append(permissionDescription)

if deniedPermissions:
deniedPermissionsString = "<br>\n<ul>\n<li>" + "</li>\n<li>".join(deniedPermissions) + "</li>\n</ul>"
return [LEVEL_WARNING, "Permissions Not Granted (" + str(len(deniedPermissions)) + ")",
"""The following permissions have not been granted:""" + deniedPermissionsString + "If you would like to grant permissions for the above, follow the instructions in the " + '<a href="https://obsproject.com/kb/macos-permissions-guide">macOS Permissions Guide</a>.']
3 changes: 2 additions & 1 deletion loganalyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ def doAnalysis(url=None, filename=None):
checkVantage(logLines),
checkPortableMode(logLines),
checkSafeMode(logLines),
checkSnapPackage(logLines)
checkSnapPackage(logLines),
checkMacPermissions(logLines)
])
messages.extend(checkVideoSettings(logLines))
m = parseScenes(logLines)
Expand Down

0 comments on commit 0c8ac55

Please sign in to comment.