@novnc/novnc 1.3.0 → 1.4.0-beta

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 (64) hide show
  1. package/AUTHORS +2 -2
  2. package/LICENSE.txt +1 -1
  3. package/README.md +23 -7
  4. package/core/decoders/jpeg.js +141 -0
  5. package/core/decoders/raw.js +1 -1
  6. package/core/decoders/zrle.js +185 -0
  7. package/core/des.js +1 -1
  8. package/core/display.js +12 -0
  9. package/core/encodings.js +4 -0
  10. package/core/input/keyboard.js +10 -0
  11. package/core/ra2.js +567 -0
  12. package/core/rfb.js +469 -84
  13. package/core/util/browser.js +56 -7
  14. package/core/util/cursor.js +4 -0
  15. package/core/util/md5.js +79 -0
  16. package/docs/API.md +318 -157
  17. package/lib/base64.js +20 -34
  18. package/lib/decoders/copyrect.js +5 -12
  19. package/lib/decoders/hextile.js +17 -47
  20. package/lib/decoders/jpeg.js +149 -0
  21. package/lib/decoders/raw.js +10 -23
  22. package/lib/decoders/rre.js +5 -16
  23. package/lib/decoders/tight.js +13 -79
  24. package/lib/decoders/tightpng.js +8 -28
  25. package/lib/decoders/zrle.js +188 -0
  26. package/lib/deflator.js +9 -23
  27. package/lib/des.js +24 -37
  28. package/lib/display.js +62 -108
  29. package/lib/encodings.js +7 -8
  30. package/lib/inflator.js +6 -19
  31. package/lib/input/domkeytable.js +77 -48
  32. package/lib/input/fixedkeys.js +8 -3
  33. package/lib/input/gesturehandler.js +86 -153
  34. package/lib/input/keyboard.js +62 -91
  35. package/lib/input/keysym.js +14 -270
  36. package/lib/input/keysymdef.js +5 -7
  37. package/lib/input/util.js +43 -85
  38. package/lib/input/vkeys.js +0 -3
  39. package/lib/input/xtscancodes.js +1 -168
  40. package/lib/ra2.js +1005 -0
  41. package/lib/rfb.js +795 -923
  42. package/lib/util/browser.js +66 -29
  43. package/lib/util/cursor.js +29 -66
  44. package/lib/util/element.js +3 -5
  45. package/lib/util/events.js +23 -30
  46. package/lib/util/eventtarget.js +5 -14
  47. package/lib/util/int.js +1 -2
  48. package/lib/util/logging.js +1 -19
  49. package/lib/util/md5.js +77 -0
  50. package/lib/util/strings.js +3 -5
  51. package/lib/vendor/pako/lib/utils/common.js +8 -17
  52. package/lib/vendor/pako/lib/zlib/adler32.js +3 -7
  53. package/lib/vendor/pako/lib/zlib/constants.js +2 -5
  54. package/lib/vendor/pako/lib/zlib/crc32.js +5 -12
  55. package/lib/vendor/pako/lib/zlib/deflate.js +213 -618
  56. package/lib/vendor/pako/lib/zlib/gzheader.js +1 -13
  57. package/lib/vendor/pako/lib/zlib/inffast.js +60 -176
  58. package/lib/vendor/pako/lib/zlib/inflate.js +398 -888
  59. package/lib/vendor/pako/lib/zlib/inftrees.js +63 -169
  60. package/lib/vendor/pako/lib/zlib/messages.js +1 -11
  61. package/lib/vendor/pako/lib/zlib/trees.js +246 -588
  62. package/lib/vendor/pako/lib/zlib/zstream.js +2 -18
  63. package/lib/websock.js +37 -88
  64. package/package.json +32 -35
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  /*
9
8
  * Mapping from Unicode codepoints to X11/RFB keysyms
10
9
  *
@@ -13,6 +12,7 @@ exports["default"] = void 0;
13
12
  */
14
13
 
