Fix resumeOnStart option

This commit is contained in:
TC
2021-03-04 23:09:01 +01:00
parent 0dcf820944
commit f50bd32fa3
5 changed files with 14 additions and 5 deletions

View File

@ -14,7 +14,7 @@ const defaultConfig = {
restartOnConfigChanges: false,
trayClickPlayPause: false,
autoResetAppCache: false,
resumeSongOnStart: true
resumeOnStart: true,
},
plugins: {
// Enabled plugins

View File

@ -1,3 +1,4 @@
const defaultConfig = require("./defaults");
const plugins = require("./plugins");
const store = require("./store");
@ -10,6 +11,7 @@ const get = (key) => {
};
module.exports = {
defaultConfig,
get,
set,
edit: () => store.openInEditor(),

View File

@ -3,6 +3,11 @@ const Store = require("electron-store");
const defaults = require("./defaults");
const migrations = {
">=1.11.0": (store) => {
if (store.get("options.resumeOnStart") === undefined) {
store.set("options.resumeOnStart", true);
}
},
">=1.7.0": (store) => {
const enabledPlugins = store.get("plugins");
if (!Array.isArray(enabledPlugins)) {

View File

@ -111,7 +111,9 @@ function createMainWindow() {
win.maximize();
}
const urlToLoad = config.get("resumeOnStart") ? config.get("url") : "https://music.youtube.com";
const urlToLoad = config.get("options.resumeOnStart")
? config.get("url")
: config.defaultConfig.url;
win.webContents.loadURL(urlToLoad);
win.on("closed", onClosed);

View File

@ -69,10 +69,10 @@ const mainMenuTemplate = (win) => [
{
label: "Resume last song when app starts",
type: "checkbox",
checked: config.get("options.resumeSongOnStart"),
checked: config.get("options.resumeOnStart"),
click: (item) => {
config.set("options.resumeSongOnStart", item.checked);
}
config.set("options.resumeOnStart", item.checked);
},
},
...(is.windows() || is.linux()
? [