Skip to content

Commit 41b9e9c

Browse files
committed
1.0.4; Update electron, fix mute detection
1 parent cdad51e commit 41b9e9c

File tree

4 files changed

+19
-27
lines changed

4 files changed

+19
-27
lines changed

main.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,16 @@ function unmuteMic() {
5252
}
5353

5454
function 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

6260
function 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

260257
app.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

package-lock.json

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

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "discordsandbox",
3-
"version": "1.0.1",
3+
"version": "1.0.4",
44
"description": "Discord Sandboxed",
55
"main": "main.js",
66
"scripts": {
@@ -18,7 +18,7 @@
1818
"author": "Kin-Ho Lam",
1919
"license": "GNU GENERAL PUBLIC LICENSE Version 3",
2020
"devDependencies": {
21-
"electron": "^7.2.4",
21+
"electron": "^9.4.0",
2222
"electron-builder": "^21.2.0"
2323
},
2424
"dependencies": {
@@ -28,7 +28,7 @@
2828
},
2929
"iohook": {
3030
"targets": [
31-
"electron-75"
31+
"electron-80"
3232
],
3333
"platforms": [
3434
"win32",

views/js/mainRender.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ onload = () => {
8686
// Insert JS to detect when discord finishes loading
8787
webview.addEventListener('did-finish-load', function() {
8888

89-
// Discord does not do client-side hashing
9089
webview.executeJavaScript(`
9190
(function(open, send) {
9291
let whiteList = ${_whiteList}
@@ -159,10 +158,7 @@ onload = () => {
159158
`)
160159

161160
webview.executeJavaScript(`
162-
<<<<<<< HEAD
163-
=======
164161
let dlButton = document.querySelectorAll('[aria-label="Download Apps"]')
165-
>>>>>>> dev
166162
t = setInterval(function(){
167163
let dlButton = document.querySelectorAll('[aria-label="Servers sidebar"]')
168164
if(dlButton.length != 0) {

0 commit comments

Comments
 (0)