@novnc/novnc 1.0.0 → 1.2.0

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 (87) hide show
  1. package/AUTHORS +13 -0
  2. package/LICENSE.txt +2 -1
  3. package/README.md +69 -3
  4. package/core/base64.js +35 -41
  5. package/core/decoders/copyrect.js +22 -0
  6. package/core/decoders/hextile.js +137 -0
  7. package/core/decoders/raw.js +56 -0
  8. package/core/decoders/rre.js +44 -0
  9. package/core/decoders/tight.js +315 -0
  10. package/core/decoders/tightpng.js +27 -0
  11. package/core/deflator.js +85 -0
  12. package/core/des.js +90 -95
  13. package/core/display.js +254 -297
  14. package/core/encodings.js +7 -3
  15. package/core/inflator.js +48 -20
  16. package/core/input/domkeytable.js +21 -24
  17. package/core/input/fixedkeys.js +3 -1
  18. package/core/input/gesturehandler.js +567 -0
  19. package/core/input/keyboard.js +194 -120
  20. package/core/input/keysym.js +2 -0
  21. package/core/input/keysymdef.js +3 -3
  22. package/core/input/util.js +53 -12
  23. package/core/input/vkeys.js +2 -1
  24. package/core/rfb.js +1937 -1496
  25. package/core/util/browser.js +80 -29
  26. package/core/util/cursor.js +253 -0
  27. package/core/util/element.js +32 -0
  28. package/core/util/events.js +59 -55
  29. package/core/util/eventtarget.js +25 -30
  30. package/core/util/int.js +15 -0
  31. package/core/util/logging.js +21 -16
  32. package/core/util/polyfill.js +15 -8
  33. package/core/util/strings.js +21 -8
  34. package/core/websock.js +145 -167
  35. package/docs/API.md +31 -10
  36. package/lib/base64.js +115 -0
  37. package/lib/decoders/copyrect.js +44 -0
  38. package/lib/decoders/hextile.js +173 -0
  39. package/lib/decoders/raw.js +78 -0
  40. package/lib/decoders/rre.js +65 -0
  41. package/lib/decoders/tight.js +350 -0
  42. package/lib/decoders/tightpng.js +67 -0
  43. package/lib/deflator.js +99 -0
  44. package/lib/des.js +314 -0
  45. package/lib/display.js +733 -0
  46. package/lib/encodings.js +64 -0
  47. package/lib/inflator.js +87 -0
  48. package/lib/input/domkeytable.js +282 -0
  49. package/lib/input/fixedkeys.js +123 -0
  50. package/lib/input/gesturehandler.js +642 -0
  51. package/lib/input/keyboard.js +429 -0
  52. package/lib/input/keysym.js +1135 -0
  53. package/lib/input/keysymdef.js +1354 -0
  54. package/lib/input/util.js +304 -0
  55. package/lib/input/vkeys.js +127 -0
  56. package/lib/input/xtscancodes.js +505 -0
  57. package/lib/rfb.js +3448 -0
  58. package/lib/util/browser.js +131 -0
  59. package/lib/util/cursor.js +314 -0
  60. package/lib/util/element.js +43 -0
  61. package/lib/util/events.js +142 -0
  62. package/lib/util/eventtarget.js +64 -0
  63. package/lib/util/int.js +22 -0
  64. package/lib/util/logging.js +79 -0
  65. package/lib/util/polyfill.js +72 -0
  66. package/lib/util/strings.js +38 -0
  67. package/lib/vendor/pako/lib/utils/common.js +67 -0
  68. package/lib/vendor/pako/lib/zlib/adler32.js +33 -0
  69. package/lib/vendor/pako/lib/zlib/constants.js +51 -0
  70. package/lib/vendor/pako/lib/zlib/crc32.js +42 -0
  71. package/lib/vendor/pako/lib/zlib/deflate.js +2159 -0
  72. package/lib/vendor/pako/lib/zlib/gzheader.js +53 -0
  73. package/lib/vendor/pako/lib/zlib/inffast.js +445 -0
  74. package/lib/vendor/pako/lib/zlib/inflate.js +2114 -0
  75. package/lib/vendor/pako/lib/zlib/inftrees.js +418 -0
  76. package/lib/vendor/pako/lib/zlib/messages.js +36 -0
  77. package/lib/vendor/pako/lib/zlib/trees.js +1499 -0
  78. package/lib/vendor/pako/lib/zlib/zstream.js +46 -0
  79. package/lib/vendor/promise.js +255 -0
  80. package/lib/websock.js +374 -0
  81. package/package.json +48 -28
  82. package/vendor/pako/lib/zlib/deflate.js +30 -30
  83. package/vendor/pako/lib/zlib/inflate.js +17 -17
  84. package/core/input/mouse.js +0 -280
  85. package/docs/API-internal.md +0 -125
  86. package/docs/EMBEDDING.md +0 -83
  87. package/docs/VERSION +0 -1
