mirror of
https://github.com/Ylianst/MeshCommander
synced 2025-12-06 06:03:20 +00:00
Fixed terminal.
This commit is contained in:
@@ -41,7 +41,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
||||
obj.oldie = false;
|
||||
obj.CompressionLevel = 50;
|
||||
obj.ScalingLevel = 1024;
|
||||
obj.FrameRateTimer = 50;
|
||||
obj.FrameRateTimer = 10;
|
||||
obj.FirstDraw = false;
|
||||
|
||||
obj.ScreenWidth = 960;
|
||||
@@ -57,6 +57,11 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
||||
obj.onDisplayinfo = null;
|
||||
obj.accumulator = null;
|
||||
|
||||
var xMouseCursorActive = true;
|
||||
var xMouseCursorCurrent = 'default';
|
||||
obj.mouseCursorActive = function (x) { if (xMouseCursorActive == x) return; xMouseCursorActive = x; obj.CanvasId.style.cursor = ((x == true) ? xMouseCursorCurrent : 'default'); }
|
||||
var mouseCursors = ['default', 'progress', 'crosshair', 'pointer', 'help', 'text', 'no-drop', 'move', 'nesw-resize', 'ns-resize', 'nwse-resize', 'w-resize', 'alias', 'wait', 'none', 'not-allowed', 'col-resize', 'row-resize', 'copy', 'zoom-in', 'zoom-out'];
|
||||
|
||||
obj.Start = function () {
|
||||
obj.State = 0;
|
||||
obj.accumulator = null;
|
||||
@@ -213,7 +218,7 @@ 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)) { 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)) + '...'); return; }
|
||||
if (cmdsize > str.length) {
|
||||
//console.log('KVM accumulator set to ' + str.length + ' bytes, need ' + cmdsize + ' bytes.');
|
||||
obj.accumulator = str;
|
||||
@@ -296,6 +301,13 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
|
||||
console.log('KVM: ' + str.substring(1));
|
||||
}
|
||||
break;
|
||||
case 88: // MNG_KVM_MOUSE_CURSOR
|
||||
if (cmdsize != 5) break;
|
||||
var cursorNum = str.charCodeAt(4);
|
||||
if (cursorNum > mouseCursors.length) { cursorNum = 0; }
|
||||
xMouseCursorCurrent = mouseCursors[cursorNum];
|
||||
if (xMouseCursorActive) { obj.CanvasId.style.cursor = xMouseCursorCurrent; }
|
||||
break;
|
||||
}
|
||||
return cmdsize + jumboAdd;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
|
||||
obj.canvas.canvas.width = obj.width; obj.canvas.canvas.height = obj.height;
|
||||
if (obj.onScreenSizeChange != null) { obj.onScreenSizeChange(obj, obj.ScreenWidth, obj.ScreenHeight); } // ???
|
||||
}
|
||||
obj.Send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest
|
||||
obj.send(String.fromCharCode(3, 0, 0, 0, 0, 0) + ShortToStr(obj.width) + ShortToStr(obj.height)); // FramebufferUpdateRequest
|
||||
} else {
|
||||
obj.UnGrabMouseInput();
|
||||
obj.UnGrabKeyInput();
|
||||
@@ -743,7 +743,7 @@ var CreateAmtRemoteDesktop = function (divid, scrolldiv) {
|
||||
if (acc.byteLength < len) return 0;
|
||||
// ###BEGIN###{DesktopInband}
|
||||
if (obj.onKvmData != null) {
|
||||
var d = arrToStr(acc.slice(8, len));
|
||||
var d = arrToStr(new Uint8Array(acc.buffer.slice(8, len)));
|
||||
if ((d.length >= 16) && (d.substring(0, 15) == '\0KvmDataChannel')) {
|
||||
if (obj.kvmDataSupported == false) { obj.kvmDataSupported = true; console.log('KVM Data Channel Supported.'); }
|
||||
if (((obj.onKvmDataAck == -1) && (d.length == 16)) || (d.charCodeAt(15) != 0)) { obj.onKvmDataAck = true; }
|
||||
|
||||
@@ -231,7 +231,7 @@ var CreateAmtRedirect = function (module) {
|
||||
if (accArray.byteLength < 10) break;
|
||||
var cs = (10 + (accArray[9] << 8) + accArray[8]);
|
||||
if (accArray.byteLength < cs) break;
|
||||
if (obj.m.ProcessBinaryData) { obj.m.ProcessBinaryData(obj.acc.slice(10, cs)); } else { obj.m.ProcessData(arrToStr(obj.acc.slice(10, cs))); }
|
||||
if (obj.m.ProcessBinaryData) { obj.m.ProcessBinaryData(obj.acc.slice(10, cs)); } else { obj.m.ProcessData(arrToStr(new Uint8Array(obj.acc.slice(10, cs)))); }
|
||||
cmdsize = cs;
|
||||
break;
|
||||
case 0x2B: // Keep alive message (43)
|
||||
@@ -243,13 +243,7 @@ var CreateAmtRedirect = function (module) {
|
||||
obj.connectstate = 1;
|
||||
obj.m.Start();
|
||||
// KVM traffic, forward rest of accumulator directly.
|
||||
if (accArray.byteLength > 8) {
|
||||
if (obj.m.ProcessBinaryData) {
|
||||
obj.m.ProcessBinaryData(obj.acc.slice(8));
|
||||
} else {
|
||||
obj.m.ProcessData(arrToStr(new Uint8Array(obj.acc.slice(8))));
|
||||
}
|
||||
}
|
||||
if (accArray.byteLength > 8) { if (obj.m.ProcessBinaryData) { obj.m.ProcessBinaryData(obj.acc.slice(8)); } else { obj.m.ProcessData(arrToStr(new Uint8Array(obj.acc.slice(8)))); } }
|
||||
cmdsize = accArray.byteLength;
|
||||
break;
|
||||
case 0xF0:
|
||||
@@ -275,7 +269,7 @@ var CreateAmtRedirect = function (module) {
|
||||
obj.socket.write(new Buffer(x, 'binary'));
|
||||
}
|
||||
|
||||
obj.Send = function (x) {
|
||||
obj.Send = obj.send = function (x) {
|
||||
if (obj.socket == null || obj.connectstate != 1) return;
|
||||
if (obj.protocol == 1) { obj.xxSend(String.fromCharCode(0x28, 0x00, 0x00, 0x00) + ToIntStr(obj.amtsequence++) + ToShortStr(x.length) + x); } else { obj.xxSend(x); }
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
var obj = {};
|
||||
obj.m = module; // This is the inner module (Terminal or Desktop)
|
||||
module.parent = obj;
|
||||
// ###BEGIN###{!Mode-Firmware}
|
||||
obj.authCookie = authCookie;
|
||||
// ###END###{!Mode-Firmware}
|
||||
obj.State = 0;
|
||||
obj.socket = null;
|
||||
// ###BEGIN###{!Mode-Firmware}
|
||||
@@ -31,6 +33,7 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
function arrToStr(arr) { return String.fromCharCode.apply(null, arr); }
|
||||
function randomHex(length) { var r = ''; for (var i = 0; i < length; i++) { r += 'abcdef0123456789'.charAt(Math.floor(Math.random() * 16)); } return r; }
|
||||
|
||||
// ###BEGIN###{!Mode-Firmware}
|
||||
obj.Start = function (host, port, user, pass, tls) {
|
||||
obj.host = host;
|
||||
obj.port = port;
|
||||
@@ -47,6 +50,19 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
obj.socket.onclose = obj.xxOnSocketClosed;
|
||||
obj.xxStateChange(1);
|
||||
}
|
||||
// ###END###{!Mode-Firmware}
|
||||
|
||||
// ###BEGIN###{Mode-Firmware}
|
||||
obj.Start = function () {
|
||||
obj.connectstate = 0;
|
||||
obj.socket = new WebSocket(window.location.protocol.replace('http', 'ws') + '//' + window.location.host + '/ws-redirection');
|
||||
obj.socket.binaryType = 'arraybuffer';
|
||||
obj.socket.onopen = obj.xxOnSocketConnected;
|
||||
obj.socket.onmessage = obj.xxOnMessage;
|
||||
obj.socket.onclose = obj.xxOnSocketClosed;
|
||||
obj.xxStateChange(1);
|
||||
}
|
||||
// ###END###{Mode-Firmware}
|
||||
|
||||
obj.xxOnSocketConnected = function () {
|
||||
obj.xxStateChange(2);
|
||||
@@ -86,7 +102,14 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
if (accArray.byteLength < 13) return;
|
||||
var oemlen = accArray[12];
|
||||
if (accArray.byteLength < 13 + oemlen) return;
|
||||
// ###BEGIN###{!Mode-Firmware}
|
||||
// Query for available authentication
|
||||
obj.directSend(new Uint8Array([0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])); // Query for available authentication
|
||||
// ###END###{!Mode-Firmware}
|
||||
// ###BEGIN###{Mode-Firmware}
|
||||
// When using websocket, we are already authenticated. Send empty basic auth.
|
||||
obj.directSend(new Uint8Array([0x13, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00]));
|
||||
// ###END###{Mode-Firmware}
|
||||
cmdsize = (13 + oemlen);
|
||||
break;
|
||||
default:
|
||||
@@ -102,6 +125,7 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
for (i = 0; i < authDataLen; i++) { authData.push(accArray[9 + i]); }
|
||||
var authDataBuf = new Uint8Array(obj.acc.slice(9, 9 + authDataLen));
|
||||
cmdsize = 9 + authDataLen;
|
||||
// ###BEGIN###{!Mode-Firmware}
|
||||
if (authType == 0) {
|
||||
// Query
|
||||
if (authData.indexOf(4) >= 0) {
|
||||
@@ -149,7 +173,9 @@ var CreateAmtRedirect = function (module, authCookie) {
|
||||
var buf = String.fromCharCode(0x13, 0x00, 0x00, 0x00, authType) + IntToStrX(totallen) + String.fromCharCode(obj.user.length) + obj.user + String.fromCharCode(realm.length) + realm + String.fromCharCode(nonce.length) + nonce + String.fromCharCode(obj.authuri.length) + obj.authuri + String.fromCharCode(cnonce.length) + cnonce + String.fromCharCode(snc.length) + snc + String.fromCharCode(digest.length) + digest;
|
||||
if (authType == 4) buf += (String.fromCharCode(qop.length) + qop);
|
||||
obj.xxSend(buf);
|
||||
} else if (status == 0) { // Success
|
||||
} else
|
||||
// ###END###{!Mode-Firmware}
|
||||
if (status == 0) { // Success
|
||||
switch (obj.protocol) {
|
||||
case 1: {
|
||||
// Serial-over-LAN: Send Intel AMT serial settings...
|
||||
|
||||
24
index.html
24
index.html
@@ -913,21 +913,21 @@
|
||||
<tr>
|
||||
<td style="padding-top:2px;padding-bottom:2px;background:#CCC">
|
||||
<div style="float:right;text-align:right">
|
||||
<input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr()">
|
||||
<input id="id_tcrbutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="CR+LF" title="Toggle what the return key will send" onclick="termToggleCr();Q('id_tcrbutton').blur()">
|
||||
<!-- ###BEGIN###{TerminalSize} -->
|
||||
<input id="id_tsizebutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="80x25" title="Toggle terminal size" onclick="termToggleSize()">
|
||||
<input id="id_tsizebutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="80x25" title="Toggle terminal size" onclick="termToggleSize();Q('id_tsizebutton').blur()">
|
||||
<!-- ###END###{TerminalSize} -->
|
||||
<input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx()">
|
||||
<input id="id_tfxkeysbutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="Intel (F10 = ESC+[OM)" title="Toggle F1 to F10 keys emulation type" onclick="termToggleFx();Q('id_tfxkeysbutton').blur()">
|
||||
<!-- ###BEGIN###{Terminal-Enumation-All} -->
|
||||
<input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType()">
|
||||
<input id="id_ttypebutton" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event);return false" class="bottombutton" value="Extended Ascii" title="Toggle terminal emulation type" onclick="termToggleType();Q('id_ttypebutton').blur()">
|
||||
<!-- ###END###{Terminal-Enumation-All} -->
|
||||
</div>
|
||||
<div>
|
||||
|
||||
<input type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Ctl-C" onclick="termSendKey(3)">
|
||||
<input type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Ctl-X" onclick="termSendKey(24)">
|
||||
<input type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="ESC" onclick="termSendKey(27)">
|
||||
<input type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Backspace" onclick="termSendKey(8)">
|
||||
<input id="id_toolbtncc" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Ctl-C" onclick="termSendKey(3);Q('id_toolbtncc').blur()">
|
||||
<input id="id_toolbtncx" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Ctl-X" onclick="termSendKey(24);Q('id_toolbtncx').blur()">
|
||||
<input id="id_toolbtnes" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="ESC" onclick="termSendKey(27);Q('id_toolbtnes').blur()">
|
||||
<input id="id_toolbtnbs" type="button" onkeypress="return false" onkeydown="if (event.keyCode == 13) handleKeyPress(event); return false" class="bottombutton" value="Backspace" onclick="termSendKey(8);Q('id_toolbtnbs').blur()">
|
||||
<input id="id_tpastebutton" type="button" onkeypress="return false" onkeydown="return false" class="cadbutton" value="Paste" disabled="disabled" onclick="setDialogMode(3,'Paste',3,termPaste)">
|
||||
</div>
|
||||
</td>
|
||||
@@ -1617,7 +1617,7 @@
|
||||
<!-- ###END###{PowerControl} -->
|
||||
<script type="text/javascript">
|
||||
// ###BEGIN###{!Look-BrandedCommander}
|
||||
var version = '0.8.3';
|
||||
var version = '0.8.4';
|
||||
// ###END###{!Look-BrandedCommander}
|
||||
// ###BEGIN###{Look-BrandedCommander}
|
||||
var version = '1.2.0';
|
||||
@@ -7670,8 +7670,8 @@
|
||||
// ###END###{Mode-NodeWebkit}
|
||||
}
|
||||
|
||||
function termPaste() { terminal.m.TermSendKeys(d3pastetextarea.value) }
|
||||
function termSendKey(k) { terminal.m.TermSendKey(k) }
|
||||
function termPaste() { terminal.m.TermSendKeys(d3pastetextarea.value); return false; }
|
||||
function termSendKey(k) { terminal.m.TermSendKey(k); return false; }
|
||||
|
||||
// ###BEGIN###{TerminalSize}
|
||||
function termToggleSize() {
|
||||
@@ -8401,7 +8401,7 @@
|
||||
h = '<div class=filelist file=999><input file=999 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="' + f.nx + '"> <span style=float:right title=\"' + title + '\">' + right + '</span><span><div class=fileIcon' + f.t + '></div><a style=cursor:pointer onclick=p24folderset(\"' + encodeURIComponent(f.nx) + '\")>' + shortname + '</a></span></div>';
|
||||
} else {
|
||||
var link = shortname;
|
||||
if (f.s > 0) { link = '<a rel=\"noreferrer noopener\" target=\"_blank\" style=cursor:pointer onclick=\"p24downloadfile("' + encodeURIComponent(newlinkpath + '/' + name) + '","' + encodeURIComponent(name) + '",' + f.s + ')\">' + shortname + '</a>'; }
|
||||
if (f.s > 0) { link = '<a rel=\"noreferrer noopener\" target=\"_blank\" style=cursor:pointer onclick=\'p24downloadfile("' + encodeURIComponent(newlinkpath + '/' + name) + '","' + encodeURIComponent(name) + '",' + f.s + ')\'>' + shortname + '</a>'; }
|
||||
h = '<div class=filelist file=3><input file=3 style=float:left name=fd class=fcb type=checkbox onchange=p24setActions() value="' + f.nx + '"> <span class=fsize>' + fdatestr + '</span><span style=float:right>' + fsize + '</span><span><div class=fileIcon' + f.t + '></div>' + link + '</span></div>';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user