enigma-bbs/core/web_handler_module.js

31 lines
864 B
JavaScript
Raw Normal View History

2022-12-31 22:48:51 +00:00
const { PluginModule } = require('./plugin_module');
2023-01-03 05:25:32 +00:00
const Config = require('./config').get;
2022-12-31 22:48:51 +00:00
module.exports = class WebHandlerModule extends PluginModule {
constructor(options) {
super(options);
}
init(webServer, cb) {
2022-12-31 22:48:51 +00:00
// to be implemented!
this.webServer = webHandler;
2022-12-31 22:48:51 +00:00
return cb(null);
}
2023-01-03 05:25:32 +00:00
static isEnabled(handlerName) {
const config = Config();
const handlers = config.contentServers?.web?.handlers;
return handlers && true === handlers[handlerName]?.enabled;
}
static getWebServer() {
const { getServer } = require('./listening_server');
const WebServerPackageName = require('./servers/content/web').moduleInfo
.packageName;
const ws = getServer(WebServerPackageName);
if (ws) {
return ws.instance;
}
}
2022-12-31 22:48:51 +00:00
};