package/core/encodings.js CHANGED
@@ -1,17 +1,18 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright (C) 2017 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2019 The noVNC Authors
4
4
  * Licensed under MPL 2.0 (see LICENSE.txt)
5
5
  *
6
6
  * See README.md for usage and integration instructions.
7
7
  */
8
8
 
9
- export var encodings = {
9
+ export const encodings = {
10
10
  encodingRaw: 0,
11
11
  encodingCopyRect: 1,
12
12
  encodingRRE: 2,
13
13
  encodingHextile: 5,
14
14
  encodingTight: 7,
15
+ encodingTightPNG: -260,
15
16
 
16
17
  pseudoEncodingQualityLevel9: -23,
17
18
  pseudoEncodingQualityLevel0: -32,
@@ -19,13 +20,15 @@ export var encodings = {
19
20
  pseudoEncodingLastRect: -224,
20
21
  pseudoEncodingCursor: -239,
21
22
  pseudoEncodingQEMUExtendedKeyEvent: -258,
22
- pseudoEncodingTightPNG: -260,
23
+ pseudoEncodingDesktopName: -307,
23
24
  pseudoEncodingExtendedDesktopSize: -308,
24
25
  pseudoEncodingXvp: -309,
25
26
  pseudoEncodingFence: -312,
26
27
  pseudoEncodingContinuousUpdates: -313,
27
28
  pseudoEncodingCompressLevel9: -247,
28
29
  pseudoEncodingCompressLevel0: -256,
30
+ pseudoEncodingVMwareCursor: 0x574d5664,
31
+ pseudoEncodingExtendedClipboard: 0xc0a1e5ce
29
32
  };
30
33
 
31
34
  export function encodingName(num) {
@@ -35,6 +38,7 @@ export function encodingName(num) {
35
38
  case encodings.encodingRRE: return "RRE";
36
39
  case encodings.encodingHextile: return "Hextile";
37
40
  case encodings.encodingTight: return "Tight";
41
+ case encodings.encodingTightPNG: return "TightPNG";
38
42
  default: return "[unknown encoding " + num + "]";
39
43
  }
40
44
  }
package/core/inflator.js CHANGED
@@ -1,13 +1,40 @@
1
+ /*
2
+ * noVNC: HTML5 VNC client
3
+ * Copyright (C) 2020 The noVNC Authors
4
+ * Licensed under MPL 2.0 (see LICENSE.txt)
5
+ *
6
+ * See README.md for usage and integration instructions.
7
+ */
8
+
1
9
  import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
2
10
  import ZStream from "../vendor/pako/lib/zlib/zstream.js";
3
11
 
4
- Inflate.prototype = {
5
- inflate: function (data, flush, expected) {
6
- this.strm.input = data;
7
- this.strm.avail_in = this.strm.input.length;
8
- this.strm.next_in = 0;
9
- this.strm.next_out = 0;
12
+ export default class Inflate {
13
+ constructor() {
14
+ this.strm = new ZStream();
15
+ this.chunkSize = 1024 * 10 * 10;
16
+ this.strm.output = new Uint8Array(this.chunkSize);
17
+ this.windowBits = 5;
18
+
19
+ inflateInit(this.strm, this.windowBits);
20
+ }
21
+
22
+ setInput(data) {
23
+ if (!data) {
24
+ //FIXME: flush remaining data.
25
+ /* eslint-disable camelcase */
26
+ this.strm.input = null;
27
+ this.strm.avail_in = 0;
28
+ this.strm.next_in = 0;
29
+ } else {
30
+ this.strm.input = data;
31
+ this.strm.avail_in = this.strm.input.length;
32
+ this.strm.next_in = 0;
33
+ /* eslint-enable camelcase */
34
+ }
35
+ }
10
36
 
37
+ inflate(expected) {
11
38
  // resize our output buffer if it's too small
12
39
  // (we could just use multiple chunks, but that would cause an extra
13
40
  // allocation each time to flatten the chunks)
@@ -16,23 +43,24 @@ Inflate.prototype = {
16
43
  this.strm.output = new Uint8Array(this.chunkSize);
17
44
  }
18
45
 
19
- this.strm.avail_out = this.chunkSize;
46
+ /* eslint-disable camelcase */
47
+ this.strm.next_out = 0;
48
+ this.strm.avail_out = expected;
49
+ /* eslint-enable camelcase */
50
+
51
+ let ret = inflate(this.strm, 0); // Flush argument not used.
52
+ if (ret < 0) {
53
+ throw new Error("zlib inflate failed");
54
+ }
20
55
 
21
- inflate(this.strm, flush);
56
+ if (this.strm.next_out != expected) {
57
+ throw new Error("Incomplete zlib block");
58
+ }
22
59
 
23
60
  return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
24
- },
61
+ }
25
62
 
26
- reset: function () {
63
+ reset() {
27
64
  inflateReset(this.strm);
28
65
  }
29
- };
30
-
31
- export default function Inflate() {
32
- this.strm = new ZStream();
33
- this.chunkSize = 1024 * 10 * 10;
34
- this.strm.output = new Uint8Array(this.chunkSize);
35
- this.windowBits = 5;
36
-
37
- inflateInit(this.strm, this.windowBits);
38
- };
66
+ }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright (C) 2017 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2018 The noVNC Authors
4
4
  * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
5
  */
6
6
 
@@ -13,28 +13,25 @@ import KeyTable from "./keysym.js";
13
13
  * See https://www.w3.org/TR/uievents-key/ for possible values.
14
14
  */
15
15
 
16
- var DOMKeyTable = {};
16
+ const DOMKeyTable = {};
17
17
 
18
- function addStandard(key, standard)
19
- {
20
- if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
21
- if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
18
+ function addStandard(key, standard) {
19
+ if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
20
+ if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
22
21
  DOMKeyTable[key] = [standard, standard, standard, standard];
23
22
  }
24
23
 
25
- function addLeftRight(key, left, right)
26
- {
27
- if (left === undefined) throw "Undefined keysym for key \"" + key + "\"";
28
- if (right === undefined) throw "Undefined keysym for key \"" + key + "\"";
29
- if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
24
+ function addLeftRight(key, left, right) {
25
+ if (left === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
26
+ if (right === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
27
+ if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
30
28
  DOMKeyTable[key] = [left, left, right, left];
31
29
  }
32
30
 
33
- function addNumpad(key, standard, numpad)
34
- {
35
- if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
36
- if (numpad === undefined) throw "Undefined keysym for key \"" + key + "\"";
37
- if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
31
+ function addNumpad(key, standard, numpad) {
32
+ if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
33
+ if (numpad === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
34
+ if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
38
35
  DOMKeyTable[key] = [standard, standard, standard, numpad];
39
36
  }
40
37
 
@@ -46,12 +43,10 @@ addStandard("CapsLock", KeyTable.XK_Caps_Lock);
46
43
  addLeftRight("Control", KeyTable.XK_Control_L, KeyTable.XK_Control_R);
47
44
  // - Fn
48
45
  // - FnLock
49
- addLeftRight("Hyper", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
50
46
  addLeftRight("Meta", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
51
47
  addStandard("NumLock", KeyTable.XK_Num_Lock);
52
48
  addStandard("ScrollLock", KeyTable.XK_Scroll_Lock);
53
49
  addLeftRight("Shift", KeyTable.XK_Shift_L, KeyTable.XK_Shift_R);
54
- addLeftRight("Super", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
55
50
  // - Symbol
56
51
  // - SymbolLock
57
52
 
@@ -75,7 +70,10 @@ addNumpad("PageUp", KeyTable.XK_Prior, KeyTable.XK_KP_Prior);
75
70
  // 2.5. Editing Keys
76
71
 
77
72
  addStandard("Backspace", KeyTable.XK_BackSpace);
78
- addStandard("Clear", KeyTable.XK_Clear);
73
+ // Browsers send "Clear" for the numpad 5 without NumLock because
74
+ // Windows uses VK_Clear for that key. But Unix expects KP_Begin for
75
+ // that scenario.
76
+ addNumpad("Clear", KeyTable.XK_Clear, KeyTable.XK_KP_Begin);
79
77
  addStandard("Copy", KeyTable.XF86XK_Copy);
80
78
  // - CrSel
81
79
  addStandard("Cut", KeyTable.XF86XK_Cut);
@@ -197,7 +195,8 @@ addStandard("F35", KeyTable.XK_F35);
197
195
  addStandard("Close", KeyTable.XF86XK_Close);
198
196
  addStandard("MailForward", KeyTable.XF86XK_MailForward);
199
197
  addStandard("MailReply", KeyTable.XF86XK_Reply);
200
- addStandard("MainSend", KeyTable.XF86XK_Send);
198
+ addStandard("MailSend", KeyTable.XF86XK_Send);
199
+ // - MediaClose
201
200
  addStandard("MediaFastForward", KeyTable.XF86XK_AudioForward);
202
201
  addStandard("MediaPause", KeyTable.XF86XK_AudioPause);
203
202
  addStandard("MediaPlay", KeyTable.XF86XK_AudioPlay);
@@ -221,11 +220,9 @@ addStandard("SpellCheck", KeyTable.XF86XK_Spell);
221
220
 
222
221
  // - AudioBalanceLeft
223
222
  // - AudioBalanceRight
224
- // - AudioBassDown
225
223
  // - AudioBassBoostDown
226
224
  // - AudioBassBoostToggle
227
225
  // - AudioBassBoostUp
228
- // - AudioBassUp
229
226
  // - AudioFaderFront
230
227
  // - AudioFaderRear
231
228
  // - AudioSurroundModeNext
@@ -246,12 +243,12 @@ addStandard("MicrophoneVolumeMute", KeyTable.XF86XK_AudioMicMute);
246
243
 
247
244
  // 2.14. Application Keys
248
245
 
249
- addStandard("LaunchCalculator", KeyTable.XF86XK_Calculator);
246
+ addStandard("LaunchApplication1", KeyTable.XF86XK_MyComputer);
247
+ addStandard("LaunchApplication2", KeyTable.XF86XK_Calculator);
250
248
  addStandard("LaunchCalendar", KeyTable.XF86XK_Calendar);
251
249
  addStandard("LaunchMail", KeyTable.XF86XK_Mail);
252
250
  addStandard("LaunchMediaPlayer", KeyTable.XF86XK_AudioMedia);
253
251
  addStandard("LaunchMusicPlayer", KeyTable.XF86XK_Music);
254
- addStandard("LaunchMyComputer", KeyTable.XF86XK_MyComputer);
255
252
  addStandard("LaunchPhone", KeyTable.XF86XK_Phone);
256
253
  addStandard("LaunchScreenSaver", KeyTable.XF86XK_ScreenSaver);
257
254
  addStandard("LaunchSpreadsheet", KeyTable.XF86XK_Excel);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright (C) 2017 Pierre Ossman for Cendio AB
3
+ * Copyright (C) 2018 The noVNC Authors
4
4
  * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
5
  */
6
6
 
@@ -14,6 +14,8 @@
14
14
  * See https://www.w3.org/TR/uievents-key/ for possible values.
15
15
  */
16
16
 
17
+ /* eslint-disable key-spacing */
18
+
17
19
  export default {
18
20
 
19
21
  // 3.1.1.1. Writing System Keys