Added typing feature to integrated RDP.

This commit is contained in:
Ylian Saint-Hilaire 2022-05-05 17:42:40 -07:00
parent 1eb1195c7a
commit 6a35eb61a4
3 changed files with 24 additions and 2 deletions

View File

@ -291,6 +291,21 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) {
case 'wheel': { if (rdpClient) { rdpClient.sendWheelEvent(msg[1], msg[2], msg[3], msg[4]); } break; }
case 'scancode': { if (rdpClient) { rdpClient.sendKeyEventScancode(msg[1], msg[2]); } break; }
case 'unicode': { if (rdpClient) { rdpClient.sendKeyEventUnicode(msg[1], msg[2]); } break; }
case 'utype': {
if (!rdpClient) return;
obj.utype = msg[1];
if (obj.utypetimer == null) {
obj.utypetimer = setInterval(function () {
if ((obj.utype == null) || (obj.utype.length == 0)) { clearInterval(obj.utypetimer); obj.utypetimer = null; return; }
var c = obj.utype.charCodeAt(0);
obj.utype = obj.utype.substring(1);
if (c == 13) return;
if (c == 10) { rdpClient.sendKeyEventScancode(28, true); rdpClient.sendKeyEventScancode(28, false); }
else { rdpClient.sendKeyEventUnicode(c, true); rdpClient.sendKeyEventUnicode(c, false); }
}, 5);
}
break;
}
case 'ping': { try { obj.wsClient.send('{"ctrlChannel":102938,"type":"ping"}'); } catch (ex) { } break; }
case 'pong': { try { obj.wsClient.send('{"ctrlChannel":102938,"type":"pong"}'); } catch (ex) { } break; }
case 'disconnect': { obj.close(); break; }

View File

@ -174,6 +174,10 @@ var CreateRDPDesktop = function (canvasid) {
e.preventDefault();
return false;
}
obj.m.SendStringUnicode = function (txt) {
if (!obj.socket || (obj.State != 3)) return;
obj.socket.send(JSON.stringify(['utype', txt]));
}
obj.m.mousedblclick = function () { }
obj.m.handleKeyPress = function () { }
obj.m.setRotation = function () { }

View File

@ -8330,7 +8330,7 @@
QV('DeskClip', (inputAllowed) && (currentNode.agent) && ((features2 & 0x1800) != 0x1800) && (currentNode.agent.id != 11) && (currentNode.agent.id != 16) && ((desktop == null) || (desktop.contype != 2)) && ((desktopsettings.autoclipboard != true) || (navigator.clipboard == null) || (navigator.clipboard.readText == null))); // Clipboard not supported on macOS
QE('DeskESC', (deskState == 3) && (desktop.contype != 4));
QV('DeskESC', browserfullscreen && inputAllowed);
QE('DeskType', (deskState == 3) && (desktop.contype != 4));
QE('DeskType', (deskState == 3)); // && (desktop.contype != 4)
QV('DeskType', inputAllowed);
QE('DeskWD', (deskState == 3) && (desktop.contype != 4));
QV('DeskWD', inputAllowed);
@ -9260,6 +9260,9 @@
if (desktop) { desktop.m.sendkey(key[0], key[1]); }
if ((desktop == null) || (AmtDeskTypeContent.length == 0)) { clearInterval(AmtDeskTypeTimer); AmtDeskTypeContent = null; }
}, 10);
} else if (desktop.contype == 4) {
// RDP
desktop.m.SendStringUnicode(txt);
} else {
// MeshAgent
if (desktopsettings.remotekeymap !== true) {