diff --git a/.editorconfig b/.editorconfig index 1aae5c3b..260e9d92 100644 --- a/.editorconfig +++ b/.editorconfig @@ -17,7 +17,7 @@ tab_width = 2 [*.json] tab_width = 2 -[*.html] +[{*.html,*.xml,*.plist}] tab_width = 2 [{*.markdown,*.md}] diff --git a/build/mac/entitlements.mac.plist b/build/mac/entitlements.mac.plist new file mode 100644 index 00000000..56f2fdb0 --- /dev/null +++ b/build/mac/entitlements.mac.plist @@ -0,0 +1,16 @@ + + + + + com.apple.security.device.audio-input + + com.apple.security.device.microphone + + com.apple.security.device.camera + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + + diff --git a/forge.config.js b/forge.config.js index 520bf7f1..2f5b7511 100644 --- a/forge.config.js +++ b/forge.config.js @@ -24,6 +24,7 @@ require('dotenv').config() module.exports = { packagerConfig: { icon: './img/icons/icon', + extendInfo: './build/mac/entitlements.mac.plist', }, rebuildConfig: {}, makers: [ diff --git a/src/app/permissionHandlers.js b/src/app/permissionHandlers.js new file mode 100644 index 00000000..139cc7e3 --- /dev/null +++ b/src/app/permissionHandlers.js @@ -0,0 +1,32 @@ +/* + * @copyright Copyright (c) 2023 Grigorii Shartsev + * + * @author Grigorii Shartsev + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * @implements {Parameters[0]} + */ +function permissionHandler(webContents, permission, callback, details) { + // TODO: store permissions in a local user config + callback(true) +} + +module.exports = { + permissionHandler, +} diff --git a/src/main.js b/src/main.js index 636500e0..19235038 100644 --- a/src/main.js +++ b/src/main.js @@ -25,6 +25,7 @@ const { dialog, BrowserWindow, ipcMain, + session, } = require('electron') const { default: installExtension, @@ -41,6 +42,7 @@ const { const { getOs, isLinux } = require('./shared/os.utils.js') const { setupMenu } = require('./app/app.menu.js') const { createHelpWindow } = require('./help/help.window.js') +const { permissionHandler } = require('./app/permissionHandlers.js') /** * Separate production and development instances, including application and user data @@ -175,6 +177,7 @@ app.whenReady().then(async () => { mainWindow.close() mainWindow = createTalkWindow() createMainWindow = createTalkWindow + session.defaultSession.setPermissionRequestHandler(permissionHandler) }) ipcMain.handle('authentication:logout', async (event) => { @@ -186,6 +189,7 @@ app.whenReady().then(async () => { mainWindow.once('ready-to-show', () => { mainWindow.show() }) + session.defaultSession.setPermissionRequestHandler(null) } })