fix: improve desktop chat performance

This commit is contained in:
Simos Mikelatos
2026-06-24 20:49:24 +00:00
parent fe116a7138
commit 8ad18f8587
11 changed files with 153 additions and 28 deletions

View File

@@ -682,10 +682,18 @@ export class DesktopWindowManager {
}
configurePermissions() {
session.defaultSession.setPermissionRequestHandler((webContents, permission, callback) => {
const isAllowedPermission = (webContents, permission) => {
const sourceUrl = webContents.getURL();
const allowedPermissions = new Set(['clipboard-read', 'media']);
callback(isAllowedPermissionOrigin(sourceUrl, this.getCloudState().controlPlaneUrl) && allowedPermissions.has(permission));
const allowedPermissions = new Set(['clipboard-read', 'media', 'notifications']);
return isAllowedPermissionOrigin(sourceUrl, this.getCloudState().controlPlaneUrl) && allowedPermissions.has(permission);
};
session.defaultSession.setPermissionRequestHandler((webContents, permission, callback) => {
callback(isAllowedPermission(webContents, permission));
});
session.defaultSession.setPermissionCheckHandler((webContents, permission) => {
if (!webContents) return false;
return isAllowedPermission(webContents, permission);
});
}