From e8c3716106924c2bc5afcaca5fd70d9d066c5e98 Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Sun, 19 Mar 2023 21:02:23 +0200 Subject: [PATCH] use new dynamic config --- plugins/downloader/back.js | 3 +-- plugins/downloader/config.js | 26 +++----------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/plugins/downloader/back.js b/plugins/downloader/back.js index c5743cf2..35bedfc1 100644 --- a/plugins/downloader/back.js +++ b/plugins/downloader/back.js @@ -65,9 +65,8 @@ const sendError = (error) => { }); }; -module.exports = async (win_, options) => { +module.exports = async (win_) => { win = win_; - config.init(options); injectCSS(win.webContents, join(__dirname, 'style.css')); yt = await Innertube.create({ diff --git a/plugins/downloader/config.js b/plugins/downloader/config.js index bd2380e6..12c0384e 100644 --- a/plugins/downloader/config.js +++ b/plugins/downloader/config.js @@ -1,23 +1,3 @@ -const { setOptions, setMenuOptions } = require('../../config/plugins'); -const defaultConfig = require('../../config/defaults'); - -let config = defaultConfig.plugins['downloader']; - -module.exports.init = (options) => { - config = { ...config, ...options }; -}; - -module.exports.setAndMaybeRestart = (option, value) => { - config[option] = value; - setMenuOptions('downloader', config); -}; - -module.exports.set = (option, value) => { - config[option] = value; - setOptions('downloader', config); -}; - -module.exports.get = (option) => { - const res = config[option]; - return res; -}; +const { PluginConfig } = require('../../config/dynamic'); +const config = new PluginConfig('downloader'); +module.exports = { ...config };