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);
|
|
|
|
}
|
|
|
|
|
2023-01-07 16:50:16 +00:00
|
|
|
init(webServer, cb) {
|
2022-12-31 22:48:51 +00:00
|
|
|
// to be implemented!
|
2023-01-07 16:50:16 +00:00
|
|
|
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
|
|
|
};
|