diff --git a/preload.js b/preload.js index 94f2a72a..ab7927fc 100644 --- a/preload.js +++ b/preload.js @@ -1,6 +1,6 @@ const path = require("path"); -const { contextBridge, remote } = require("electron"); +const { remote } = require("electron"); const config = require("./config"); const { fileExists } = require("./plugins/utils"); @@ -8,9 +8,15 @@ const { fileExists } = require("./plugins/utils"); const plugins = config.plugins.getEnabled(); plugins.forEach(([plugin, options]) => { - const pluginPath = path.join(__dirname, "plugins", plugin, "actions.js"); - fileExists(pluginPath, () => { - const actions = require(pluginPath).actions || {}; + const preloadPath = path.join(__dirname, "plugins", plugin, "preload.js"); + fileExists(preloadPath, () => { + const run = require(preloadPath); + run(options); + }); + + const actionPath = path.join(__dirname, "plugins", plugin, "actions.js"); + fileExists(actionPath, () => { + const actions = require(actionPath).actions || {}; // TODO: re-enable once contextIsolation is set to true // contextBridge.exposeInMainWorld(plugin + "Actions", actions);