Re-format front metadata lib

This commit is contained in:
TC
2021-04-03 11:35:31 +02:00
parent 533b8a8cb7
commit b5c60ee6a9

View File

@ -13,19 +13,20 @@ const injectListener = () => {
var oldXHR = window.XMLHttpRequest; var oldXHR = window.XMLHttpRequest;
function newXHR() { function newXHR() {
var realXHR = new oldXHR(); var realXHR = new oldXHR();
realXHR.addEventListener("readystatechange", () => { realXHR.addEventListener(
"readystatechange",
() => {
if (realXHR.readyState == 4 && realXHR.status == 200) { if (realXHR.readyState == 4 && realXHR.status == 200) {
if (realXHR.responseURL.includes('/player')){ if (realXHR.responseURL.includes("/player")) {
// if the request is the contains the song info send the response to ipcMain // if the request contains the song info, send the response to ipcMain
ipcRenderer.send( ipcRenderer.send("song-info-request", realXHR.responseText);
"song-info-request", }
realXHR.responseText }
},
false
); );
}
}
}, false);
return realXHR; return realXHR;
} }
window.XMLHttpRequest = newXHR; window.XMLHttpRequest = newXHR;
} };
module.exports = injectListener; module.exports = injectListener;