mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Updated MeshCentral Assistant with self-update system.
This commit is contained in:
parent
11374d1809
commit
1b590dba5e
6 changed files with 42 additions and 2 deletions
24
webserver.js
24
webserver.js
|
@ -4178,8 +4178,30 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
|
|||
if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key
|
||||
var user = obj.users[req.session.userid];
|
||||
if (user == null) {
|
||||
// Check if we have an authentication cookie
|
||||
var c = obj.parent.decodeCookie(req.query.auth, obj.parent.loginCookieEncryptionKey);
|
||||
if ((c == null) || (c.userid == null)) { res.sendStatus(404); return; }
|
||||
if (c == null) { res.sendStatus(404); return; }
|
||||
|
||||
// Download tools using a cookie
|
||||
if (c.download == req.query.meshaction) {
|
||||
if (req.query.meshaction == 'winrouter') {
|
||||
var p = obj.path.join(__dirname, 'agents', 'MeshCentralRouter.exe');
|
||||
if (obj.fs.existsSync(p)) {
|
||||
setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralRouter.exe', null, 'MeshCentralRouter.exe');
|
||||
try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
|
||||
} else { res.sendStatus(404); }
|
||||
} else if (req.query.meshaction == 'winassistant') {
|
||||
var p = obj.path.join(__dirname, 'agents', 'MeshCentralAssistant.exe');
|
||||
if (obj.fs.existsSync(p)) {
|
||||
setContentDispositionHeader(res, 'application/octet-stream', 'MeshCentralAssistant.exe', null, 'MeshCentralAssistant.exe');
|
||||
try { res.sendFile(p); } catch (e) { res.sendStatus(404); }
|
||||
} else { res.sendStatus(404); }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the cookie authenticates a user
|
||||
if (c.userid == null) { res.sendStatus(404); return; }
|
||||
user = obj.users[c.userid];
|
||||
if (user == null) { res.sendStatus(404); return; }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue