1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Tweaks to plugin install/removal so server does not require a restart. Initial support for downgrading plugins.

This commit is contained in:
Ryan Blenis 2019-11-22 14:25:13 -05:00
parent 800504f5ed
commit 78bbf03b00
5 changed files with 165 additions and 19 deletions

View file

@ -3208,6 +3208,16 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
parent.pluginHandler.handleAdminPostReq(req, res, user, obj);
}
obj.handlePluginJS = function(req, res) {
const domain = checkUserIpAddress(req, res);
if (domain == null) { res.sendStatus(404); return; }
if ((!req.session) || (req.session == null) || (!req.session.userid)) { res.sendStatus(401); return; }
var user = obj.users[req.session.userid];
if (user == null) { res.sendStatus(401); return; }
parent.pluginHandler.refreshJS(req, res);
}
// Starts the HTTPS server, this should be called after the user/mesh tables are loaded
function serverStart() {
@ -3334,6 +3344,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
if (parent.pluginHandler != null) {
obj.app.get(url + 'pluginadmin.ashx', obj.handlePluginAdminReq);
obj.app.post(url + 'pluginadmin.ashx', obj.handlePluginAdminPostReq);
obj.app.get(url + 'pluginHandler.js', obj.handlePluginJS);
}
// Server redirects