remove download button
This commit is contained in:
parent
d62a0fd580
commit
2c61c4be93
@ -15,8 +15,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--Note that running in electron is already a chromium sandbox. Discord can no longer peek at a user's clipboard.-->
|
||||||
<webview id="discord" webpreferences="plugins=false, webgl=false, enableRemoteModule=false" src="https://discordapp.com/login"></webview>
|
<webview id="discord" webpreferences="plugins=false, webgl=false, enableRemoteModule=false, sandbox=true, useragent='Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko'" src="https://discordapp.com/login"></webview>
|
||||||
|
|
||||||
<script src="./renderer.js"></script>
|
<script src="./renderer.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
30
renderer.js
30
renderer.js
@ -5,22 +5,40 @@ onload = () => {
|
|||||||
|
|
||||||
ipcRenderer.send('asynchronous-message', 'DOMready')
|
ipcRenderer.send('asynchronous-message', 'DOMready')
|
||||||
|
|
||||||
|
// Execute JS into the webview to detect when logging in is complete
|
||||||
|
webview.addEventListener('did-finish-load', function() {
|
||||||
|
webview.executeJavaScript(`
|
||||||
|
let dlButton = document.getElementsByClassName("listItem-2P_4kh");
|
||||||
|
t = setInterval(function(){
|
||||||
|
if(dlButton.length != 0) {
|
||||||
|
console.log("discord-load-complete")
|
||||||
|
clearInterval(t)
|
||||||
|
}else {
|
||||||
|
console.log("waiting for load")
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
`)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
webview.addEventListener('console-message', (e) => {
|
webview.addEventListener('console-message', (e) => {
|
||||||
if (e.message === "Constructed RTCPeerConnection") {
|
if (e.message === "Constructed RTCPeerConnection") {
|
||||||
console.log("Connected to server")
|
console.log("Connected to server")
|
||||||
ipcRenderer.send('asynchronous-message', 'connected')
|
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") {
|
if (e.message === "Close RTCPeerConnection") {
|
||||||
console.log("Disconnected from server")
|
console.log("Disconnected from server")
|
||||||
ipcRenderer.send('asynchronous-message', 'disconnected')
|
ipcRenderer.send('asynchronous-message', 'disconnected')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Execute JS into the webview after login to remove the download button at the bottom of the server list.
|
||||||
|
if (e.message === "discord-load-complete") {
|
||||||
|
webview.executeJavaScript(`
|
||||||
|
let a = document.getElementsByClassName("listItem-2P_4kh");
|
||||||
|
a[a.length-1].innerHTML = "";
|
||||||
|
`)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcRenderer.on('ping', (event, msg) => {
|
ipcRenderer.on('ping', (event, msg) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user