feat(electron): add allow list for recording apps (#11321)

This commit is contained in:
pengx17
2025-04-01 01:48:07 +00:00
parent eac8f32f4c
commit 0a37ca91fb
2 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
// the following apps are sorted by the name in alphabetical order
const appNameKeywords = new Set([
'arc',
'boardmix',
'brave',
'chrome',
'chromium',
'classin',
'dia',
'dingtalk',
'discord',
'edge',
'facetime',
'feishu',
'figma',
'firefox',
'lark',
'meet',
'messenger',
'opera',
'qq',
'safari',
'skype',
'slack',
'telegram',
'tim',
'vivaldi',
'webex',
'wechat',
'whatsapp',
'wire',
'zen',
'zoom',
]);
export function isAppNameAllowed(name: string) {
for (const keyword of appNameKeywords) {
if (name.toLowerCase().includes(keyword.toLowerCase())) {
return true;
}
}
return false;
}

View File

@@ -28,6 +28,7 @@ import {
import { globalStateStorage } from '../shared-storage/storage';
import { getMainWindow } from '../windows-manager';
import { popupManager } from '../windows-manager/popup';
import { isAppNameAllowed } from './allow-list';
import { recordingStateMachine } from './state-machine';
import type {
AppGroupInfo,
@@ -390,7 +391,8 @@ function getAllApps(): TappableAppInfo[] {
v !== null &&
!v.bundleIdentifier.startsWith('com.apple') &&
!v.bundleIdentifier.startsWith('pro.affine') &&
v.processId !== process.pid
v.processId !== process.pid &&
isAppNameAllowed(v.name)
);
return filteredApps;
}