diff --git a/main.js b/main.js index 01939c3..d4e4d32 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const {app, BrowserWindow, session, ipcMain} = require('electron') +const {app, BrowserWindow, session, ipcMain, systemPreferences} = require('electron') const path = require('path') const fetch = require("cross-fetch") const { ElectronChromeExtensions } = require('electron-chrome-extensions') @@ -9,6 +9,8 @@ const fs = require('fs'); const { createProxy } = require('proxy'); const buildChromeContextMenu = require('electron-chrome-context-menu').default var extensions +var mic +var cam app.on('web-contents-created', (event, webContents) => { webContents.on('context-menu', (e, params) => { const menu = buildChromeContextMenu({ @@ -224,10 +226,11 @@ app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit() } }) + // In this file you can include the rest of your app's specific main process // code. You can also put them in separate files and require them here. -// Set DNS +// Set DNS and enable mic/cam app.on('ready', () => { app.configureHostResolver({ mode: 'secure', @@ -236,4 +239,6 @@ app.on('ready', () => { 'https://cloudflare-dns.com/dns-query' ] }); + mic = systemPreferences.askForMediaAccess('microphone'); + cam = systemPreferences.askForMediaAccess('camera'); }); \ No newline at end of file