@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.
- package/AUTHORS +13 -0
- package/LICENSE.txt +2 -1
- package/README.md +69 -3
- package/core/base64.js +35 -41
- package/core/decoders/copyrect.js +22 -0
- package/core/decoders/hextile.js +137 -0
- package/core/decoders/raw.js +56 -0
- package/core/decoders/rre.js +44 -0
- package/core/decoders/tight.js +315 -0
- package/core/decoders/tightpng.js +27 -0
- package/core/deflator.js +85 -0
- package/core/des.js +90 -95
- package/core/display.js +254 -297
- package/core/encodings.js +7 -3
- package/core/inflator.js +48 -20
- package/core/input/domkeytable.js +21 -24
- package/core/input/fixedkeys.js +3 -1
- package/core/input/gesturehandler.js +567 -0
- package/core/input/keyboard.js +194 -120
- package/core/input/keysym.js +2 -0
- package/core/input/keysymdef.js +3 -3
- package/core/input/util.js +53 -12
- package/core/input/vkeys.js +2 -1
- package/core/rfb.js +1937 -1496
- package/core/util/browser.js +80 -29
- package/core/util/cursor.js +253 -0
- package/core/util/element.js +32 -0
- package/core/util/events.js +59 -55
- package/core/util/eventtarget.js +25 -30
- package/core/util/int.js +15 -0
- package/core/util/logging.js +21 -16
- package/core/util/polyfill.js +15 -8
- package/core/util/strings.js +21 -8
- package/core/websock.js +145 -167
- package/docs/API.md +31 -10
- package/lib/base64.js +115 -0
- package/lib/decoders/copyrect.js +44 -0
- package/lib/decoders/hextile.js +173 -0
- package/lib/decoders/raw.js +78 -0
- package/lib/decoders/rre.js +65 -0
- package/lib/decoders/tight.js +350 -0
- package/lib/decoders/tightpng.js +67 -0
- package/lib/deflator.js +99 -0
- package/lib/des.js +314 -0
- package/lib/display.js +733 -0
- package/lib/encodings.js +64 -0
- package/lib/inflator.js +87 -0
- package/lib/input/domkeytable.js +282 -0
- package/lib/input/fixedkeys.js +123 -0
- package/lib/input/gesturehandler.js +642 -0
- package/lib/input/keyboard.js +429 -0
- package/lib/input/keysym.js +1135 -0
- package/lib/input/keysymdef.js +1354 -0
- package/lib/input/util.js +304 -0
- package/lib/input/vkeys.js +127 -0
- package/lib/input/xtscancodes.js +505 -0
- package/lib/rfb.js +3448 -0
- package/lib/util/browser.js +131 -0
- package/lib/util/cursor.js +314 -0
- package/lib/util/element.js +43 -0
- package/lib/util/events.js +142 -0
- package/lib/util/eventtarget.js +64 -0
- package/lib/util/int.js +22 -0
- package/lib/util/logging.js +79 -0
- package/lib/util/polyfill.js +72 -0
- package/lib/util/strings.js +38 -0
- package/lib/vendor/pako/lib/utils/common.js +67 -0
- package/lib/vendor/pako/lib/zlib/adler32.js +33 -0
- package/lib/vendor/pako/lib/zlib/constants.js +51 -0
- package/lib/vendor/pako/lib/zlib/crc32.js +42 -0
- package/lib/vendor/pako/lib/zlib/deflate.js +2159 -0
- package/lib/vendor/pako/lib/zlib/gzheader.js +53 -0
- package/lib/vendor/pako/lib/zlib/inffast.js +445 -0
- package/lib/vendor/pako/lib/zlib/inflate.js +2114 -0
- package/lib/vendor/pako/lib/zlib/inftrees.js +418 -0
- package/lib/vendor/pako/lib/zlib/messages.js +36 -0
- package/lib/vendor/pako/lib/zlib/trees.js +1499 -0
- package/lib/vendor/pako/lib/zlib/zstream.js +46 -0
- package/lib/vendor/promise.js +255 -0
- package/lib/websock.js +374 -0
- package/package.json +48 -28
- package/vendor/pako/lib/zlib/deflate.js +30 -30
- package/vendor/pako/lib/zlib/inflate.js +17 -17
- package/core/input/mouse.js +0 -280
- package/docs/API-internal.md +0 -125
- package/docs/EMBEDDING.md +0 -83
- package/docs/VERSION +0 -1
package/core/util/eventtarget.js
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* noVNC: HTML5 VNC client
|
|
3
|
-
* Copyright
|
|
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
|
-
|
|
9
|
+
export default class EventTargetMixin {
|
|
10
|
+
constructor() {
|
|
11
|
+
this._listeners = new Map();
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
21
|
+
removeEventListener(type, callback) {
|
|
22
|
+
if (this._listeners.has(type)) {
|
|
23
|
+
this._listeners.get(type).delete(callback);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
28
26
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
}
|
package/core/util/int.js
ADDED
|
@@ -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
|
+
}
|
package/core/util/logging.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* noVNC: HTML5 VNC client
|
|
3
|
-
* Copyright (C)
|
|
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
|
-
|
|
13
|
+
let _logLevel = 'warn';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
let Debug = () => {};
|
|
16
|
+
let Info = () => {};
|
|
17
|
+
let Warn = () => {};
|
|
18
|
+
let Error = () => {};
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function initLogging(level) {
|
|
21
21
|
if (typeof level === 'undefined') {
|
|
22
|
-
level =
|
|
22
|
+
level = _logLevel;
|
|
23
23
|
} else {
|
|
24
|
-
|
|
24
|
+
_logLevel = level;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
Debug = Info = Warn = Error =
|
|
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
|
-
|
|
46
|
-
|
|
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
|
-
|
|
56
|
+
initLogging();
|
package/core/util/polyfill.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* noVNC: HTML5 VNC client
|
|
3
|
-
* Copyright
|
|
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
|
-
|
|
19
|
+
const to = Object(target);
|
|
20
20
|
|
|
21
|
-
for (
|
|
22
|
-
|
|
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 (
|
|
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
|
-
(
|
|
42
|
-
function CustomEvent
|
|
41
|
+
(() => {
|
|
42
|
+
function CustomEvent(event, params) {
|
|
43
43
|
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
|
44
|
-
|
|
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
|
+
};
|
package/core/util/strings.js
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* noVNC: HTML5 VNC client
|
|
3
|
-
* Copyright (C)
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
+
}
|