More work on RDP integration to Desktop tab.

This commit is contained in:
Ylian Saint-Hilaire 2022-05-03 13:31:58 -07:00
parent 96dab9ab3e
commit 3d549dc187
4 changed files with 28 additions and 19 deletions

View File

@ -244,6 +244,7 @@ function run(argv) {
console.log('Starts MicroLMS on this computer, allowing local access to Intel AMT on TCP ports 16992 and 16993 when applicable. The command must be run on a computer with Intel AMT, must run as administrator and the Intel management driver must be installed. These certificates hashes are used by Intel AMT when performing activation into ACM mode. Example usage:\r\n\r\n meshcmd microlms');
console.log('\r\nPossible arguments:\r\n');
console.log(' --noconsole MeshCommander for LMS will no be available on port 16994.');
console.log(' --bindany Bind to all network interfaces.');
console.log('\r\nRun as a background service:\r\n');
console.log(' microlms install/uninstall/start/stop.');
} else if (action == 'amtccm') {
@ -1586,7 +1587,7 @@ function startLms(func, lmscommander, tag) {
amtMei.on('error', function (e) { console.log('startLms() error: ' + e); exit(1); return; });
//console.log("PTHI Connected.");
try { amtLms = new lme_heci({ debug: settings.lmsdebug }); } catch (ex) { if (func != null) { func(0, tag); } return; }
try { amtLms = new lme_heci({ debug: settings.lmsdebug, bindany: settings.bindany }); } catch (ex) { if (func != null) { func(0, tag); } return; }
amtLms.promise = ret;
amtLms.on('error', function (e) {
//console.log('LME connection failed', e);
@ -1631,7 +1632,7 @@ function startLms(func, lmscommander, tag) {
}
});
return (ret);
return ret;
}
function startMeshCommanderLms() {

View File

@ -118,6 +118,7 @@ var CreateRDPDesktop = function (canvasid) {
obj.m.mousemove = function (e) {
if (!obj.socket || (obj.State != 3)) return;
var m = getMousePosition(e);
if ((m.x < 0) || (m.y < 0) || (m.x > obj.ScreenWidth) || (m.y > obj.ScreenHeight)) return;
obj.mouseNagleData = ['mouse', m.x, m.y, 0, false];
if (obj.mouseNagleTimer == null) { obj.mouseNagleTimer = setTimeout(function () { obj.socket.send(JSON.stringify(obj.mouseNagleData)); obj.mouseNagleTimer = null; }, 50); }
e.preventDefault();
@ -125,16 +126,18 @@ var CreateRDPDesktop = function (canvasid) {
}
obj.m.mouseup = function (e) {
if (!obj.socket || (obj.State != 3)) return;
if (obj.mouseNagleTimer != null) { clearTimeout(obj.mouseNagleTimer); obj.mouseNagleTimer = null; }
var m = getMousePosition(e);
if ((m.x < 0) || (m.y < 0) || (m.x > obj.ScreenWidth) || (m.y > obj.ScreenHeight)) return;
if (obj.mouseNagleTimer != null) { clearTimeout(obj.mouseNagleTimer); obj.mouseNagleTimer = null; }
obj.socket.send(JSON.stringify(['mouse', m.x, m.y, mouseButtonMap(e.button), false]));
e.preventDefault();
return false;
}
obj.m.mousedown = function (e) {
if (!obj.socket || (obj.State != 3)) return;
if (obj.mouseNagleTimer != null) { clearTimeout(obj.mouseNagleTimer); obj.mouseNagleTimer = null; }
var m = getMousePosition(e);
if ((m.x < 0) || (m.y < 0) || (m.x > obj.ScreenWidth) || (m.y > obj.ScreenHeight)) return;
if (obj.mouseNagleTimer != null) { clearTimeout(obj.mouseNagleTimer); obj.mouseNagleTimer = null; }
obj.socket.send(JSON.stringify(['mouse', m.x, m.y, mouseButtonMap(e.button), true]));
e.preventDefault();
return false;

View File

@ -145,7 +145,7 @@ Type.prototype.read = function(s) {
if(oldValue !== this.value) {
log.error('constant value mismatch ' + oldValue + ' != ' + this.value);
throw new error.ProtocolError("NODE_RDP_CORE_TYPE_CONSTANT_VALUE_MISMATCH", oldValue, this.value);
throw new error.ProtocolError("NODE_RDP_CORE_TYPE_CONSTANT_VALUE_MISMATCH, OLD:" + oldValue + ", NEW:" + this.value);
}
}
else {

View File

@ -88,10 +88,9 @@
<div class="cmtext" onclick="cmtermaction(100,event)">Login Shell</div>
</div>
<div id="deskConnectContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
<div id="deskConnectContextMenu1" class="cmtext" onclick="cmdeskaction(1,event)">Ask Consent + Bar</div>
<div id="deskConnectContextMenu2" class="cmtext" onclick="cmdeskaction(2,event)">Ask Consent</div>
<div id="deskConnectContextMenu3" class="cmtext" onclick="cmdeskaction(3,event)">Privacy Bar</div>
<div id="deskConnectContextMenu4" class="cmtext" onclick="cmdeskaction(4,event)">RDP</div>
<div class="cmtext" onclick="cmdeskaction(1,event)">Ask Consent + Bar</div>
<div class="cmtext" onclick="cmdeskaction(2,event)">Ask Consent</div>
<div class="cmtext" onclick="cmdeskaction(3,event)">Privacy Bar</div>
</div>
<div id="deskDisconnectContextMenu" class="contextMenu noselect" style="display:none;min-width:0px">
<div class="cmtext" onclick="cmdeskaction(10,event)">Disconnect and Lock</div>
@ -646,7 +645,13 @@
<div id="desktopCustomUiButtons" style="float:left"></div>
</div>
<div>
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none;margin-right:4px" /><span id=connectbutton1span style="margin-right:4px"><input type=button id=connectbutton1 cmenu="deskConnectButton" value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span><span id=connectbutton1hspan style="margin-right:4px"><input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel&reg; AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span><span id=disconnectbutton1span style="margin-right:4px"><input type=button id=disconnectbutton1 cmenu="deskDisconnectButton" value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span><span id="deskstatus" style="line-height:22px">Disconnected</span><span id="deskmetadata"></span>
<input type="button" id="autoconnectbutton1" value="AutoConnect" onclick=autoConnectDesktop(event) onkeypress="return false" onkeydown="return false" style="display:none;margin-right:4px" />
<span id=connectbutton1span><input type=button id=connectbutton1 cmenu="deskConnectButton" title="Connect using MeshAgent remote desktop" value="Connect" onclick=connectDesktop(event,3) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
<span id=connectbutton1rspan><input type=button id=connectbutton1r cmenu="altPortContextMenu" value="RDP Connect" title="Connect using RDP" onclick=askRdpCredentials() onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
<span id=connectbutton1hspan><input type=button id=connectbutton1h value="HW Connect" title="Connect using Intel&reg; AMT hardware KVM" onclick=connectDesktop(event,2) onkeypress="return false" onkeydown="return false" disabled="disabled" /></span>
<span id=disconnectbutton1span><input type=button id=disconnectbutton1 cmenu="deskDisconnectButton" value="Disconnect" onclick=connectDesktop(event,0) onkeypress="return false" onkeydown="return false" /></span>
<span id="deskstatus" style="line-height:22px">Disconnected</span>
<span id="deskmetadata"></span>
</div>
</div>
<div id=deskarea3x>
@ -5778,10 +5783,6 @@
// Desktop connect button context menu
if ((currentNode == null) || (currentNode.agent == null)) return true;
contextelement = elem;
QV('deskConnectContextMenu1', currentNode.mtype == 2); // Ask Consent + Bar
QV('deskConnectContextMenu2', currentNode.mtype == 2); // Ask Consent
QV('deskConnectContextMenu3', currentNode.mtype == 2); // Privacy Bar
QV('deskConnectContextMenu4', (currentNode.agent.id == 3) || (currentNode.agent.id == 4)); // RDP
showContextMenuDiv(document.getElementById('deskConnectContextMenu'), event.pageX, event.pageY);
break;
}
@ -7157,7 +7158,7 @@
// mesh.mtype: 1 = Intel AMT only, 2 = Mesh Agent, 3 = Local Device
// node.agent.caps (bitmask): 1 = Desktop, 2 = Terminal, 4 = Files, 8 = Console
QV('MainDevDesktop', desktopAccess && ((((node.agent == null) && (node.intelamt != null) && ((typeof node.intelamt.sku !== 'number') || ((node.intelamt.sku & 8) != 0)))
|| ((node.agent != null) && ((node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2)))))
|| ((node.agent != null) && ((node.agent.caps == null) || ((node.agent.caps & 1) != 0) || (node.intelamt && (node.intelamt.state == 2)))) || ((node.mtype == 3) && ((node.agent.id == 3) || (node.agent.id == 4))))
&& ((meshrights & 8) || (meshrights & 256)))
);
QV('MainDevTerminal', (((node.agent == null) && (node.intelamt != null)) || ((node.agent) && (node.agent.caps == null)) || ((node.agent) && ((node.agent.caps & 2) != 0)) || (node.intelamt && (node.intelamt.state == 2))) && (meshrights & 8) && terminalAccess);
@ -8251,6 +8252,7 @@
// Show the right buttons
QV('disconnectbutton1span', (deskState != 0));
QV('connectbutton1span', (deskState == 0) && ((rights & 8) || (rights & 256)) && (currentNode.agent != null) && (currentNode.agent.caps & 1));
QV('connectbutton1rspan', ((features & 0x40000000) == 0) && (deskState == 0) && (rights & 8) && (currentNode.agent != null) && ((currentNode.agent.id == 4) || (currentNode.agent.id == 5)));
if (mtype == 1) {
QV('connectbutton1hspan',
(deskState == 0) &&
@ -8282,6 +8284,7 @@
var inputAllowed = ((features2 & 0x2000) == 0) && ((currentNode.agent == null) || (currentNode.agent.id != 14)) && ((rights == 0xFFFFFFFF) || (((rights & 8) != 0) && ((rights & 256) == 0) && ((rights & 4096) == 0)));
var online = ((currentNode.conn & 1) != 0); // If Agent (1) connected, enable remote desktop
QE('connectbutton1', online);
QE('connectbutton1r', online || (currentNode.mtype == 3));
var hwonline = ((currentNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal
QE('connectbutton1h', hwonline);
QV('deskFocusBtn', (desktop != null) && (desktop.contype == 2) && (deskState != 0) && (desktopsettings.showfocus));
@ -8298,9 +8301,9 @@
QV('DeskTimer', deskState == 3);
// Enable browser clipboard read if supported
QV('DeskClipboardOutButton', online && inputAllowed && ((features2 & 0x1000) == 0) && (navigator.clipboard != null) && (navigator.clipboard.readText != null) && ((desktopsettings.autoclipboard != true) || (navigator.clipboard == null) || (navigator.clipboard.readText == null)));
QV('DeskClipboardOutButton', online && inputAllowed && ((desktop == null) || (desktop.contype != 4)) && ((features2 & 0x1000) == 0) && (navigator.clipboard != null) && (navigator.clipboard.readText != null) && ((desktopsettings.autoclipboard != true) || (navigator.clipboard == null) || (navigator.clipboard.readText == null)));
QV('d7deskAutoClipboardLabel', (navigator.clipboard.readText != null) && ((features2 & 0x1000) == 0));
QV('DeskClipboardInButton', online && inputAllowed && ((features2 & 0x0800) == 0) && (navigator.clipboard != null) && (navigator.clipboard.writeText != null) && ((desktopsettings.autoclipboard != true) || (navigator.clipboard == null) || (navigator.clipboard.readText == null)));
QV('DeskClipboardInButton', online && inputAllowed && ((desktop == null) || (desktop.contype != 4)) && ((features2 & 0x0800) == 0) && (navigator.clipboard != null) && (navigator.clipboard.writeText != null) && ((desktopsettings.autoclipboard != true) || (navigator.clipboard == null) || (navigator.clipboard.readText == null)));
if (deskState != 3) {
QV('DeskInputLockedButton', false);
@ -8510,7 +8513,7 @@
x += addHtmlValue("Domain", '<input type=text id=d2domain style=width:230px maxlength=128 />');
x += addHtmlValue("Username", '<input type=text id=d2user style=width:230px onKeyUp=askRdpCredentialsValidate() maxlength=128 />');
x += addHtmlValue("Password", '<input type=password id=d2pass style=width:230px maxlength=128 autocomplete=off />');
x += addHtmlValue("", '<label><input type="checkbox" id=d2savecred>' + "Remember credentials" + '</label>');
if ((features2 & 0x00400000) == 0) { x += addHtmlValue("", '<label><input type="checkbox" id=d2savecred>' + "Remember credentials" + '</label>'); }
x + '</div></div>';
setDialogMode(2, "RDP Credentials", 3, askRdpCredentialsEx, x);
}
@ -8525,7 +8528,9 @@
if ((currentNode.rdp == 1) && (Q('d2mode').value == 1)) {
connectDesktop(null, 4, { servercred: true });
} else {
connectDesktop(null, 4, { domain: Q('d2domain').value, username: Q('d2user').value, password: Q('d2pass').value, savecred: Q('d2savecred').checked });
savecred = false;
if ((features2 & 0x00400000) == 0) { savecred = Q('d2savecred').checked; }
connectDesktop(null, 4, { domain: Q('d2domain').value, username: Q('d2user').value, password: Q('d2pass').value, savecred: savecred });
}
}