Function configurePermissionHandlers

  • Configures permission handlers to deny all external permission requests. Prevents the app from requesting camera, microphone, geolocation, etc.

    Returns void

    Called during app initialization before windows are created.

    function configurePermissionHandlers() {
    return withGroup(`[Main] Configure Permission Handlers`, () => {
    console.info("[Main] 🔒 Setting up permission handlers...");

    // Deny all permission requests (camera, microphone, geolocation, etc.)
    session.defaultSession.setPermissionRequestHandler(
    (webContents, permission, callback) => {
    console.warn(
    `[Main] ⚠️ Permission request denied: ${permission} from ${webContents.getURL()}`,
    );
    callback(false); // Deny all permissions
    },
    );

    // Additional permission check handler for finer control
    session.defaultSession.setPermissionCheckHandler(() => false);

    console.info("[Main] ✅ Permission handlers configured");
    });
    }