@novnc/novnc 1.3.0-beta → 1.3.0-g1075cd8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +13 -3
  2. package/core/decoders/jpeg.js +141 -0
  3. package/core/decoders/raw.js +1 -1
  4. package/core/decoders/zrle.js +185 -0
  5. package/core/encodings.js +4 -0
  6. package/core/ra2.js +567 -0
  7. package/core/rfb.js +219 -8
  8. package/core/util/md5.js +79 -0
  9. package/docs/API.md +44 -4
  10. package/lib/base64.js +1 -1
  11. package/lib/decoders/copyrect.js +1 -1
  12. package/lib/decoders/hextile.js +2 -2
  13. package/lib/decoders/jpeg.js +188 -0
  14. package/lib/decoders/raw.js +2 -2
  15. package/lib/decoders/rre.js +1 -1
  16. package/lib/decoders/tight.js +2 -2
  17. package/lib/decoders/tightpng.js +3 -3
  18. package/lib/decoders/zrle.js +234 -0
  19. package/lib/deflator.js +1 -1
  20. package/lib/des.js +1 -1
  21. package/lib/display.js +2 -2
  22. package/lib/encodings.js +8 -0
  23. package/lib/inflator.js +1 -1
  24. package/lib/input/gesturehandler.js +1 -1
  25. package/lib/input/keyboard.js +2 -2
  26. package/lib/input/util.js +2 -2
  27. package/lib/ra2.js +1257 -0
  28. package/lib/rfb.js +373 -27
  29. package/lib/util/browser.js +10 -6
  30. package/lib/util/cursor.js +1 -1
  31. package/lib/util/events.js +2 -2
  32. package/lib/util/eventtarget.js +1 -1
  33. package/lib/util/int.js +1 -1
  34. package/lib/util/logging.js +2 -2
  35. package/lib/util/md5.js +103 -0
  36. package/lib/vendor/pako/lib/utils/common.js +2 -2
  37. package/lib/vendor/pako/lib/zlib/deflate.js +6 -5
  38. package/lib/vendor/pako/lib/zlib/inffast.js +6 -2
  39. package/lib/vendor/pako/lib/zlib/inflate.js +41 -18
  40. package/lib/vendor/pako/lib/zlib/inftrees.js +1 -1
  41. package/lib/vendor/pako/lib/zlib/trees.js +3 -3
  42. package/lib/websock.js +2 -2
  43. package/package.json +2 -7
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+
10
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
+
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+
14
+ /*
15
+ * noVNC: HTML5 VNC client
16
+ * Copyright (C) 2019 The noVNC Authors
17
+ * Licensed under MPL 2.0 (see LICENSE.txt)
18
+ *
19
+ * See README.md for usage and integration instructions.
20
+ *
21
+ */
22
+ var JPEGDecoder = /*#__PURE__*/function () {
23
+ function JPEGDecoder() {
24
+ _classCallCheck(this, JPEGDecoder);
25
+
26
+ // RealVNC will reuse the quantization tables
27
+ // and Huffman tables, so we need to cache them.
28
+ this._quantTables = [];
29
+ this._huffmanTables = [];
30
+ this._cachedQuantTables = [];
31
+ this._cachedHuffmanTables = [];
32
+ this._jpegLength = 0;
33
+ this._segments = [];
34
+ }
35
+
36
+ _createClass(JPEGDecoder, [{
37
+ key: "decodeRect",
38
+ value: function decodeRect(x, y, width, height, sock, display, depth) {
39
+ // A rect of JPEG encodings is simply a JPEG file
40
+ if (!this._parseJPEG(sock.rQslice(0))) {
41
+ return false;
42
+ }
43
+
44
+ var data = sock.rQshiftBytes(this._jpegLength);
45
+
46
+ if (this._quantTables.length != 0 && this._huffmanTables.length != 0) {
47
+ // If there are quantization tables and Huffman tables in the JPEG
48
+ // image, we can directly render it.
49
+ display.imageRect(x, y, width, height, "image/jpeg", data);
50
+ return true;
51
+ } else {
52
+ // Otherwise we need to insert cached tables.
53
+ var sofIndex = this._segments.findIndex(function (x) {
54
+ return x[1] == 0xC0 || x[1] == 0xC2;
55
+ });
56
+
57
+ if (sofIndex == -1) {
58
+ throw new Error("Illegal JPEG image without SOF");
59
+ }
60
+
61
+ var segments = this._segments.slice(0, sofIndex);
62
+
63
+ segments = segments.concat(this._quantTables.length ? this._quantTables : this._cachedQuantTables);
64
+ segments.push(this._segments[sofIndex]);
65
+ segments = segments.concat(this._huffmanTables.length ? this._huffmanTables : this._cachedHuffmanTables, this._segments.slice(sofIndex + 1));
66
+ var length = 0;
67
+
68
+ for (var i = 0; i < segments.length; i++) {
69
+ length += segments[i].length;
70
+ }
71
+
72
+ var _data = new Uint8Array(length);
73
+
74
+ length = 0;
75
+
76
+ for (var _i = 0; _i < segments.length; _i++) {
77
+ _data.set(segments[_i], length);
78
+
79
+ length += segments[_i].length;
80
+ }
81
+
82
+ display.imageRect(x, y, width, height, "image/jpeg", _data);
83
+ return true;
84
+ }
85
+ }
86
+ }, {
87
+ key: "_parseJPEG",
88
+ value: function _parseJPEG(buffer) {
89
+ if (this._quantTables.length != 0) {
90
+ this._cachedQuantTables = this._quantTables;
91
+ }
92
+
93
+ if (this._huffmanTables.length != 0) {
94
+ this._cachedHuffmanTables = this._huffmanTables;
95
+ }
96
+
97
+ this._quantTables = [];
98
+ this._huffmanTables = [];
99
+ this._segments = [];
100
+ var i = 0;
101
+ var bufferLength = buffer.length;
102
+
103
+ while (true) {
104
+ var j = i;
105
+
106
+ if (j + 2 > bufferLength) {
107
+ return false;
108
+ }
109
+
110
+ if (buffer[j] != 0xFF) {
111
+ throw new Error("Illegal JPEG marker received (byte: " + buffer[j] + ")");
112
+ }
113
+
114
+ var type = buffer[j + 1];
115
+ j += 2;
116
+
117
+ if (type == 0xD9) {
118
+ this._jpegLength = j;
119
+
120
+ this._segments.push(buffer.slice(i, j));
121
+
122
+ return true;
123
+ } else if (type == 0xDA) {
124
+ // start of scan
125
+ var hasFoundEndOfScan = false;
126
+
127
+ for (var k = j + 3; k + 1 < bufferLength; k++) {
128
+ if (buffer[k] == 0xFF && buffer[k + 1] != 0x00 && !(buffer[k + 1] >= 0xD0 && buffer[k + 1] <= 0xD7)) {
129
+ j = k;
130
+ hasFoundEndOfScan = true;
131
+ break;
132
+ }
133
+ }
134
+
135
+ if (!hasFoundEndOfScan) {
136
+ return false;
137
+ }
138
+
139
+ this._segments.push(buffer.slice(i, j));
140
+
141
+ i = j;
142
+ continue;
143
+ } else if (type >= 0xD0 && type < 0xD9 || type == 0x01) {
144
+ // No length after marker
145
+ this._segments.push(buffer.slice(i, j));
146
+
147
+ i = j;
148
+ continue;
149
+ }
150
+
151
+ if (j + 2 > bufferLength) {
152
+ return false;
153
+ }
154
+
155
+ var length = (buffer[j] << 8) + buffer[j + 1] - 2;
156
+
157
+ if (length < 0) {
158
+ throw new Error("Illegal JPEG length received (length: " + length + ")");
159
+ }
160
+
161
+ j += 2;
162
+
163
+ if (j + length > bufferLength) {
164
+ return false;
165
+ }
166
+
167
+ j += length;
168
+ var segment = buffer.slice(i, j);
169
+
170
+ if (type == 0xC4) {
171
+ // Huffman tables
172
+ this._huffmanTables.push(segment);
173
+ } else if (type == 0xDB) {
174
+ // Quantization tables
175
+ this._quantTables.push(segment);
176
+ }
177
+
178
+ this._segments.push(segment);
179
+
180
+ i = j;
181
+ }
182
+ }
183
+ }]);
184
+
185
+ return JPEGDecoder;
186
+ }();
187
+
188
+ exports["default"] = JPEGDecoder;
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /*
15
15
  * noVNC: HTML5 VNC client
@@ -66,7 +66,7 @@ var RawDecoder = /*#__PURE__*/function () {
66
66
 
67
67
 
68
68
  for (var _i = 0; _i < pixels; _i++) {
69
- data[_i * 4 + 3] = 255;
69
+ data[index + _i * 4 + 3] = 255;
70
70
  }
71
71
 
72
72
  display.blitImage(x, curY, width, currHeight, data, index);
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /*
15
15
  * noVNC: HTML5 VNC client
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -21,7 +21,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
21
21
 
22
22
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
23
 
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
25
 
26
26
  var TightDecoder = /*#__PURE__*/function () {
27
27
  function TightDecoder() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -15,9 +15,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
15
15
 
16
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
17
 
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
19
 
20
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
20
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
21
 
22
22
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
23
 
@@ -0,0 +1,234 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+
8
+ var _inflator = _interopRequireDefault(require("../inflator.js"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
+
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
15
+
16
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
17
+
18
+ var ZRLE_TILE_WIDTH = 64;
19
+ var ZRLE_TILE_HEIGHT = 64;
20
+
21
+ var ZRLEDecoder = /*#__PURE__*/function () {
22
+ function ZRLEDecoder() {
23
+ _classCallCheck(this, ZRLEDecoder);
24
+
25
+ this._length = 0;
26
+ this._inflator = new _inflator["default"]();
27
+ this._pixelBuffer = new Uint8Array(ZRLE_TILE_WIDTH * ZRLE_TILE_HEIGHT * 4);
28
+ this._tileBuffer = new Uint8Array(ZRLE_TILE_WIDTH * ZRLE_TILE_HEIGHT * 4);
29
+ }
30
+
31
+ _createClass(ZRLEDecoder, [{
32
+ key: "decodeRect",
33
+ value: function decodeRect(x, y, width, height, sock, display, depth) {
34
+ if (this._length === 0) {
35
+ if (sock.rQwait("ZLib data length", 4)) {
36
+ return false;
37
+ }
38
+
39
+ this._length = sock.rQshift32();
40
+ }
41
+
42
+ if (sock.rQwait("Zlib data", this._length)) {
43
+ return false;
44
+ }
45
+
46
+ var data = sock.rQshiftBytes(this._length);
47
+
48
+ this._inflator.setInput(data);
49
+
50
+ for (var ty = y; ty < y + height; ty += ZRLE_TILE_HEIGHT) {
51
+ var th = Math.min(ZRLE_TILE_HEIGHT, y + height - ty);
52
+
53
+ for (var tx = x; tx < x + width; tx += ZRLE_TILE_WIDTH) {
54
+ var tw = Math.min(ZRLE_TILE_WIDTH, x + width - tx);
55
+ var tileSize = tw * th;
56
+
57
+ var subencoding = this._inflator.inflate(1)[0];
58
+
59
+ if (subencoding === 0) {
60
+ // raw data
61
+ var _data = this._readPixels(tileSize);
62
+
63
+ display.blitImage(tx, ty, tw, th, _data, 0, false);
64
+ } else if (subencoding === 1) {
65
+ // solid
66
+ var background = this._readPixels(1);
67
+
68
+ display.fillRect(tx, ty, tw, th, [background[0], background[1], background[2]]);
69
+ } else if (subencoding >= 2 && subencoding <= 16) {
70
+ var _data2 = this._decodePaletteTile(subencoding, tileSize, tw, th);
71
+
72
+ display.blitImage(tx, ty, tw, th, _data2, 0, false);
73
+ } else if (subencoding === 128) {
74
+ var _data3 = this._decodeRLETile(tileSize);
75
+
76
+ display.blitImage(tx, ty, tw, th, _data3, 0, false);
77
+ } else if (subencoding >= 130 && subencoding <= 255) {
78
+ var _data4 = this._decodeRLEPaletteTile(subencoding - 128, tileSize);
79
+
80
+ display.blitImage(tx, ty, tw, th, _data4, 0, false);
81
+ } else {
82
+ throw new Error('Unknown subencoding: ' + subencoding);
83
+ }
84
+ }
85
+ }
86
+
87
+ this._length = 0;
88
+ return true;
89
+ }
90
+ }, {
91
+ key: "_getBitsPerPixelInPalette",
92
+ value: function _getBitsPerPixelInPalette(paletteSize) {
93
+ if (paletteSize <= 2) {
94
+ return 1;
95
+ } else if (paletteSize <= 4) {
96
+ return 2;
97
+ } else if (paletteSize <= 16) {
98
+ return 4;
99
+ }
100
+ }
101
+ }, {
102
+ key: "_readPixels",
103
+ value: function _readPixels(pixels) {
104
+ var data = this._pixelBuffer;
105
+
106
+ var buffer = this._inflator.inflate(3 * pixels);
107
+
108
+ for (var i = 0, j = 0; i < pixels * 4; i += 4, j += 3) {
109
+ data[i] = buffer[j];
110
+ data[i + 1] = buffer[j + 1];
111
+ data[i + 2] = buffer[j + 2];
112
+ data[i + 3] = 255; // Add the Alpha
113
+ }
114
+
115
+ return data;
116
+ }
117
+ }, {
118
+ key: "_decodePaletteTile",
119
+ value: function _decodePaletteTile(paletteSize, tileSize, tilew, tileh) {
120
+ var data = this._tileBuffer;
121
+
122
+ var palette = this._readPixels(paletteSize);
123
+
124
+ var bitsPerPixel = this._getBitsPerPixelInPalette(paletteSize);
125
+
126
+ var mask = (1 << bitsPerPixel) - 1;
127
+ var offset = 0;
128
+
129
+ var encoded = this._inflator.inflate(1)[0];
130
+
131
+ for (var y = 0; y < tileh; y++) {
132
+ var shift = 8 - bitsPerPixel;
133
+
134
+ for (var x = 0; x < tilew; x++) {
135
+ if (shift < 0) {
136
+ shift = 8 - bitsPerPixel;
137
+ encoded = this._inflator.inflate(1)[0];
138
+ }
139
+
140
+ var indexInPalette = encoded >> shift & mask;
141
+ data[offset] = palette[indexInPalette * 4];
142
+ data[offset + 1] = palette[indexInPalette * 4 + 1];
143
+ data[offset + 2] = palette[indexInPalette * 4 + 2];
144
+ data[offset + 3] = palette[indexInPalette * 4 + 3];
145
+ offset += 4;
146
+ shift -= bitsPerPixel;
147
+ }
148
+
149
+ if (shift < 8 - bitsPerPixel && y < tileh - 1) {
150
+ encoded = this._inflator.inflate(1)[0];
151
+ }
152
+ }
153
+
154
+ return data;
155
+ }
156
+ }, {
157
+ key: "_decodeRLETile",
158
+ value: function _decodeRLETile(tileSize) {
159
+ var data = this._tileBuffer;
160
+ var i = 0;
161
+
162
+ while (i < tileSize) {
163
+ var pixel = this._readPixels(1);
164
+
165
+ var length = this._readRLELength();
166
+
167
+ for (var j = 0; j < length; j++) {
168
+ data[i * 4] = pixel[0];
169
+ data[i * 4 + 1] = pixel[1];
170
+ data[i * 4 + 2] = pixel[2];
171
+ data[i * 4 + 3] = pixel[3];
172
+ i++;
173
+ }
174
+ }
175
+
176
+ return data;
177
+ }
178
+ }, {
179
+ key: "_decodeRLEPaletteTile",
180
+ value: function _decodeRLEPaletteTile(paletteSize, tileSize) {
181
+ var data = this._tileBuffer; // palette
182
+
183
+ var palette = this._readPixels(paletteSize);
184
+
185
+ var offset = 0;
186
+
187
+ while (offset < tileSize) {
188
+ var indexInPalette = this._inflator.inflate(1)[0];
189
+
190
+ var length = 1;
191
+
192
+ if (indexInPalette >= 128) {
193
+ indexInPalette -= 128;
194
+ length = this._readRLELength();
195
+ }
196
+
197
+ if (indexInPalette > paletteSize) {
198
+ throw new Error('Too big index in palette: ' + indexInPalette + ', palette size: ' + paletteSize);
199
+ }
200
+
201
+ if (offset + length > tileSize) {
202
+ throw new Error('Too big rle length in palette mode: ' + length + ', allowed length is: ' + (tileSize - offset));
203
+ }
204
+
205
+ for (var j = 0; j < length; j++) {
206
+ data[offset * 4] = palette[indexInPalette * 4];
207
+ data[offset * 4 + 1] = palette[indexInPalette * 4 + 1];
208
+ data[offset * 4 + 2] = palette[indexInPalette * 4 + 2];
209
+ data[offset * 4 + 3] = palette[indexInPalette * 4 + 3];
210
+ offset++;
211
+ }
212
+ }
213
+
214
+ return data;
215
+ }
216
+ }, {
217
+ key: "_readRLELength",
218
+ value: function _readRLELength() {
219
+ var length = 0;
220
+ var current = 0;
221
+
222
+ do {
223
+ current = this._inflator.inflate(1)[0];
224
+ length += current;
225
+ } while (current === 255);
226
+
227
+ return length + 1;
228
+ }
229
+ }]);
230
+
231
+ return ZRLEDecoder;
232
+ }();
233
+
234
+ exports["default"] = ZRLEDecoder;
package/lib/deflator.js CHANGED
@@ -15,7 +15,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
15
15
 
16
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
17
 
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
19
 
20
20
  var Deflator = /*#__PURE__*/function () {
21
21
  function Deflator() {
package/lib/des.js CHANGED
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /*
15
15
  * Ported from Flashlight VNC ActionScript implementation:
package/lib/display.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -23,7 +23,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
23
23
 
24
24
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
25
25
 
26
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
27
 
28
28
  var Display = /*#__PURE__*/function () {
29
29
  function Display(target) {
package/lib/encodings.js CHANGED
@@ -19,7 +19,9 @@ var encodings = {
19
19
  encodingRRE: 2,
20
20
  encodingHextile: 5,
21
21
  encodingTight: 7,
22
+ encodingZRLE: 16,
22
23
  encodingTightPNG: -260,
24
+ encodingJPEG: 21,
23
25
  pseudoEncodingQualityLevel9: -23,
24
26
  pseudoEncodingQualityLevel0: -32,
25
27
  pseudoEncodingDesktopSize: -223,
@@ -55,9 +57,15 @@ function encodingName(num) {
55
57
  case encodings.encodingTight:
56
58
  return "Tight";
57
59
 
60
+ case encodings.encodingZRLE:
61
+ return "ZRLE";
62
+
58
63
  case encodings.encodingTightPNG:
59
64
  return "TightPNG";
60
65
 
66
+ case encodings.encodingJPEG:
67
+ return "JPEG";
68
+
61
69
  default:
62
70
  return "[unknown encoding " + num + "]";
63
71
  }
package/lib/inflator.js CHANGED
@@ -15,7 +15,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
15
15
 
16
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
17
17
 
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
18
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
19
 
20
20
  var Inflate = /*#__PURE__*/function () {
21
21
  function Inflate() {
@@ -9,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9
9
 
10
10
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
11
11
 
12
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
13
 
14
14
  /*
15
15
  * noVNC: HTML5 VNC client
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -27,7 +27,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
27
27
 
28
28
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
29
 
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
31
 
32
32
  //
33
33
  // Keyboard event handler
package/lib/input/util.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getKeycode = getKeycode;
9
8
  exports.getKey = getKey;
9
+ exports.getKeycode = getKeycode;
10
10
  exports.getKeysym = getKeysym;
11
11
 
12
12
  var _keysym = _interopRequireDefault(require("./keysym.js"));