diff --git a/main.js b/main.js index 562f8f7..37c5fd5 100644 --- a/main.js +++ b/main.js @@ -10,11 +10,7 @@ let mainWindow let logWindow let devMode = false -let selfMute = false -let isConnected = false let webViewSession = null -let configObj -let micPermissionGranted = false // Set Dev mode if (process.argv.length === 3) { @@ -180,9 +176,8 @@ app.on('ready', () => { webViewSession.setPermissionRequestHandler((webContents, permission, callback) => { // deny all permissions const url = webContents.getURL() if (url.startsWith('https://discord.com/')) { - if (permission === 'media' && isConnected === true) { // if user is connected to Discord voice then enable microphone - console.log("User connected to Discord VOIP server. Granted permission for microphone") - micPermissionGranted = true + if (permission === 'media') { // if user is connected to Discord voice then enable microphone + console.log("Granted permission for 'media'"); return callback(true) } } @@ -193,29 +188,6 @@ app.on('ready', () => { ipcMain.on('asynchronous-message', (event, _data) => { let msg = _data.msg - if (msg === 'connected') { - console.log("User connected to Discord VOIP server") - if (micPermissionGranted === false && selfMute === false){ - micPermissionGranted = true - } - isConnected = true - } - - if (msg === 'disconnected') { - console.log("User disconnected to Discord VOIP server") - isConnected = false - } - - if (msg === 'self-muted') { - console.log("User self-muted") - webViewSession.setPermissionRequestHandler(null) - selfMute = true - } - - if (msg === 'self-unmuted') { - console.log("User self-unmuted") - selfMute = false - } if (msg === 'DOMready') { console.log("Discord webview loaded") diff --git a/src/mainLoad.js b/src/mainLoad.js index b8fda56..9451fcd 100644 --- a/src/mainLoad.js +++ b/src/mainLoad.js @@ -41,22 +41,6 @@ window.addEventListener( ipcRenderer.send('asynchronous-message', {msg: 'disconnected'}) } - if (event.data.type === 'self-muted'){ - ipcRenderer.send('asynchronous-message', {msg:'self-muted'}) - } - - if (event.data.type === 'self-unmuted'){ - ipcRenderer.send('asynchronous-message', {msg: 'self-unmuted'}) - } - - if (event.data.type === 'confirmMicOpen'){ - ipcRenderer.send('asynchronous-message', {msg: 'confirmMicOpen'}) - } - - if (event.data.type === 'confirmMicClose'){ - ipcRenderer.send('asynchronous-message', {msg: 'confirmMicClose'}) - } - if (event.data.type === 'blockUpdate'){ ipcRenderer.send('asynchronous-message', {msg: 'blockUpdate', data: event.data.payload}) } diff --git a/views/index.html b/views/index.html index 63d6b35..8459ec0 100644 --- a/views/index.html +++ b/views/index.html @@ -49,7 +49,7 @@ diff --git a/views/js/mainRender.js b/views/js/mainRender.js index 4caa35a..404efe0 100644 --- a/views/js/mainRender.js +++ b/views/js/mainRender.js @@ -152,29 +152,6 @@ onload = () => { // Send commands to preload.js webview.addEventListener('console-message', (e) => { - if (e.message.includes("RTC media connection state: CONNECTED")) { - console.log("Connected to server") - window.postMessage({ type: "connected"}, "*") - removeBloat(webview) - isConnectedToVoiceServer = true - } - - if (e.message.includes("RTC media connection state: DISCONNECTED")) { - console.log("Disconnected from server") - window.postMessage({ type: "disconnected"}, "*") - isConnectedToVoiceServer = false - } - - if (e.message === "muted") { - console.log("Self Muted in Discord") - window.postMessage({ type: "self-muted"}, "*") - } - - if (e.message === "unmuted") { - console.log("Self Un-Muted in Discord") - window.postMessage({ type: "self-unmuted"}, "*") - } - // Execute JS into the webview after login if (e.message === "--discord-load-complete") { userMuteDeafenListener(webview)