15
14
  /* Functions at the bottom */
15
+
16
16
  var codepoints = {
17
17
  0x0100: 0x03c0,
18
18
  // XK_Amacron
@@ -1331,23 +1331,21 @@ var codepoints = {
1331
1331
  0x30fb: 0x04a5,
1332
1332
  // XK_kana_conjunctive
1333
1333
  0x30fc: 0x04b0 // XK_prolongedsound
1334
-
1335
1334
  };
1336
1335
  var _default = {
1337
1336
  lookup: function lookup(u) {
1338
1337
  // Latin-1 is one-to-one mapping
1339
1338
  if (u >= 0x20 && u <= 0xff) {
1340
1339
  return u;
1341
- } // Lookup table (fairly random)
1342
-
1340
+ }
1343
1341
 
1342
+ // Lookup table (fairly random)
1344
1343
  var keysym = codepoints[u];
1345
-
1346
1344
  if (keysym !== undefined) {
1347
1345
  return keysym;
1348
- } // General mapping as final fallback
1349
-
1346
+ }
1350
1347
 
1348
+ // General mapping as final fallback
1351
1349
  return 0x01000000 | u;
1352
1350
  }
1353
1351
  };
package/lib/input/util.js CHANGED
@@ -1,32 +1,21 @@
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); }
4
-
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); }
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.getKey = getKey;
9
8
  exports.getKeycode = getKeycode;
10
9
  exports.getKeysym = getKeysym;
11
-
12
10
  var _keysym = _interopRequireDefault(require("./keysym.js"));
13
-
14
11
  var _keysymdef = _interopRequireDefault(require("./keysymdef.js"));
15
-
16
12
  var _vkeys = _interopRequireDefault(require("./vkeys.js"));
17
-
18
13
  var _fixedkeys = _interopRequireDefault(require("./fixedkeys.js"));
19
-
20
14
  var _domkeytable = _interopRequireDefault(require("./domkeytable.js"));
21
-
22
15
  var browser = _interopRequireWildcard(require("../util/browser.js"));
23
-
24
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
-
26
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
-
28
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
19
  // Get 'KeyboardEvent.code', handling legacy browsers
31
20
  function getKeycode(evt) {
32
21
  // Are we getting proper key identifiers?
@@ -38,83 +27,68 @@ function getKeycode(evt) {
38
27
  switch (evt.code) {
39
28
  case 'OSLeft':
40
29
  return 'MetaLeft';
41
-
42
30
  case 'OSRight':
43
31
  return 'MetaRight';
44
32
  }
45
-
46
33
  return evt.code;
47
- } // The de-facto standard is to use Windows Virtual-Key codes
48
- // in the 'keyCode' field for non-printable characters
49
-
34
+ }
50
35
 
36
+ // The de-facto standard is to use Windows Virtual-Key codes
37
+ // in the 'keyCode' field for non-printable characters
51
38
  if (evt.keyCode in _vkeys["default"]) {
52
- var code = _vkeys["default"][evt.keyCode]; // macOS has messed up this code for some reason
39
+ var code = _vkeys["default"][evt.keyCode];
53
40
 
41
+ // macOS has messed up this code for some reason
54
42
  if (browser.isMac() && code === 'ContextMenu') {
55
43
  code = 'MetaRight';
56
- } // The keyCode doesn't distinguish between left and right
57
- // for the standard modifiers
58
-
44
+ }
59
45
 
46
+ // The keyCode doesn't distinguish between left and right
47
+ // for the standard modifiers
60
48
  if (evt.location === 2) {
61
49
  switch (code) {
62
50
  case 'ShiftLeft':
63
51
  return 'ShiftRight';
64
-
65
52
  case 'ControlLeft':
66
53
  return 'ControlRight';
67
-
68
54
  case 'AltLeft':
69
55
  return 'AltRight';
70
56
  }
71
- } // Nor a bunch of the numpad keys
72
-
57
+ }
73
58
 
