Skip to content

Commit 52a43cb

Browse files
committed
self-mute detection is broken. fixes #30. mic open overlay disabled
1 parent fd6f01a commit 52a43cb

File tree

4 files changed

+111
-96
lines changed

4 files changed

+111
-96
lines changed

main.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let devMode = false
2525
let selfMute = false
2626
let isConnected = false
2727
let webViewSession = null
28-
let isTalking = false
28+
//let isTalking = false
2929
let muteTimeout = null
3030
let configObj
3131
let micPermissionGranted = false
@@ -44,12 +44,12 @@ if (process.argv.length === 3) {
4444
}
4545

4646
function unmuteMic() {
47-
if ( selfMute === false){
48-
isTalking = true
47+
//if ( selfMute === false){
48+
//isTalking = true
4949
console.log("Talking")
5050
mainWindow.webContents.send('micOpen', 'mic-open')
5151
mainWindow.setTitle("MIC OPEN")
52-
}
52+
//}
5353
}
5454

5555
function muteMic() {
@@ -196,10 +196,11 @@ function setPTTKey() {
196196

197197
ioHook.on(pttDisable, event => {
198198
if (event[pttWatch] == configObj.key) {
199-
if (isTalking === true) {
200-
isTalking = false
199+
console.log("PTT pushed down")
200+
//if (isTalking === true) {
201+
//isTalking = false
201202
muteTimeout = setTimeout(() => muteMic(), configObj.delay)
202-
}
203+
//}
203204
}
204205
})
205206

@@ -290,7 +291,7 @@ app.on('ready', () => {
290291
webViewSession.setPermissionRequestHandler((webContents, permission, callback) => { // deny all permissions
291292
const url = webContents.getURL()
292293
if (url.startsWith('https://discord.com/')) {
293-
if (permission === 'media' && isConnected === true) { // if user is connected to Discord voice then enable microphone
294+
if (permission === 'media') { // if user is connected to Discord voice then enable microphone
294295
console.log("User connected to Discord VOIP server. Granted permission for microphone")
295296
micPermissionGranted = true
296297
return callback(true)
@@ -333,10 +334,10 @@ ipcMain.on('asynchronous-message', (event, _data) => {
333334
}
334335

335336
if (msg === 'confirmMicClose') {
336-
if (isTalking === true) {
337-
console.log("Mic state desync. Opening Mic.")
337+
//if (isTalking === true) {
338+
//console.log("Mic state desync. Opening Mic.")
338339
unmuteMic()
339-
}
340+
//}
340341
}
341342

342343
if (msg === 'blockUpdate') {

package-lock.json

Lines changed: 89 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "discordsandbox",
3-
"version": "1.1.7",
3+
"version": "1.2.7",
44
"description": "Discord Sandboxed",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)