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

Added user events support in MicroLMS within MeshCmd.

This commit is contained in:
Ylian Saint-Hilaire 2018-02-02 12:46:09 -08:00
parent 007f150be0
commit c210b926bc
12 changed files with 133 additions and 100 deletions

View file

@ -224,7 +224,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
if (obj.onDisplayinfo != null) { obj.onDisplayinfo(obj, myOptions, selitem); }
break;
case 12: // SetDisplay
console.log('SetDisplayConfirm');
//console.log('SetDisplayConfirmed');
break;
case 14: // KVM_INIT_TOUCH
obj.touchenabled = 1;

View file

@ -52,6 +52,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort) {
obj.xxOnControlCommand = function (msg) {
var controlMsg;
try { controlMsg = JSON.parse(msg); } catch (e) { return; }
//console.log(controlMsg);
if (obj.webrtc != null) {
if (controlMsg.type == 'answer') {
obj.webrtc.setRemoteDescription(new RTCSessionDescription(controlMsg), function () { /*console.log('WebRTC remote ok');*/ }, obj.xxCloseWebRTC);
@ -93,7 +94,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort) {
// TODO: Hold/Stop sending data over websocket
if (obj.onStateChanged != null) { obj.onStateChanged(obj, obj.State); }
};
obj.webchannel.onclose = function (event) { console.log('WebRTC close'); obj.Stop(); }
obj.webchannel.onclose = function (event) { /*console.log('WebRTC close');*/ obj.Stop(); }
obj.webrtc.onicecandidate = function (e) {
if (e.candidate == null) {
obj.socket.send(JSON.stringify(obj.webrtcoffer)); // End of candidates, send the offer
@ -101,7 +102,12 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort) {
obj.webrtcoffer.sdp += ("a=" + e.candidate.candidate + "\r\n"); // New candidate, add it to the SDP
}
}
obj.webrtc.oniceconnectionstatechange = function () { if (obj.webrtc != null) { if ((obj.webrtc.iceConnectionState == 'disconnected') || (obj.webrtc.iceConnectionState == 'failed')) { obj.xxCloseWebRTC(); } } }
obj.webrtc.oniceconnectionstatechange = function () {
if (obj.webrtc != null) {
//console.log(obj.webrtc.iceConnectionState)
if ((obj.webrtc.iceConnectionState == 'disconnected') || (obj.webrtc.iceConnectionState == 'failed')) { obj.xxCloseWebRTC(); }
}
}
obj.webrtc.createOffer(function (offer) {
// Got the offer
obj.webrtcoffer = offer;