add mic/cam access

This commit is contained in:
The Ghost of FOSS' Past 2024-11-25 14:07:39 -06:00
parent 8d18437dfa
commit 7198b136a6

View file

@ -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');
});