mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
add back-to-front logger
This somehow fix "did-fail-load" being called on song start, with in-app-plugin-activated
This commit is contained in:
23
index.js
23
index.js
@ -163,10 +163,29 @@ app.on("browser-window-created", (event, win) => {
|
|||||||
createdWindow = true;
|
createdWindow = true;
|
||||||
loadPlugins(win);
|
loadPlugins(win);
|
||||||
|
|
||||||
win.webContents.on("did-fail-load", () => {
|
win.webContents.on("did-fail-load", (
|
||||||
|
event,
|
||||||
|
errorCode,
|
||||||
|
errorDescription,
|
||||||
|
validatedURL,
|
||||||
|
isMainFrame,
|
||||||
|
frameProcessId,
|
||||||
|
frameRoutingId,
|
||||||
|
) => {
|
||||||
|
let log = {
|
||||||
|
error: "did-fail-load",
|
||||||
|
event,
|
||||||
|
errorCode,
|
||||||
|
errorDescription,
|
||||||
|
validatedURL,
|
||||||
|
isMainFrame,
|
||||||
|
frameProcessId,
|
||||||
|
frameRoutingId,
|
||||||
|
};
|
||||||
if (is.dev()) {
|
if (is.dev()) {
|
||||||
console.log("did fail load");
|
console.log(log);
|
||||||
}
|
}
|
||||||
|
win.webContents.send("log", log);
|
||||||
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
win.webContents.loadFile(path.join(__dirname, "error.html"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|||||||
// inject song-info provider
|
// inject song-info provider
|
||||||
const songInfoProviderPath = path.join(__dirname, "providers", "song-info-front.js")
|
const songInfoProviderPath = path.join(__dirname, "providers", "song-info-front.js")
|
||||||
fileExists(songInfoProviderPath, require(songInfoProviderPath));
|
fileExists(songInfoProviderPath, require(songInfoProviderPath));
|
||||||
|
|
||||||
|
// inject front logger
|
||||||
|
const loggerPath = path.join(__dirname, "providers", "logger.js")
|
||||||
|
fileExists(loggerPath, require(loggerPath));
|
||||||
|
|
||||||
// Add action for reloading
|
// Add action for reloading
|
||||||
global.reload = () =>
|
global.reload = () =>
|
||||||
|
|||||||
14
providers/logger.js
Normal file
14
providers/logger.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
const { ipcRenderer } = require("electron");
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
ipcRenderer.on("log", (event, log) => {
|
||||||
|
let string = log.toString() || log;
|
||||||
|
if (string) {
|
||||||
|
console.log(string);
|
||||||
|
} else {
|
||||||
|
for (let propery of log) {
|
||||||
|
console.log(propery.toString() || propery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user