@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
@@ -1,40 +1,35 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright 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
- var EventTargetMixin = {
10
- _listeners: null,
9
+ export default class EventTargetMixin {
10
+ constructor() {
11
+ this._listeners = new Map();
12
+ }
11
13
 
12
- addEventListener: function(type, callback) {
13
- if (!this._listeners) {
14
- this._listeners = new Map();
15
- }
16
- if (!this._listeners.has(type)) {
17
- this._listeners.set(type, new Set());
18
- }
19
- this._listeners.get(type).add(callback);
20
- },
14
+ addEventListener(type, callback) {
15
+ if (!this._listeners.has(type)) {
16
+ this._listeners.set(type, new Set());
17
+ }
18
+ this._listeners.get(type).add(callback);
19
+ }
21
20
 
22
- removeEventListener: function(type, callback) {
23
- if (!this._listeners || !this._listeners.has(type)) {
24
- return;
25
- }
26
- this._listeners.get(type).delete(callback);
27
- },
21
+ removeEventListener(type, callback) {
22
+ if (this._listeners.has(type)) {
23
+ this._listeners.get(type).delete(callback);
24
+ }
25
+ }
28
26
 
29
- dispatchEvent: function(event) {
30
- if (!this._listeners || !this._listeners.has(event.type)) {
31
- return true;
32
- }
33
- this._listeners.get(event.type).forEach(function (callback) {
34
- callback.call(this, event);
35
- }, this);
36
- return !event.defaultPrevented;
37
- },
38
- };
39
-
40
- export default EventTargetMixin;
27
+ dispatchEvent(event) {
28
+ if (!this._listeners.has(event.type)) {
29
+ return true;
30
+ }
31
+ this._listeners.get(event.type)
32
+ .forEach(callback => callback.call(this, event));
33
+ return !event.defaultPrevented;
34
+ }
35
+ }
@@ -0,0 +1,15 @@
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
+
9
+ export function toUnsigned32bit(toConvert) {
10
+ return toConvert >>> 0;
11
+ }
12
+
13
+ export function toSigned32bit(toConvert) {
14
+ return toConvert | 0;
15
+ }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
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.
@@ -10,22 +10,24 @@
10
10
  * Logging/debug routines
11
11
  */
12
12
 
13
- var _log_level = 'warn';
13
+ let _logLevel = 'warn';
14
14
 
15
- var Debug = function (msg) {};
16
- var Info = function (msg) {};
17
- var Warn = function (msg) {};
18
- var Error = function (msg) {};
15
+ let Debug = () => {};
16
+ let Info = () => {};
17
+ let Warn = () => {};
18
+ let Error = () => {};
19
19
 
20
- export function init_logging (level) {
20
+ export function initLogging(level) {
21
21
  if (typeof level === 'undefined') {
22
- level = _log_level;
22
+ level = _logLevel;
23
23
  } else {
24
- _log_level = level;
24
+ _logLevel = level;
25
25
  }
26
26
 
27
- Debug = Info = Warn = Error = function (msg) {};
27
+ Debug = Info = Warn = Error = () => {};
28
+
28
29
  if (typeof window.console !== "undefined") {
30
+ /* eslint-disable no-console, no-fallthrough */
29
31
  switch (level) {
30
32
  case 'debug':
31
33
  Debug = console.debug.bind(window.console);
@@ -38,14 +40,17 @@ export function init_logging (level) {
38
40
  case 'none':
39
41
  break;
40
42
  default:
41
- throw new Error("invalid logging type '" + level + "'");
43
+ throw new window.Error("invalid logging type '" + level + "'");
42
44
  }
45
+ /* eslint-enable no-console, no-fallthrough */
43
46
  }
44
- };
45
- export function get_logging () {
46
- return _log_level;
47
- };
47
+ }
48
+
49
+ export function getLogging() {
50
+ return _logLevel;
51
+ }
52
+
48
53
  export { Debug, Info, Warn, Error };
49
54
 
50
55
  // Initialize logging level
51
- init_logging();
56
+ initLogging();
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright 2017 Pierre Ossman for noVNC
3
+ * Copyright (C) 2020 The noVNC Authors
4
4
  * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
5
5
  */
6
6
 
@@ -16,13 +16,13 @@ if (typeof Object.assign != 'function') {
16
16
  throw new TypeError('Cannot convert undefined or null to object');
17
17
  }
18
18
 
19
- var to = Object(target);
19
+ const to = Object(target);
20
20
 
21
- for (var index = 1; index < arguments.length; index++) {
22
- var nextSource = arguments[index];
21
+ for (let index = 1; index < arguments.length; index++) {
22
+ const nextSource = arguments[index];
23
23
 
24
24
  if (nextSource != null) { // Skip over if undefined or null
25
- for (var nextKey in nextSource) {
25
+ for (let nextKey in nextSource) {
26
26
  // Avoid bugs when hasOwnProperty is shadowed
27
27
  if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
28
28
  to[nextKey] = nextSource[nextKey];
@@ -38,10 +38,10 @@ if (typeof Object.assign != 'function') {
38
38
  }
39
39
 
40
40
  /* CustomEvent constructor (taken from MDN) */
41
- (function () {
42
- function CustomEvent ( event, params ) {
41
+ (() => {
42
+ function CustomEvent(event, params) {
43
43
  params = params || { bubbles: false, cancelable: false, detail: undefined };
44
- var evt = document.createEvent( 'CustomEvent' );
44
+ const evt = document.createEvent( 'CustomEvent' );
45
45
  evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
46
46
  return evt;
47
47
  }
@@ -52,3 +52,10 @@ if (typeof Object.assign != 'function') {
52
52
  window.CustomEvent = CustomEvent;
53
53
  }
54
54
  })();
55
+
56
+ /* Number.isInteger() (taken from MDN) */
57
+ Number.isInteger = Number.isInteger || function isInteger(value) {
58
+ return typeof value === 'number' &&
59
+ isFinite(value) &&
60
+ Math.floor(value) === value;
61
+ };
@@ -1,15 +1,28 @@
1
1
  /*
2
2
  * noVNC: HTML5 VNC client
3
- * Copyright (C) 2012 Joel Martin
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
- /*
10
- * Decode from UTF-8
11
- */
12
- export function decodeUTF8 (utf8string) {
13
- "use strict";
14
- return decodeURIComponent(escape(utf8string));
15
- };
9
+ // Decode from UTF-8
10
+ export function decodeUTF8(utf8string, allowLatin1=false) {
11
+ try {
12
+ return decodeURIComponent(escape(utf8string));
13
+ } catch (e) {
14
+ if (e instanceof URIError) {
15
+ if (allowLatin1) {
16
+ // If we allow Latin1 we can ignore any decoding fails
17
+ // and in these cases return the original string
18
+ return utf8string;
19
+ }
20
+ }
21
+ throw e;
22
+ }
23
+ }
24
+
25
+ // Encode to UTF-8
26
+ export function encodeUTF8(DOMString) {
27
+ return unescape(encodeURIComponent(DOMString));
28
+ }