@@ -52,19 +52,16 @@ function unmuteMic() {
5252}
5353
5454function muteMic ( ) {
55- if ( selfMute === false ) {
56- console . log ( "Not Talking" )
57- mainWindow . webContents . send ( 'micClose' , 'mic-closed' )
58- mainWindow . setTitle ( "MIC CLOSED" )
59- }
55+ console . log ( "Not Talking" )
56+ mainWindow . webContents . send ( 'micClose' , 'mic-closed' )
57+ mainWindow . setTitle ( "MIC CLOSED" )
6058}
6159
6260function createMainWindow ( ) {
6361 // Create the browser window.
6462 mainWindow = new BrowserWindow ( {
6563 width : 1230 ,
6664 height : 800 ,
67- icon : './views/assets/icon.ico' ,
6865 webPreferences : {
6966 preload : path . join ( __dirname , 'src/mainLoad.js' ) ,
7067 partition : 'persist:discord' ,
@@ -95,7 +92,6 @@ function createLogWindow() {
9592 width : 700 ,
9693 height : 400 ,
9794 resizable : false ,
98- icon : './views/assets/icon.ico' ,
9995 webPreferences : {
10096 preload : path . join ( __dirname , 'src/logLoad.js' ) ,
10197 nodeIntegration : false , // https://electronjs.org/docs/tutorial/security#2-do-not-enable-nodejs-integration-for-remote-content
@@ -125,7 +121,6 @@ function createSettingsWindow() {
125121 show : true ,
126122 resizable : false ,
127123 alwaysOnTop :true ,
128- icon : './views/assets/icon.ico' ,
129124 webPreferences : {
130125 preload : path . join ( __dirname , 'src/settingsLoad.js' ) ,
131126 nodeIntegration : false ,
@@ -190,6 +185,7 @@ function setPTTKey() {
190185 } else {
191186 console . log ( "ERROR: configObj did not set PTT device to mouse or keyboard." )
192187 }
188+
193189 ioHook . on ( pttEnable , event => {
194190 if ( event [ pttWatch ] == configObj . key && ( micPermissionGranted === true ) && ( isConnected === true ) && ( isChangingPTTKey === false ) ) {
195191 clearTimeout ( muteTimeout )
@@ -205,6 +201,7 @@ function setPTTKey() {
205201 }
206202 }
207203 } )
204+
208205 } else {
209206 console . log ( "Not listening for keypresses. ioHook library error or PTT keys not set." )
210207 }
@@ -258,23 +255,22 @@ app.on('web-contents-created', (event, contents) => { // https://electronjs.org/
258255} )
259256
260257app . on ( 'web-contents-created' , ( event , contents ) => { // https://electronjs.org/docs/tutorial/security#12-disable-or-limit-navigation
261- contents . on ( 'will-navigate' , ( event , navigationUrl ) => {
258+ contents . on ( 'will-navigate' , ( event , navigationUrl ) => { // https://electronjs.org/docs/tutorial/security#13-disable-or-limit-creation-of-new-windows
262259 const parsedUrl = new URL ( navigationUrl )
263260 console . log ( `will-navigate ${ navigationUrl } ` )
264261 if ( parsedUrl . origin !== 'https://discord.com/' ) { // Limit navigation to discordapp.com; not really relevant
265262 event . preventDefault ( )
266263 }
267264 } )
268- } )
269265
270- app . on ( 'web-contents-created' , ( event , contents ) => { // https://electronjs.org/docs/tutorial/security#13-disable-or-limit-creation-of-new-windows
271266 contents . on ( 'new-window' , async ( event , navigationUrl ) => {
272267 clipboard . writeText ( navigationUrl , 'selection' ) // I really hope this is safe to do. Could also do a little URL cleaning here to remove trackers
273268 console . log ( `URL ${ navigationUrl . toString ( ) . slice ( 0 , 20 ) } Copied to Clipboard` )
274269 mainWindow . webContents . send ( 'URLCopied' , null )
275270 //event.preventDefault() // Prevents external links from opening
276271 } )
277272} )
273+
278274/* ---- */
279275
280276
0 commit comments