2021-05-16 14:29:37 +00:00
|
|
|
const fs = require("fs");
|
2021-05-16 14:31:20 +00:00
|
|
|
const { app, session } = require("electron");
|
2021-06-30 12:42:36 +00:00
|
|
|
const electron = require("electron");
|
|
|
|
const userDataPath = (electron.app || electron.remote.app).getPath("userData");
|
|
|
|
const pluginFolder = userDataPath + "/plugins/";
|
|
|
|
|
2021-05-16 14:29:37 +00:00
|
|
|
app.whenReady().then(() => {
|
|
|
|
fs.readdirSync(pluginFolder).forEach((file) => {
|
|
|
|
try {
|
|
|
|
const manifest = fs.readFileSync(
|
2021-06-30 12:42:36 +00:00
|
|
|
`${userDataPath}/plugins/${file}/manifest.json`,
|
2021-05-16 14:29:37 +00:00
|
|
|
"utf8"
|
|
|
|
);
|
|
|
|
var pluginFile = JSON.parse(manifest);
|
2021-06-30 12:42:36 +00:00
|
|
|
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
|
2021-05-16 14:29:37 +00:00
|
|
|
console.log(
|
|
|
|
`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`,
|
|
|
|
"color:red"
|
|
|
|
);
|
|
|
|
} catch (err) {
|
|
|
|
console.error(err);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|