Inject JS to remove download button

This commit is contained in:
khlam 2019-10-15 21:07:17 -07:00
parent 02c8f7b038
commit d62a0fd580
3 changed files with 10 additions and 4 deletions

View File

@ -16,7 +16,7 @@
</div>
<webview id="discord" src="https://discordapp.com/login"></webview>
<webview id="discord" webpreferences="plugins=false, webgl=false, enableRemoteModule=false" src="https://discordapp.com/login"></webview>
<script src="./renderer.js"></script>
</body>

View File

@ -12,8 +12,8 @@ let devMode = false
function createWindow () {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1000,
height: 750,
width: 1230,
height: 730,
icon: './assets/icon.ico',
frame: false,
webPreferences: {
@ -77,7 +77,7 @@ function muteDelay() {
return new Promise((resolve) => {
setTimeout(function(){
return resolve(true)
}, 10);
}, 1300); // big fat push to talk delay .com
})
}

View File

@ -9,6 +9,12 @@ onload = () => {
if (e.message === "Constructed RTCPeerConnection") {
console.log("Connected to server")
ipcRenderer.send('asynchronous-message', 'connected')
// The only place where we execute arbitrary JS into the webview. This is to remove the download button at the bottom of the server list.
// Obviously malicious actors could take this source and create their own malicious discord client that steals auth tokens or something.
webview.executeJavaScript(`
let x = document.getElementsByClassName("listItem-2P_4kh");
x[x.length-1].innerHTML = "";
`)
}
if (e.message === "Close RTCPeerConnection") {