Fixed desktop mouse/keyboard issue.
Ylian Saint-Hilaire committed
Jan 19, 2020 at 10:41 UTC
a9fc191fd6390fe106d7f6cf869fa7f789ad7225
3 files changed
+3
-64
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.7-k",
3
+ "version": "0.4.7-l",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",
public/scripts/agent-redir-ws-0.1.1.js
-61
@@ -220,71 +220,11 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
220
return obj.m.ProcessData(data);
221
}
222
223
- // TODO: Optimize this
224
- function toUTF8Array(str) {
225
- var utf8 = [];
226
- for (var i = 0; i < str.length; i++) {
227
- var charcode = str.charCodeAt(i);
228
- if (charcode < 0x80) utf8.push(charcode);
229
- else if (charcode < 0x800) {
230
- utf8.push(0xc0 | (charcode >> 6),
231
- 0x80 | (charcode & 0x3f));
232
- }
233
- else if (charcode < 0xd800 || charcode >= 0xe000) {
234
- utf8.push(0xe0 | (charcode >> 12),
235
- 0x80 | ((charcode >> 6) & 0x3f),
236
- 0x80 | (charcode & 0x3f));
237
- }
238
- // surrogate pair
239
- else {
240
- i++;
241
- charcode = ((charcode & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff)
242
- utf8.push(0xf0 | (charcode >> 18),
243
- 0x80 | ((charcode >> 12) & 0x3f),
244
- 0x80 | ((charcode >> 6) & 0x3f),
245
- 0x80 | (charcode & 0x3f));
246
- }
247
- }
248
-
249
- var ret = new Uint8Array(utf8.length);
250
- for (i = 0; i < utf8.length; ++i) {
251
- ret[i] = utf8[i];
252
- }
253
- return ret;
254
- }
255
-
223
obj.sendText = function (x) {
224
if (typeof x != 'string') { x = JSON.stringify(x); } // Turn into a string if needed
225
obj.send(encode_utf8(x)); // Encode UTF8 correctly
226
}
227
261
- // TODO: Optimize this
262
- obj.send = function (x) {
263
- //obj.debug('Agent Redir Send(' + obj.webRtcActive + ', ' + x.length + '): ' + rstr2hex(x));
264
- //console.log('Agent Redir Send(' + obj.webRtcActive + ', ' + x.length + '): ' + ((typeof x == 'string')?x:rstr2hex(x)));
265
- if ((typeof args != 'undefined') && args.redirtrace) { console.log('RedirSend', typeof x, x.length, (x[0] == '{') ? x : rstr2hex(x).substring(0, 64)); }
266
- try {
267
- if (obj.socket != null && obj.socket.readyState == WebSocket.OPEN) {
268
- if (typeof x == 'string') {
269
- if (obj.debugmode == 1) {
270
- var b = new Uint8Array(x.length), c = [];
271
- for (var i = 0; i < x.length; ++i) { b[i] = x.charCodeAt(i); c.push(x.charCodeAt(i)); }
272
- if (obj.webRtcActive == true) { obj.webchannel.send(b.buffer); } else { obj.socket.send(toUTF8Array(x));/*obj.socket.send(b.buffer);*/ }
273
- //console.log('Send', c);
274
- } else {
275
- var b = new Uint8Array(x.length);
276
- for (var i = 0; i < x.length; ++i) { b[i] = x.charCodeAt(i); }
277
- if (obj.webRtcActive == true) { obj.webchannel.send(b.buffer); } else { obj.socket.send(toUTF8Array(x)); /*obj.socket.send(b.buffer); */ }
278
- }
279
- } else {
280
- //if (obj.debugmode == 1) { console.log('Send', x); }
281
- if (obj.webRtcActive == true) { obj.webchannel.send(x); } else { obj.socket.send(toUTF8Array(x)); /*obj.socket.send(x);*/ }
282
- }
283
- }
284
- } catch (ex) { }
285
- }
286
-
287
- /*
228
obj.send = function (x) {
229
//obj.debug('Agent Redir Send(' + obj.webRtcActive + ', ' + x.length + '): ' + rstr2hex(x));
230
//console.log('Agent Redir Send(' + obj.webRtcActive + ', ' + x.length + '): ' + ((typeof x == 'string')?x:rstr2hex(x)));
@@ -309,7 +249,6 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
249
}
250
} catch (ex) { }
251
}
312
- */
252
253
obj.xxOnSocketClosed = function () {
254
//obj.debug('Agent Redir Socket Closed');
public/scripts/amt-terminal-0.0.2.js
+2
-2
@@ -644,8 +644,8 @@ var CreateAmtRemoteTerminal = function (divid, options) {
644
}
645
}
646
647
- obj.TermSendKeys = function (keys) { if (obj.debugmode == 2) { console.log("TSend(" + keys.length + "): " + rstr2hex(keys), keys); } obj.parent.send(keys); }
648
- obj.TermSendKey = function (key) { if (obj.debugmode == 2) { console.log("TSend(1): " + rstr2hex(String.fromCharCode(key)), key); } obj.parent.send(String.fromCharCode(key)); }
647
+ obj.TermSendKeys = function (keys) { if (obj.debugmode == 2) { console.log("TSend(" + keys.length + "): " + rstr2hex(keys), keys); } obj.parent.sendText(keys); }
648
+ obj.TermSendKey = function (key) { if (obj.debugmode == 2) { console.log("TSend(1): " + rstr2hex(String.fromCharCode(key)), key); } obj.parent.sendText(String.fromCharCode(key)); }
649
650
function _TermMoveUp(linecount) {
651
var x, y;