Merge pull request #1064 from Araxeus/add-centralized-synced-config-for-plugins

Add dynamic synced plugin config provider
This commit is contained in:
th-ch
2023-03-19 19:26:47 +01:00
committed by GitHub
3 changed files with 142 additions and 22 deletions

View File

@ -39,7 +39,6 @@ const setup = () => {
/** @param {Electron.BrowserWindow} win */
module.exports = (win, options) => {
config.init(options);
// Register the callback for new song information
is.windows() && options.interactive ?
require("./interactive")(win) :

View File

@ -1,23 +1,5 @@
const { setOptions, setMenuOptions } = require("../../config/plugins");
const defaultConfig = require("../../config/defaults");
const { PluginConfig } = require("../../config/dynamic");
let config = defaultConfig.plugins["notifications"];
const config = new PluginConfig("notifications");
module.exports.init = (options) => {
config = { ...config, ...options };
};
module.exports.setAndMaybeRestart = (option, value) => {
config[option] = value;
setMenuOptions("notifications", config);
};
module.exports.set = (option, value) => {
config[option] = value;
setOptions("notifications", config);
};
module.exports.get = (option) => {
let res = config[option];
return res;
};
module.exports = { ...config };