mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Refactor config for simpler use and advanced options in plugins
This commit is contained in:
26
config/store.js
Normal file
26
config/store.js
Normal file
@ -0,0 +1,26 @@
|
||||
const { dialog } = require("electron");
|
||||
const Store = require("electron-store");
|
||||
|
||||
const defaults = require("./defaults");
|
||||
|
||||
module.exports = new Store({
|
||||
defaults,
|
||||
clearInvalidConfig: false,
|
||||
migrations: {
|
||||
">=1.7.0": (store) => {
|
||||
const enabledPlugins = store.get("plugins");
|
||||
if (!Array.isArray(enabledPlugins)) {
|
||||
console.warn("Plugins are not in array format, cannot migrate");
|
||||
return;
|
||||
}
|
||||
|
||||
const plugins = {};
|
||||
enabledPlugins.forEach((enabledPlugin) => {
|
||||
plugins[enabledPlugin] = {
|
||||
enabled: true,
|
||||
};
|
||||
});
|
||||
store.set("plugins", plugins);
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user