Improved remote desktop key release, added Let's Encrypt nochecks:true.

This commit is contained in:
Ylian Saint-Hilaire 2020-02-06 18:04:55 -08:00
parent 21162cab72
commit e9dd9dc270
3 changed files with 17 additions and 15 deletions

View File

@ -1050,6 +1050,10 @@ function CreateMeshCentralServer(config, args) {
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if ((nodeVersion < 8) || (require('crypto').generateKeyPair == null) || (obj.config.letsencrypt == null) || (obj.redirserver == null)) {
obj.StartEx3(certs); // Just use the configured certificates
} else if ((obj.config.letsencrypt != null) && (obj.config.letsencrypt.nochecks == true)) {
// Use Let's Encrypt with no checking
obj.letsencrypt = require('./letsencrypt.js').CreateLetsEncrypt(obj);
obj.letsencrypt.getCertificate(certs, obj.StartEx3); // Use Let's Encrypt with no checking, use at your own risk.
} else {
// Check Let's Encrypt settings
var leok = true;

View File

@ -1,6 +1,6 @@
{
"name": "meshcentral",
"version": "0.4.8-r",
"version": "0.4.8-t",
"keywords": [
"Remote Management",
"Intel AMT",

View File

@ -32,9 +32,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.firstUpKeys = [];
obj.stopInput = false;
obj.localKeyMap = true;
obj.altPressed = false;
obj.ctrlPressed = false;
obj.shiftPressed = false;
obj.pressedKeys = [];
obj.sessionid = 0;
obj.username;
@ -421,7 +419,15 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
//console.log('SendKeyMsgKC', action, kc);
if (obj.State != 3) return;
if (typeof action == 'object') { for (var i in action) { obj.SendKeyMsgKC(action[i][0], action[i][1]); } }
else { obj.send(String.fromCharCode(0x00, obj.InputType.KEY, 0x00, 0x06, (action - 1), kc)); }
else {
if (action == 1) { // Key Down
if (obj.pressedKeys.indexOf(kc) == -1) { obj.pressedKeys.unshift(kc); } // Add key press to start of array
} else if (action == 2) { // Key Up
var i = obj.pressedKeys.indexOf(kc);
if (i != -1) { obj.pressedKeys.splice(i, 1); } // Remove the key press from the pressed array
}
obj.send(String.fromCharCode(0x00, obj.InputType.KEY, 0x00, 0x06, (action - 1), kc));
}
}
obj.sendcad = function() { obj.SendCtrlAltDelMsg(); }
@ -547,25 +553,17 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.firstUpKeys.push(e.keyCode);
if ((obj.firstUpKeys.length == 5)) { var j = obj.firstUpKeys.join(','); if ((j == '16,17,91,91,16') || (j == '16,17,18,91,92')) { obj.stopInput = true; } }
}
if (e.keyCode == 16) { obj.shiftPressed = false; }
if (e.keyCode == 17) { obj.ctrlPressed = false; }
if (e.keyCode == 18) { obj.altPressed = false; }
return obj.xxKeyUp(e);
}
obj.handleKeyDown = function (e) {
if (obj.stopInput == true || desktop.State != 3) return false;
if (e.keyCode == 16) { obj.shiftPressed = true; }
if (e.keyCode == 17) { obj.ctrlPressed = true; }
if (e.keyCode == 18) { obj.altPressed = true; }
return obj.xxKeyDown(e);
}
// Release the CTRL, ALT, SHIFT keys if they are pressed.
obj.handleReleaseKeys = function () {
if (obj.shiftPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 16); } // Shift
if (obj.ctrlPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 17); } // Ctrl
if (obj.altPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 18); } // Alt
obj.shiftPressed = obj.ctrlPressed = obj.altPressed = false;
var p = JSON.parse(JSON.stringify(obj.pressedKeys)); // Clone the pressed array
for (var i in p) { obj.SendKeyMsgKC(obj.KeyAction.UP, p[i]); } // Release all keys
}
// Mouse handlers