Fix plugin installation

This commit is contained in:
Louis Lam 2023-01-28 19:00:13 +08:00
parent 1dc2546a39
commit ddce8f0cb0
5 changed files with 38 additions and 13 deletions

View file

@ -1,5 +1,6 @@
const { checkLogin } = require("../util-server");
const { PluginManager } = require("../plugins-manager");
const { PluginsManager } = require("../plugins-manager");
const { log } = require("../../src/util.js");
/**
* Handlers for plugins
@ -15,7 +16,9 @@ module.exports.pluginsHandler = (socket, server) => {
try {
checkLogin(socket);
if (PluginManager.disable) {
log.debug("plugin", "PluginManager.disable: " + PluginsManager.disable);
if (PluginsManager.disable) {
throw new Error("Plugin Disabled: In order to enable plugin feature, you need to use the default data directory: ./data/");
}
@ -25,6 +28,7 @@ module.exports.pluginsHandler = (socket, server) => {
pluginList,
});
} catch (error) {
log.warn("plugin", "Error: " + error.message);
callback({
ok: false,
msg: error.message,