59
+ // Nor a bunch of the numpad keys
74
60
  if (evt.location === 3) {
75
61
  switch (code) {
76
62
  case 'Delete':
77
63
  return 'NumpadDecimal';
78
-
79
64
  case 'Insert':
80
65
  return 'Numpad0';
81
-
82
66
  case 'End':
83
67
  return 'Numpad1';
84
-
85
68
  case 'ArrowDown':
86
69
  return 'Numpad2';
87
-
88
70
  case 'PageDown':
89
71
  return 'Numpad3';
90
-
91
72
  case 'ArrowLeft':
92
73
  return 'Numpad4';
93
-
94
74
  case 'ArrowRight':
95
75
  return 'Numpad6';
96
-
97
76
  case 'Home':
98
77
  return 'Numpad7';
99
-
100
78
  case 'ArrowUp':
101
79
  return 'Numpad8';
102
-
103
80
  case 'PageUp':
104
81
  return 'Numpad9';
105
-
106
82
  case 'Enter':
107
83
  return 'NumpadEnter';
108
84
  }
109
85
  }
110
-
111
86
  return code;
112
87
  }
113
-
114
88
  return 'Unidentified';
115
- } // Get 'KeyboardEvent.key', handling legacy browsers
116
-
89
+ }
117
90
 
91
+ // Get 'KeyboardEvent.key', handling legacy browsers
118
92
  function getKey(evt) {
119
93
  // Are we getting a proper key value?
120
94
  if (evt.key !== undefined) {
@@ -122,138 +96,122 @@ function getKey(evt) {
122
96
  switch (evt.key) {
123
97
  case 'OS':
124
98
  return 'Meta';
125
-
126
99
  case 'LaunchMyComputer':
127
100
  return 'LaunchApplication1';
128
-
129
101
  case 'LaunchCalculator':
130
102
  return 'LaunchApplication2';
131
- } // iOS leaks some OS names
132
-
103
+ }
133
104
 
105
+ // iOS leaks some OS names
134
106
  switch (evt.key) {
135
107
  case 'UIKeyInputUpArrow':
136
108
  return 'ArrowUp';
137
-
138
109
  case 'UIKeyInputDownArrow':
139
110
  return 'ArrowDown';
140
-
141
111
  case 'UIKeyInputLeftArrow':
142
112
  return 'ArrowLeft';
143
-
144
113
  case 'UIKeyInputRightArrow':
145
114
  return 'ArrowRight';
146
-
147
115
  case 'UIKeyInputEscape':
148
116
  return 'Escape';
149
- } // Broken behaviour in Chrome
150
-
117
+ }
151
118
 
119
+ // Broken behaviour in Chrome
152
120
  if (evt.key === '\x00' && evt.code === 'NumpadDecimal') {
153
121
  return 'Delete';
154
122
  }
155
-
156
123
  return evt.key;
157
- } // Try to deduce it based on the physical key
158
-
124
+ }
159
125
 
126
+ // Try to deduce it based on the physical key
160
127
  var code = getKeycode(evt);
161
-
162
128
  if (code in _fixedkeys["default"]) {
163
129
  return _fixedkeys["default"][code];
164
- } // If that failed, then see if we have a printable character
165
-
130
+ }
166
131
 
132
+ // If that failed, then see if we have a printable character
167
133
  if (evt.charCode) {
168
134
  return String.fromCharCode(evt.charCode);
169
- } // At this point we have nothing left to go on
170
-
135
+ }
171
136
 
137
+ // At this point we have nothing left to go on
172
138
  return 'Unidentified';
173
- } // Get the most reliable keysym value we can get from a key event
174
-
139
+ }
175
140
 
141
+ // Get the most reliable keysym value we can get from a key event
176
142
  function getKeysym(evt) {
177
143
  var key = getKey(evt);
178
-
179
144
  if (key === 'Unidentified') {
180
145
  return null;
181
- } // First look up special keys
182
-
146
+ }
183
147
 
