fix cam btn
This commit is contained in:
parent
fc736da1d3
commit
55a4b89b24
2 changed files with 13 additions and 5 deletions
7
main.js
7
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')
|
||||
|
@ -30,6 +30,11 @@ ipcMain.on('windowmaker', (event, arg) => {
|
|||
createWindow();
|
||||
})
|
||||
|
||||
ipcMain.on('allowCam', (event, arg) => {
|
||||
mic = systemPreferences.askForMediaAccess('microphone');
|
||||
cam = systemPreferences.askForMediaAccess('camera');
|
||||
})
|
||||
|
||||
const proxy = createProxy(http.createServer());
|
||||
proxy.listen(3129)
|
||||
//Function to enable AD Blocking...
|
||||
|
|
11
preload.js
11
preload.js
|
@ -6,7 +6,7 @@
|
|||
* https://www.electronjs.org/docs/latest/tutorial/sandbox
|
||||
*/
|
||||
|
||||
const { contextBridge, ipcRenderer, systemPreferences } = require('electron');
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('electron', {
|
||||
enforceDomainRestrictions: (url) => ipcRenderer.sendSync('check-domain', url),
|
||||
|
@ -24,7 +24,11 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
}
|
||||
|
||||
ipcRenderer.on('windowmaker', (event, arg) => {
|
||||
console.log(arg) // prints "pong"
|
||||
console.log(arg)
|
||||
})
|
||||
|
||||
ipcRenderer.on('allowCam', (event, arg) => {
|
||||
console.log(arg)
|
||||
})
|
||||
//button and its event listener
|
||||
const makeWindowButton = document.getElementById('nwBtn');
|
||||
|
@ -34,7 +38,6 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
const camButton = document.getElementById('camBtn');
|
||||
camButton.addEventListener('click', () => {
|
||||
mic = systemPreferences.askForMediaAccess('microphone');
|
||||
cam = systemPreferences.askForMediaAccess('camera');
|
||||
ipcRenderer.send('allowCam', 'ping')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue