1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2025-07-27 02:59:47 +02:00

use web assembly and web worker for data decoder

This commit is contained in:
Xuan Sang LE
2018-09-21 20:03:13 +02:00
3 changed files with 25 additions and 29 deletions

View File

@ -1,4 +1,4 @@
// Generated by CoffeeScript 1.9.3
// Generated by CoffeeScript 1.12.7
(function() {
var APIManager, BaseObject, MarkOn, WVNC, require,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
@ -247,17 +247,12 @@
return sendMouseLocation(e);
});
me.canvas.onkeydown = me.canvas.onkeyup = me.canvas.onkeypress = function(e) {
var code;
if (e.key === "Shift") {
code = 16;
} else if (e.ctrlKey) {
code = 17;
} else if (e.altKey) {
code = 18;
} else if (e.metaKey) {
code = 91;
var code, keycode;
keycode = e.keyCode;
if ((keycode > 47 && keycode < 58) || (keycode > 64 && keycode < 91) || (keycode > 95 && keycode < 112) || (keycode > 185 && keycode < 193) || (keycode > 218 && keycode < 223)) {
code = e.key.charCodeAt(0);
} else {
code = String.charCodeAt(e.key);
code = keycode;
}
if (e.type === "keydown") {
me.sendKeyEvent(code, 1);
@ -337,7 +332,7 @@
WVNC.prototype.initConnection = function() {
var data, rate, vncserver;
vncserver = "localhost:5901";
vncserver = "192.168.1.20:5901";
data = new Uint8Array(vncserver.length + 5);
data[0] = 32;
@ -379,7 +374,7 @@
data = new Uint8Array(2);
data[0] = code;
data[1] = v;
console.log(String.fromCharCode(code), v);
console.log(code, v);
return this.socket.send(this.buildCommand(0x06, data));
};
@ -415,7 +410,7 @@
return console.log("Error", dec.decode(data));
case 0x81:
console.log("Request for password");
pass = "!x$@n9";
pass = "lxsan9";
return this.socket.send(this.buildCommand(0x02, pass));
case 0x82:
console.log("Request for login");