diff --git a/public/scripts/agent-desktop-0.0.2.js b/public/scripts/agent-desktop-0.0.2.js index 2d58dd3d..d48302a4 100644 --- a/public/scripts/agent-desktop-0.0.2.js +++ b/public/scripts/agent-desktop-0.0.2.js @@ -212,7 +212,12 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) { jumboAdd = 8; } if ((cmdsize != str.length) && (obj.debugmode > 0)) { console.log(cmdsize, str.length, cmdsize == str.length); } - if ((command >= 18) && (command != 65) && (command != 88)) { console.error("Invalid KVM command " + command + " of size " + cmdsize); console.log("Invalid KVM data", str.length, rstr2hex(str.substring(0, 40)) + '...'); return; } + if ((command >= 18) && (command != 65) && (command != 88)) { + console.error("Invalid KVM command " + command + " of size " + cmdsize); + console.log("Invalid KVM data", str.length, rstr2hex(str.substring(0, 40)) + '...'); + if (obj.parent && obj.parent.setConsoleMessage) { obj.parent.setConsoleMessage("Invalid KVM command " + command + " of size " + cmdsize); } + return; + } if (cmdsize > str.length) { //console.log('KVM accumulator set to ' + str.length + ' bytes, need ' + cmdsize + ' bytes.'); obj.accumulator = str; @@ -287,10 +292,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) { str = str.substring(4); if (str[0] != '.') { console.log(str); //alert('KVM: ' + str); - if (obj.parent != null) { - obj.parent.consoleMessage = str; - if (obj.parent.onConsoleMessageChange) { obj.parent.onConsoleMessageChange(obj.parent, str); } - } + if (obj.parent && obj.parent.setConsoleMessage) { obj.parent.setConsoleMessage(str); } } else { console.log('KVM: ' + str.substring(1)); } diff --git a/public/scripts/agent-redir-ws-0.1.1.js b/public/scripts/agent-redir-ws-0.1.1.js index 37b83cb5..a01f08d4 100644 --- a/public/scripts/agent-redir-ws-0.1.1.js +++ b/public/scripts/agent-redir-ws-0.1.1.js @@ -72,8 +72,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au //console.log(controlMsg); if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirRecv', controlMsg); } if (controlMsg.type == 'console') { - obj.consoleMessage = controlMsg.msg; - if (obj.onConsoleMessageChange) { obj.onConsoleMessageChange(obj, obj.consoleMessage); } + setConsoleMessage(controlMsg.msg); } else if ((controlMsg.type == 'rtt') && (typeof controlMsg.time == 'number')) { obj.latency.current = (new Date().getTime()) - controlMsg.time; if (obj.latency.callbacks != null) { obj.latency.callback(obj.latency.current); } @@ -91,6 +90,13 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au } } + // Set the console message + obj.setConsoleMessage = function (str) { + if (obj.consoleMessage == str) return; + obj.consoleMessage = str; + if (obj.onConsoleMessageChange) { obj.onConsoleMessageChange(obj, obj.consoleMessage); } + } + obj.sendCtrlMsg = function (x) { if (obj.ctrlMsgAllowed == true) { if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirSend', typeof x, x); } try { obj.socket.send(x); } catch (ex) { } } } function performWebRtcSwitch() {