mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
33 lines
909 B
JavaScript
33 lines
909 B
JavaScript
const path = require("path");
|
|
|
|
const { getCurrentWindow } = require("electron").remote;
|
|
|
|
const { getEnabledPlugins, store } = require("./store");
|
|
const { fileExists } = require("./plugins/utils");
|
|
|
|
const plugins = getEnabledPlugins();
|
|
|
|
plugins.forEach(plugin => {
|
|
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];
|
|
});
|
|
});
|
|
});
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
plugins.forEach(plugin => {
|
|
const pluginPath = path.join(__dirname, "plugins", plugin, "front.js");
|
|
fileExists(pluginPath, () => {
|
|
const run = require(pluginPath);
|
|
run();
|
|
});
|
|
});
|
|
|
|
// Add action for reloading
|
|
global.reload = () =>
|
|
getCurrentWindow().webContents.loadURL(store.get("url"));
|
|
});
|