mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-02-12 11:01:52 +00:00
Can now set expire time for Assistant guest self-sharing. #3347
This commit is contained in:
parent
40f052e027
commit
938ca3574e
1 changed files with 9 additions and 2 deletions
11
meshagent.js
11
meshagent.js
|
@ -1090,7 +1090,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
if (typeof domain.terminal.launchcommand.freebsd == 'string') { serverInfo.termlaunchcommand.freebsd = domain.terminal.launchcommand.freebsd; }
|
if (typeof domain.terminal.launchcommand.freebsd == 'string') { serverInfo.termlaunchcommand.freebsd = domain.terminal.launchcommand.freebsd; }
|
||||||
}
|
}
|
||||||
// Enable agent self guest sharing if allowed
|
// Enable agent self guest sharing if allowed
|
||||||
if (domain.agentselfguestsharing === true) { serverInfo.agentSelfGuestSharing = true; }
|
if (domain.agentselfguestsharing) { serverInfo.agentSelfGuestSharing = true; }
|
||||||
obj.send(JSON.stringify(serverInfo));
|
obj.send(JSON.stringify(serverInfo));
|
||||||
|
|
||||||
// Plug in handler
|
// Plug in handler
|
||||||
|
@ -1686,7 +1686,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Add a new self-share, this will replace any share for this device
|
// Add a new self-share, this will replace any share for this device
|
||||||
if ((domain.agentselfguestsharing !== true) || (typeof command.flags != 'number')) return; // Check if agent self-sharing is allowed, this is off by default.
|
if ((domain.agentselfguestsharing == null) || (domain.agentselfguestsharing == false) || (typeof command.flags != 'number')) return; // Check if agent self-sharing is allowed, this is off by default.
|
||||||
if ((command.flags & 2) == 0) { command.viewOnly = false; } // Only allow "view only" if desktop is shared.
|
if ((command.flags & 2) == 0) { command.viewOnly = false; } // Only allow "view only" if desktop is shared.
|
||||||
addGuestSharing(command.flags, command.viewOnly, function (share) {
|
addGuestSharing(command.flags, command.viewOnly, function (share) {
|
||||||
obj.guestSharing = true;
|
obj.guestSharing = true;
|
||||||
|
@ -1730,6 +1730,13 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
||||||
|
|
||||||
// Create a device sharing database entry
|
// Create a device sharing database entry
|
||||||
var shareEntry = { _id: 'deviceshare-' + publicid, type: 'deviceshare', nodeid: obj.dbNodeKey, p: flags, domain: domain.id, publicid: publicid, guestName: 'Agent', consent: 0x7F, url: url, extrakey: extrakey };
|
var shareEntry = { _id: 'deviceshare-' + publicid, type: 'deviceshare', nodeid: obj.dbNodeKey, p: flags, domain: domain.id, publicid: publicid, guestName: 'Agent', consent: 0x7F, url: url, extrakey: extrakey };
|
||||||
|
|
||||||
|
// Add expire time
|
||||||
|
if ((typeof domain.agentselfguestsharing == 'object') && (typeof domain.agentselfguestsharing.expire == 'number') && (domain.agentselfguestsharing.expire > 0)) {
|
||||||
|
shareEntry.startTime = Date.now();
|
||||||
|
shareEntry.expireTime = Date.now() + (60000 * domain.agentselfguestsharing.expire);
|
||||||
|
}
|
||||||
|
|
||||||
if (viewOnly === true) { shareEntry.viewOnly = true; }
|
if (viewOnly === true) { shareEntry.viewOnly = true; }
|
||||||
parent.db.Set(shareEntry);
|
parent.db.Set(shareEntry);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue