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 04caa8bd1c
commit 51edb8485d
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]); const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
if ((nodeVersion < 8) || (require('crypto').generateKeyPair == null) || (obj.config.letsencrypt == null) || (obj.redirserver == null)) { if ((nodeVersion < 8) || (require('crypto').generateKeyPair == null) || (obj.config.letsencrypt == null) || (obj.redirserver == null)) {
obj.StartEx3(certs); // Just use the configured certificates 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 { } else {
// Check Let's Encrypt settings // Check Let's Encrypt settings
var leok = true; var leok = true;

View File

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

View File

@ -32,9 +32,7 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.firstUpKeys = []; obj.firstUpKeys = [];
obj.stopInput = false; obj.stopInput = false;
obj.localKeyMap = true; obj.localKeyMap = true;
obj.altPressed = false; obj.pressedKeys = [];
obj.ctrlPressed = false;
obj.shiftPressed = false;
obj.sessionid = 0; obj.sessionid = 0;
obj.username; obj.username;
@ -421,7 +419,15 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
//console.log('SendKeyMsgKC', action, kc); //console.log('SendKeyMsgKC', action, kc);
if (obj.State != 3) return; if (obj.State != 3) return;
if (typeof action == 'object') { for (var i in action) { obj.SendKeyMsgKC(action[i][0], action[i][1]); } } 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(); } obj.sendcad = function() { obj.SendCtrlAltDelMsg(); }
@ -547,25 +553,17 @@ var CreateAgentRemoteDesktop = function (canvasid, scrolldiv) {
obj.firstUpKeys.push(e.keyCode); 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 ((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); return obj.xxKeyUp(e);
} }
obj.handleKeyDown = function (e) { obj.handleKeyDown = function (e) {
if (obj.stopInput == true || desktop.State != 3) return false; 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); return obj.xxKeyDown(e);
} }
// Release the CTRL, ALT, SHIFT keys if they are pressed. // Release the CTRL, ALT, SHIFT keys if they are pressed.
obj.handleReleaseKeys = function () { obj.handleReleaseKeys = function () {
if (obj.shiftPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 16); } // Shift var p = JSON.parse(JSON.stringify(obj.pressedKeys)); // Clone the pressed array
if (obj.ctrlPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 17); } // Ctrl for (var i in p) { obj.SendKeyMsgKC(obj.KeyAction.UP, p[i]); } // Release all keys
if (obj.altPressed) { obj.SendKeyMsgKC(obj.KeyAction.UP, 18); } // Alt
obj.shiftPressed = obj.ctrlPressed = obj.altPressed = false;
} }
// Mouse handlers // Mouse handlers