This commit is contained in:
Araxeus
2021-05-06 21:32:44 +03:00
parent 6b72599f80
commit a98b8945fb
2 changed files with 5 additions and 6 deletions

View File

@ -15,4 +15,4 @@ module.exports = () => {
videoStream.yns_pause();
}
});
}
};

View File

@ -10,18 +10,17 @@ ipcRenderer.on("update-song-info", async (_, extractedSongInfo) => {
});
const injectListener = () => {
var oldXHR = window.XMLHttpRequest;
const oldXHR = window.XMLHttpRequest;
function newXHR() {
var realXHR = new oldXHR();
const realXHR = new oldXHR();
realXHR.addEventListener(
"readystatechange",
() => {
if (realXHR.readyState == 4 && realXHR.status == 200) {
if (realXHR.responseURL.includes("/player")) {
if (realXHR.readyState === 4 && realXHR.status === 200
&& realXHR.responseURL.includes("/player")) {
// if the request contains the song info, send the response to ipcMain
ipcRenderer.send("song-info-request", realXHR.responseText);
}
}
},
false
);