148
+ // First look up special keys
184
149
  if (key in _domkeytable["default"]) {
185
- var location = evt.location; // Safari screws up location for the right cmd key
150
+ var location = evt.location;
186
151
 
152
+ // Safari screws up location for the right cmd key
187
153
  if (key === 'Meta' && location === 0) {
188
154
  location = 2;
189
- } // And for Clear
190
-
155
+ }
191
156
 
157
+ // And for Clear
192
158
  if (key === 'Clear' && location === 3) {
193
159
  var code = getKeycode(evt);
194
-
195
160
  if (code === 'NumLock') {
196
161
  location = 0;
197
162
  }
198
163
  }
199
-
200
164
  if (location === undefined || location > 3) {
201
165
  location = 0;
202
- } // The original Meta key now gets confused with the Windows key
166
+ }
167
+
168
+ // The original Meta key now gets confused with the Windows key
203
169
  // https://bugs.chromium.org/p/chromium/issues/detail?id=1020141
204
170
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1232918
205
-
206
-
207
171
  if (key === 'Meta') {
208
172
  var _code = getKeycode(evt);
209
-
210
173
  if (_code === 'AltLeft') {
211
174
  return _keysym["default"].XK_Meta_L;
212
175
  } else if (_code === 'AltRight') {
213
176
  return _keysym["default"].XK_Meta_R;
214
177
  }
215
- } // macOS has Clear instead of NumLock, but the remote system is
216
- // probably not macOS, so lying here is probably best...
217
-
178
+ }
218
179
 
180
+ // macOS has Clear instead of NumLock, but the remote system is
181
+ // probably not macOS, so lying here is probably best...
219
182
  if (key === 'Clear') {
220
183
  var _code2 = getKeycode(evt);
221
-
222
184
  if (_code2 === 'NumLock') {
223
185
  return _keysym["default"].XK_Num_Lock;
224
186
  }
225
- } // Windows sends alternating symbols for some keys when using a
187
+ }
188
+
189
+ // Windows sends alternating symbols for some keys when using a
226
190
  // Japanese layout. We have no way of synchronising with the IM
227
191
  // running on the remote system, so we send some combined keysym
228
192
  // instead and hope for the best.
229
-
230
-
231
193
  if (browser.isWindows()) {
232
194
  switch (key) {
233
195
  case 'Zenkaku':
234
196
  case 'Hankaku':
235
197
  return _keysym["default"].XK_Zenkaku_Hankaku;
236
-
237
198
  case 'Romaji':
238
199
  case 'KanaMode':
239
200
  return _keysym["default"].XK_Romaji;
240
201
  }
241
202
  }
242
-
243
203
  return _domkeytable["default"][key][location];
244
- } // Now we need to look at the Unicode symbol instead
245
- // Special key? (FIXME: Should have been caught earlier)
204
+ }
246
205
 
206
+ // Now we need to look at the Unicode symbol instead
247
207
 
208
+ // Special key? (FIXME: Should have been caught earlier)
248
209
  if (key.length !== 1) {
249
210
  return null;
250
211
  }
251
-
252
212
  var codepoint = key.charCodeAt();
253
-
254
213
  if (codepoint) {
255
214
  return _keysymdef["default"].lookup(codepoint);
256
215
  }
257
-
258
216
  return null;
259
217
  }
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
-
8
7
  /*
9
8
  * noVNC: HTML5 VNC client
10
9
  * Copyright (C) 2018 The noVNC Authors
11
10
  * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
12
11
  */
13
-
14
12
  /*
15
13
  * Mapping between Microsoft® Windows® Virtual-Key codes and
16
14
  * HTML key codes.
@@ -120,6 +118,5 @@ var _default = {
120
118
  0xb6: 'LaunchApp1',
121
119
  0xb7: 'LaunchApp2',
122
120
  0xe1: 'AltRight' // Only when it is AltGraph
123
-
124
121
  };
125
122
  exports["default"] = _default;