Compare commits

...

2 Commits

Author SHA1 Message Date
TC
eac2c5cf14 Bump version to 1.1.2 2019-05-01 19:31:47 +02:00
TC
5a1d7fbf23 Display error/retry in case of failure 2019-05-01 19:31:35 +02:00
5 changed files with 67 additions and 4 deletions

50
error.html Normal file
View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Cannot load YouTube Music</title>
<style>
body {
background: #000;
}
.container {
margin: 0;
font-family: Roboto, Arial, sans-serif;
font-size: 20px;
font-weight: 500;
color: rgba(255, 255, 255, 0.5);
position: absolute;
top: 50%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
text-align: center;
}
.button {
background: #065fd4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: white;
font: inherit;
text-transform: uppercase;
text-decoration: none;
border-radius: 2px;
font-size: 16px;
font-weight: normal;
text-align: center;
padding: 8px 22px;
display: inline-block;
}
</style>
</head>
<body>
<div class="container">
<p>Cannot load YouTube Music… Internet disconnected?</p>
<a href="#" class="button" onclick="reload()">Retry</a>
</div>
</body>
</html>

View File

@ -72,6 +72,13 @@ function createMainWindow() {
});
});
win.webContents.on("did-fail-load", () => {
if (isDev) {
console.log("did fail load");
}
win.webContents.loadFile(path.join(__dirname, "error.html"));
});
win.webContents.on("did-navigate-in-page", () => {
const url = win.webContents.getURL();
if (url.startsWith("https://music.youtube.com")) {

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "youtube-music",
"version": "1.1.1",
"version": "1.1.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name" : "youtube-music",
"productName": "YouTube Music",
"version" : "1.1.1",
"version" : "1.1.2",
"description": "YouTube Music Desktop App - including custom plugins",
"license" : "MIT",
"repository" : "th-ch/youtube-music",

View File

@ -1,7 +1,9 @@
const path = require("path");
const { getEnabledPlugins } = require("./store");
const { fileExists } = require("./plugins/utils");
const { getCurrentWindow } = require("electron").remote;
const { getEnabledPlugins, store } = require("./store");
const { fileExists } = require("./plugins/utils");
const plugins = getEnabledPlugins();
@ -23,4 +25,8 @@ document.addEventListener("DOMContentLoaded", () => {
run();
});
});
// Add action for reloading
global.reload = () =>
getCurrentWindow().webContents.loadURL(store.get("url"));
});