Added typing feature to integrated RDP.

Ylian Saint-Hilaire committed May 5, 2022 at 17:42 UTC 6a35eb61a4e22598e2137c638797fb02bff9d780
3 files changed +24 -2
apprelays.js
+15
@@ -291,6 +291,21 @@ module.exports.CreateMstscRelay = function (parent, db, ws, req, args, domain) {
291 case 'wheel': { if (rdpClient) { rdpClient.sendWheelEvent(msg[1], msg[2], msg[3], msg[4]); } break; }
292 case 'scancode': { if (rdpClient) { rdpClient.sendKeyEventScancode(msg[1], msg[2]); } break; }
293 case 'unicode': { if (rdpClient) { rdpClient.sendKeyEventUnicode(msg[1], msg[2]); } break; }
294 + case 'utype': {
295 + if (!rdpClient) return;
296 + obj.utype = msg[1];
297 + if (obj.utypetimer == null) {
298 + obj.utypetimer = setInterval(function () {
299 + if ((obj.utype == null) || (obj.utype.length == 0)) { clearInterval(obj.utypetimer); obj.utypetimer = null; return; }
300 + var c = obj.utype.charCodeAt(0);
301 + obj.utype = obj.utype.substring(1);
302 + if (c == 13) return;
303 + if (c == 10) { rdpClient.sendKeyEventScancode(28, true); rdpClient.sendKeyEventScancode(28, false); }
304 + else { rdpClient.sendKeyEventUnicode(c, true); rdpClient.sendKeyEventUnicode(c, false); }
305 + }, 5);
306 + }
307 + break;
308 + }
309 case 'ping': { try { obj.wsClient.send('{"ctrlChannel":102938,"type":"ping"}'); } catch (ex) { } break; }
310 case 'pong': { try { obj.wsClient.send('{"ctrlChannel":102938,"type":"pong"}'); } catch (ex) { } break; }
311 case 'disconnect': { obj.close(); break; }
public/scripts/agent-rdp-0.0.1.js
+5 -1
@@ -174,9 +174,13 @@ var CreateRDPDesktop = function (canvasid) {
174 e.preventDefault();
175 return false;
176 }
177 + obj.m.SendStringUnicode = function (txt) {
178 + if (!obj.socket || (obj.State != 3)) return;
179 + obj.socket.send(JSON.stringify(['utype', txt]));
180 + }
181 obj.m.mousedblclick = function () { }
182 obj.m.handleKeyPress = function () { }
183 obj.m.setRotation = function () { }
180 -
184 +
185 return obj;
186 }
views/default.handlebars
+4 -1
@@ -8330,7 +8330,7 @@
8330 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
8331 QE('DeskESC', (deskState == 3) && (desktop.contype != 4));
8332 QV('DeskESC', browserfullscreen && inputAllowed);
8333 - QE('DeskType', (deskState == 3) && (desktop.contype != 4));
8333 + QE('DeskType', (deskState == 3)); // && (desktop.contype != 4)
8334 QV('DeskType', inputAllowed);
8335 QE('DeskWD', (deskState == 3) && (desktop.contype != 4));
8336 QV('DeskWD', inputAllowed);
@@ -9260,6 +9260,9 @@
9260 if (desktop) { desktop.m.sendkey(key[0], key[1]); }
9261 if ((desktop == null) || (AmtDeskTypeContent.length == 0)) { clearInterval(AmtDeskTypeTimer); AmtDeskTypeContent = null; }
9262 }, 10);
9263 + } else if (desktop.contype == 4) {
9264 + // RDP
9265 + desktop.m.SendStringUnicode(txt);
9266 } else {
9267 // MeshAgent
9268 if (desktopsettings.remotekeymap !== true) {