mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Use contextBridge in preload script + update navigation plugin
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
const path = require("path");
|
||||
|
||||
const { remote } = require("electron");
|
||||
const { contextBridge, remote } = require("electron");
|
||||
|
||||
const config = require("./config");
|
||||
const { fileExists } = require("./plugins/utils");
|
||||
@ -10,10 +10,8 @@ const plugins = config.plugins.getEnabled();
|
||||
plugins.forEach(([plugin, options]) => {
|
||||
const pluginPath = path.join(__dirname, "plugins", plugin, "actions.js");
|
||||
fileExists(pluginPath, () => {
|
||||
const actions = require(pluginPath).global || {};
|
||||
Object.keys(actions).forEach((actionName) => {
|
||||
global[actionName] = actions[actionName];
|
||||
});
|
||||
const actions = require(pluginPath).actions || {};
|
||||
contextBridge.exposeInMainWorld(plugin + "Actions", actions);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user