Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

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

pengx170a37ca91fbb7
diff --git a/packages/frontend/apps/electron/src/main/recording/allow-list.ts b/packages/frontend/apps/electron/src/main/recording/allow-list.ts
new file mode 100644
index 0000000000..8d8778f4ca
--- /dev/null
+++ b/packages/frontend/apps/electron/src/main/recording/allow-list.ts
@@ -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;
+}
diff --git a/packages/frontend/apps/electron/src/main/recording/feature.ts b/packages/frontend/apps/electron/src/main/recording/feature.ts
index 810c502c1a..fe06b4b49e 100644
--- a/packages/frontend/apps/electron/src/main/recording/feature.ts
+++ b/packages/frontend/apps/electron/src/main/recording/feature.ts
@@ -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;
}