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

Fixed event dispatching bug.

This commit is contained in:
Ylian Saint-Hilaire 2021-11-10 17:56:12 -08:00
parent 6dceb842d7
commit aab50dcbef
5 changed files with 52 additions and 23 deletions

View file

@ -1706,8 +1706,9 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
function addGuestSharing(flags, viewOnly, func) {
// Create cookie
var publicid = 'AS:' + obj.dbNodeKey;
var cookie = { a: 6, pid: publicid }; // New style sharing cookie
const publicid = 'AS:' + obj.dbNodeKey;
const extrakey = getRandomAmtPassword();
const cookie = { a: 6, pid: publicid, k: extrakey }; // New style sharing cookie
const inviteCookie = parent.parent.encodeCookie(cookie, parent.parent.invitationLinkEncryptionKey);
if (inviteCookie == null) return;
@ -1720,7 +1721,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
if (serverName.split('.') == 1) { url = '/' + xdomain + page + '?c=' + inviteCookie; }
// 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 };
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 };
if (viewOnly === true) { shareEntry.viewOnly = true; }
parent.db.Set(shareEntry);