mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added account image to MeshMessenger.
This commit is contained in:
parent
d5639f1121
commit
a43df59a4d
2 changed files with 106 additions and 59 deletions
31
meshrelay.js
31
meshrelay.js
|
@ -199,6 +199,17 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
}
|
||||
}
|
||||
|
||||
// Push any stored message to the peer
|
||||
obj.sendPeerImage = function () {
|
||||
if (obj.id.startsWith('meshmessenger/') && (obj.peer != null) && (obj.user != null) && (typeof obj.user.flags == 'number') && (obj.user.flags & 1)) {
|
||||
parent.db.Get('im' + obj.user._id, function (err, docs) {
|
||||
if ((err == null) && (docs != null) && (docs.length == 1) && (typeof docs[0].image == 'string')) {
|
||||
try { obj.peer.ws.send(JSON.stringify({ ctrlChannel: '102938', type: 'image', image: docs[0].image })); } catch (ex) { }
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Send a PING/PONG message
|
||||
function sendPing() {
|
||||
try { obj.ws.send('{"ctrlChannel":"102938","type":"ping"}'); } catch (ex) { }
|
||||
|
@ -312,6 +323,10 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
// Send any stored push messages
|
||||
obj.pushStoredMessages();
|
||||
relayinfo.peer1.pushStoredMessages();
|
||||
|
||||
// Send other peer's image
|
||||
obj.sendPeerImage();
|
||||
relayinfo.peer1.sendPeerImage();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -339,6 +354,10 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
// Send any stored push messages
|
||||
obj.pushStoredMessages();
|
||||
relayinfo.peer1.pushStoredMessages();
|
||||
|
||||
// Send other peer's image
|
||||
obj.sendPeerImage();
|
||||
relayinfo.peer1.sendPeerImage();
|
||||
} else {
|
||||
// Write the recording file header
|
||||
parent.parent.debug('relay', 'Relay: Started recoding to file: ' + recFullFilename);
|
||||
|
@ -365,6 +384,10 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
// Send any stored push messages
|
||||
obj.pushStoredMessages();
|
||||
relayinfo.peer1.pushStoredMessages();
|
||||
|
||||
// Send other peer's image
|
||||
obj.sendPeerImage();
|
||||
relayinfo.peer1.sendPeerImage();
|
||||
return;
|
||||
}
|
||||
try { ws.send('cr'); } catch (ex) { } // Send connect to both peers, 'cr' indicates the session is being recorded.
|
||||
|
@ -373,6 +396,10 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
// Send any stored push messages
|
||||
obj.pushStoredMessages();
|
||||
relayinfo.peer1.pushStoredMessages();
|
||||
|
||||
// Send other peer's image
|
||||
obj.sendPeerImage();
|
||||
relayinfo.peer1.sendPeerImage();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -385,6 +412,10 @@ function CreateMeshRelayEx(parent, ws, req, domain, user, cookie) {
|
|||
// Send any stored push messages
|
||||
obj.pushStoredMessages();
|
||||
relayinfo.peer1.pushStoredMessages();
|
||||
|
||||
// Send other peer's image
|
||||
obj.sendPeerImage();
|
||||
relayinfo.peer1.sendPeerImage();
|
||||
}
|
||||
|
||||
parent.parent.debug('relay', 'Relay connected: ' + obj.id + ' (' + obj.req.clientIp + ' --> ' + obj.peer.req.clientIp + ')');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue