@novnc/novnc 1.2.0-test → 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.
- package/LICENSE.txt +0 -6
- package/README.md +16 -6
- package/core/decoders/copyrect.js +5 -0
- package/core/decoders/hextile.js +57 -3
- package/core/decoders/jpeg.js +141 -0
- package/core/decoders/raw.js +12 -2
- package/core/decoders/tight.js +24 -8
- package/core/decoders/zrle.js +185 -0
- package/core/display.js +9 -151
- package/core/encodings.js +4 -0
- package/core/input/domkeytable.js +25 -21
- package/core/input/keyboard.js +12 -127
- package/core/input/util.js +18 -35
- package/core/input/vkeys.js +0 -1
- package/core/input/xtscancodes.js +5 -3
- package/core/ra2.js +567 -0
- package/core/rfb.js +332 -114
- package/core/util/browser.js +0 -17
- package/core/util/cursor.js +1 -11
- package/core/util/events.js +0 -4
- package/core/util/md5.js +79 -0
- package/core/websock.js +76 -17
- package/docs/API.md +46 -6
- package/docs/LIBRARY.md +3 -7
- package/lib/base64.js +5 -5
- package/lib/decoders/copyrect.js +8 -3
- package/lib/decoders/hextile.js +65 -9
- package/lib/decoders/jpeg.js +188 -0
- package/lib/decoders/raw.js +14 -5
- package/lib/decoders/rre.js +3 -3
- package/lib/decoders/tight.js +40 -22
- package/lib/decoders/tightpng.js +10 -10
- package/lib/decoders/zrle.js +234 -0
- package/lib/deflator.js +5 -5
- package/lib/des.js +3 -3
- package/lib/display.js +47 -214
- package/lib/encodings.js +8 -0
- package/lib/inflator.js +5 -5
- package/lib/input/domkeytable.js +197 -194
- package/lib/input/fixedkeys.js +2 -2
- package/lib/input/gesturehandler.js +3 -3
- package/lib/input/keyboard.js +40 -160
- package/lib/input/keysym.js +2 -2
- package/lib/input/keysymdef.js +2 -2
- package/lib/input/util.js +35 -80
- package/lib/input/vkeys.js +2 -4
- package/lib/input/xtscancodes.js +11 -5
- package/lib/ra2.js +1257 -0
- package/lib/rfb.js +656 -306
- package/lib/util/browser.js +9 -27
- package/lib/util/cursor.js +5 -17
- package/lib/util/events.js +3 -5
- package/lib/util/eventtarget.js +4 -4
- package/lib/util/int.js +1 -1
- package/lib/util/logging.js +2 -2
- package/lib/util/md5.js +103 -0
- package/lib/vendor/pako/lib/utils/common.js +2 -2
- package/lib/vendor/pako/lib/zlib/adler32.js +1 -1
- package/lib/vendor/pako/lib/zlib/constants.js +2 -2
- package/lib/vendor/pako/lib/zlib/crc32.js +1 -1
- package/lib/vendor/pako/lib/zlib/deflate.js +114 -113
- package/lib/vendor/pako/lib/zlib/gzheader.js +1 -1
- package/lib/vendor/pako/lib/zlib/inffast.js +5 -5
- package/lib/vendor/pako/lib/zlib/inflate.js +51 -49
- package/lib/vendor/pako/lib/zlib/inftrees.js +4 -4
- package/lib/vendor/pako/lib/zlib/messages.js +2 -2
- package/lib/vendor/pako/lib/zlib/trees.js +5 -5
- package/lib/vendor/pako/lib/zlib/zstream.js +1 -1
- package/lib/websock.js +107 -46
- package/package.json +2 -10
- package/core/util/polyfill.js +0 -61
- package/lib/util/polyfill.js +0 -72
- package/lib/vendor/promise.js +0 -255
package/core/util/browser.js
CHANGED
|
@@ -45,15 +45,6 @@ try {
|
|
|
45
45
|
|
|
46
46
|
export const supportsCursorURIs = _supportsCursorURIs;
|
|
47
47
|
|
|
48
|
-
let _supportsImageMetadata = false;
|
|
49
|
-
try {
|
|
50
|
-
new ImageData(new Uint8ClampedArray(4), 1, 1);
|
|
51
|
-
_supportsImageMetadata = true;
|
|
52
|
-
} catch (ex) {
|
|
53
|
-
// ignore failure
|
|
54
|
-
}
|
|
55
|
-
export const supportsImageMetadata = _supportsImageMetadata;
|
|
56
|
-
|
|
57
48
|
let _hasScrollbarGutter = true;
|
|
58
49
|
try {
|
|
59
50
|
// Create invisible container
|
|
@@ -106,14 +97,6 @@ export function isSafari() {
|
|
|
106
97
|
navigator.userAgent.indexOf('Chrome') === -1);
|
|
107
98
|
}
|
|
108
99
|
|
|
109
|
-
export function isIE() {
|
|
110
|
-
return navigator && !!(/trident/i).exec(navigator.userAgent);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function isEdge() {
|
|
114
|
-
return navigator && !!(/edge/i).exec(navigator.userAgent);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
100
|
export function isFirefox() {
|
|
118
101
|
return navigator && !!(/firefox/i).exec(navigator.userAgent);
|
|
119
102
|
}
|
package/core/util/cursor.js
CHANGED
|
@@ -43,9 +43,6 @@ export default class Cursor {
|
|
|
43
43
|
if (useFallback) {
|
|
44
44
|
document.body.appendChild(this._canvas);
|
|
45
45
|
|
|
46
|
-
// FIXME: These don't fire properly except for mouse
|
|
47
|
-
/// movement in IE. We want to also capture element
|
|
48
|
-
// movement, size changes, visibility, etc.
|
|
49
46
|
const options = { capture: true, passive: true };
|
|
50
47
|
this._target.addEventListener('mouseover', this._eventHandlers.mouseover, options);
|
|
51
48
|
this._target.addEventListener('mouseleave', this._eventHandlers.mouseleave, options);
|
|
@@ -90,14 +87,7 @@ export default class Cursor {
|
|
|
90
87
|
this._canvas.width = w;
|
|
91
88
|
this._canvas.height = h;
|
|
92
89
|
|
|
93
|
-
let img;
|
|
94
|
-
try {
|
|
95
|
-
// IE doesn't support this
|
|
96
|
-
img = new ImageData(new Uint8ClampedArray(rgba), w, h);
|
|
97
|
-
} catch (ex) {
|
|
98
|
-
img = ctx.createImageData(w, h);
|
|
99
|
-
img.data.set(new Uint8ClampedArray(rgba));
|
|
100
|
-
}
|
|
90
|
+
let img = new ImageData(new Uint8ClampedArray(rgba), w, h);
|
|
101
91
|
ctx.clearRect(0, 0, w, h);
|
|
102
92
|
ctx.putImageData(img, 0, 0);
|
|
103
93
|
|
package/core/util/events.js
CHANGED
|
@@ -65,10 +65,6 @@ export function setCapture(target) {
|
|
|
65
65
|
|
|
66
66
|
target.setCapture();
|
|
67
67
|
document.captureElement = target;
|
|
68
|
-
|
|
69
|
-
// IE releases capture on 'click' events which might not trigger
|
|
70
|
-
target.addEventListener('mouseup', releaseCapture);
|
|
71
|
-
|
|
72
68
|
} else {
|
|
73
69
|
// Release any existing capture in case this method is
|
|
74
70
|
// called multiple times without coordination
|
package/core/util/md5.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* noVNC: HTML5 VNC client
|
|
3
|
+
* Copyright (C) 2021 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
|
+
/*
|
|
10
|
+
* Performs MD5 hashing on a string of binary characters, returns an array of bytes
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export function MD5(d) {
|
|
14
|
+
let r = M(V(Y(X(d), 8 * d.length)));
|
|
15
|
+
return r;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function M(d) {
|
|
19
|
+
let f = new Uint8Array(d.length);
|
|
20
|
+
for (let i=0;i<d.length;i++) {
|
|
21
|
+
f[i] = d.charCodeAt(i);
|
|
22
|
+
}
|
|
23
|
+
return f;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function X(d) {
|
|
27
|
+
let r = Array(d.length >> 2);
|
|
28
|
+
for (let m = 0; m < r.length; m++) r[m] = 0;
|
|
29
|
+
for (let m = 0; m < 8 * d.length; m += 8) r[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32;
|
|
30
|
+
return r;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function V(d) {
|
|
34
|
+
let r = "";
|
|
35
|
+
for (let m = 0; m < 32 * d.length; m += 8) r += String.fromCharCode(d[m >> 5] >>> m % 32 & 255);
|
|
36
|
+
return r;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function Y(d, g) {
|
|
40
|
+
d[g >> 5] |= 128 << g % 32, d[14 + (g + 64 >>> 9 << 4)] = g;
|
|
41
|
+
let m = 1732584193, f = -271733879, r = -1732584194, i = 271733878;
|
|
42
|
+
for (let n = 0; n < d.length; n += 16) {
|
|
43
|
+
let h = m,
|
|
44
|
+
t = f,
|
|
45
|
+
g = r,
|
|
46
|
+
e = i;
|
|
47
|
+
f = ii(f = ii(f = ii(f = ii(f = hh(f = hh(f = hh(f = hh(f = gg(f = gg(f = gg(f = gg(f = ff(f = ff(f = ff(f = ff(f, r = ff(r, i = ff(i, m = ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = ff(r, i = ff(i, m = ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = ff(r, i = ff(i, m = ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = ff(r, i = ff(i, m = ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = gg(r, i = gg(i, m = gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = gg(r, i = gg(i, m = gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = gg(r, i = gg(i, m = gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = gg(r, i = gg(i, m = gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = hh(r, i = hh(i, m = hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = hh(r, i = hh(i, m = hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = hh(r, i = hh(i, m = hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = hh(r, i = hh(i, m = hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = ii(r, i = ii(i, m = ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = ii(r, i = ii(i, m = ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = ii(r, i = ii(i, m = ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = ii(r, i = ii(i, m = ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = add(m, h), f = add(f, t), r = add(r, g), i = add(i, e);
|
|
48
|
+
}
|
|
49
|
+
return Array(m, f, r, i);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function cmn(d, g, m, f, r, i) {
|
|
53
|
+
return add(rol(add(add(g, d), add(f, i)), r), m);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function ff(d, g, m, f, r, i, n) {
|
|
57
|
+
return cmn(g & m | ~g & f, d, g, r, i, n);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function gg(d, g, m, f, r, i, n) {
|
|
61
|
+
return cmn(g & f | m & ~f, d, g, r, i, n);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function hh(d, g, m, f, r, i, n) {
|
|
65
|
+
return cmn(g ^ m ^ f, d, g, r, i, n);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ii(d, g, m, f, r, i, n) {
|
|
69
|
+
return cmn(m ^ (g | ~f), d, g, r, i, n);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function add(d, g) {
|
|
73
|
+
let m = (65535 & d) + (65535 & g);
|
|
74
|
+
return (d >> 16) + (g >> 16) + (m >> 16) << 16 | 65535 & m;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function rol(d, g) {
|
|
78
|
+
return d << g | d >>> 32 - g;
|
|
79
|
+
}
|
package/core/websock.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Websock: high-performance
|
|
2
|
+
* Websock: high-performance buffering wrapper
|
|
3
3
|
* Copyright (C) 2019 The noVNC Authors
|
|
4
4
|
* Licensed under MPL 2.0 (see LICENSE.txt)
|
|
5
5
|
*
|
|
6
|
-
* Websock is similar to the standard WebSocket
|
|
7
|
-
* buffer handling.
|
|
6
|
+
* Websock is similar to the standard WebSocket / RTCDataChannel object
|
|
7
|
+
* but with extra buffer handling.
|
|
8
8
|
*
|
|
9
9
|
* Websock has built-in receive queue buffering; the message event
|
|
10
10
|
* does not contain actual data but is simply a notification that
|
|
@@ -17,14 +17,39 @@ import * as Log from './util/logging.js';
|
|
|
17
17
|
// this has performance issues in some versions Chromium, and
|
|
18
18
|
// doesn't gain a tremendous amount of performance increase in Firefox
|
|
19
19
|
// at the moment. It may be valuable to turn it on in the future.
|
|
20
|
-
// Also copyWithin() for TypedArrays is not supported in IE 11 or
|
|
21
|
-
// Safari 13 (at the moment we want to support Safari 11).
|
|
22
|
-
const ENABLE_COPYWITHIN = false;
|
|
23
20
|
const MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
|
|
24
21
|
|
|
22
|
+
// Constants pulled from RTCDataChannelState enum
|
|
23
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#RTCDataChannelState_enum
|
|
24
|
+
const DataChannel = {
|
|
25
|
+
CONNECTING: "connecting",
|
|
26
|
+
OPEN: "open",
|
|
27
|
+
CLOSING: "closing",
|
|
28
|
+
CLOSED: "closed"
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const ReadyStates = {
|
|
32
|
+
CONNECTING: [WebSocket.CONNECTING, DataChannel.CONNECTING],
|
|
33
|
+
OPEN: [WebSocket.OPEN, DataChannel.OPEN],
|
|
34
|
+
CLOSING: [WebSocket.CLOSING, DataChannel.CLOSING],
|
|
35
|
+
CLOSED: [WebSocket.CLOSED, DataChannel.CLOSED],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Properties a raw channel must have, WebSocket and RTCDataChannel are two examples
|
|
39
|
+
const rawChannelProps = [
|
|
40
|
+
"send",
|
|
41
|
+
"close",
|
|
42
|
+
"binaryType",
|
|
43
|
+
"onerror",
|
|
44
|
+
"onmessage",
|
|
45
|
+
"onopen",
|
|
46
|
+
"protocol",
|
|
47
|
+
"readyState",
|
|
48
|
+
];
|
|
49
|
+
|
|
25
50
|
export default class Websock {
|
|
26
51
|
constructor() {
|
|
27
|
-
this._websocket = null; // WebSocket object
|
|
52
|
+
this._websocket = null; // WebSocket or RTCDataChannel object
|
|
28
53
|
|
|
29
54
|
this._rQi = 0; // Receive queue index
|
|
30
55
|
this._rQlen = 0; // Next write position in the receive queue
|
|
@@ -46,6 +71,29 @@ export default class Websock {
|
|
|
46
71
|
}
|
|
47
72
|
|
|
48
73
|
// Getters and Setters
|
|
74
|
+
|
|
75
|
+
get readyState() {
|
|
76
|
+
let subState;
|
|
77
|
+
|
|
78
|
+
if (this._websocket === null) {
|
|
79
|
+
return "unused";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
subState = this._websocket.readyState;
|
|
83
|
+
|
|
84
|
+
if (ReadyStates.CONNECTING.includes(subState)) {
|
|
85
|
+
return "connecting";
|
|
86
|
+
} else if (ReadyStates.OPEN.includes(subState)) {
|
|
87
|
+
return "open";
|
|
88
|
+
} else if (ReadyStates.CLOSING.includes(subState)) {
|
|
89
|
+
return "closing";
|
|
90
|
+
} else if (ReadyStates.CLOSED.includes(subState)) {
|
|
91
|
+
return "closed";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return "unknown";
|
|
95
|
+
}
|
|
96
|
+
|
|
49
97
|
get sQ() {
|
|
50
98
|
return this._sQ;
|
|
51
99
|
}
|
|
@@ -143,7 +191,7 @@ export default class Websock {
|
|
|
143
191
|
// Send Queue
|
|
144
192
|
|
|
145
193
|
flush() {
|
|
146
|
-
if (this._sQlen > 0 && this.
|
|
194
|
+
if (this._sQlen > 0 && this.readyState === 'open') {
|
|
147
195
|
this._websocket.send(this._encodeMessage());
|
|
148
196
|
this._sQlen = 0;
|
|
149
197
|
}
|
|
@@ -180,12 +228,25 @@ export default class Websock {
|
|
|
180
228
|
}
|
|
181
229
|
|
|
182
230
|
open(uri, protocols) {
|
|
231
|
+
this.attach(new WebSocket(uri, protocols));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
attach(rawChannel) {
|
|
183
235
|
this.init();
|
|
184
236
|
|
|
185
|
-
|
|
186
|
-
|
|
237
|
+
// Must get object and class methods to be compatible with the tests.
|
|
238
|
+
const channelProps = [...Object.keys(rawChannel), ...Object.getOwnPropertyNames(Object.getPrototypeOf(rawChannel))];
|
|
239
|
+
for (let i = 0; i < rawChannelProps.length; i++) {
|
|
240
|
+
const prop = rawChannelProps[i];
|
|
241
|
+
if (channelProps.indexOf(prop) < 0) {
|
|
242
|
+
throw new Error('Raw channel missing property: ' + prop);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
187
245
|
|
|
246
|
+
this._websocket = rawChannel;
|
|
247
|
+
this._websocket.binaryType = "arraybuffer";
|
|
188
248
|
this._websocket.onmessage = this._recvMessage.bind(this);
|
|
249
|
+
|
|
189
250
|
this._websocket.onopen = () => {
|
|
190
251
|
Log.Debug('>> WebSock.onopen');
|
|
191
252
|
if (this._websocket.protocol) {
|
|
@@ -195,11 +256,13 @@ export default class Websock {
|
|
|
195
256
|
this._eventHandlers.open();
|
|
196
257
|
Log.Debug("<< WebSock.onopen");
|
|
197
258
|
};
|
|
259
|
+
|
|
198
260
|
this._websocket.onclose = (e) => {
|
|
199
261
|
Log.Debug(">> WebSock.onclose");
|
|
200
262
|
this._eventHandlers.close(e);
|
|
201
263
|
Log.Debug("<< WebSock.onclose");
|
|
202
264
|
};
|
|
265
|
+
|
|
203
266
|
this._websocket.onerror = (e) => {
|
|
204
267
|
Log.Debug(">> WebSock.onerror: " + e);
|
|
205
268
|
this._eventHandlers.error(e);
|
|
@@ -209,8 +272,8 @@ export default class Websock {
|
|
|
209
272
|
|
|
210
273
|
close() {
|
|
211
274
|
if (this._websocket) {
|
|
212
|
-
if (
|
|
213
|
-
|
|
275
|
+
if (this.readyState === 'connecting' ||
|
|
276
|
+
this.readyState === 'open') {
|
|
214
277
|
Log.Info("Closing WebSocket connection");
|
|
215
278
|
this._websocket.close();
|
|
216
279
|
}
|
|
@@ -256,11 +319,7 @@ export default class Websock {
|
|
|
256
319
|
this._rQ = new Uint8Array(this._rQbufferSize);
|
|
257
320
|
this._rQ.set(new Uint8Array(oldRQbuffer, this._rQi, this._rQlen - this._rQi));
|
|
258
321
|
} else {
|
|
259
|
-
|
|
260
|
-
this._rQ.copyWithin(0, this._rQi, this._rQlen);
|
|
261
|
-
} else {
|
|
262
|
-
this._rQ.set(new Uint8Array(this._rQ.buffer, this._rQi, this._rQlen - this._rQi));
|
|
263
|
-
}
|
|
322
|
+
this._rQ.copyWithin(0, this._rQi, this._rQlen);
|
|
264
323
|
}
|
|
265
324
|
|
|
266
325
|
this._rQlen = this._rQlen - this._rQi;
|
package/docs/API.md
CHANGED
|
@@ -86,9 +86,13 @@ protocol stream.
|
|
|
86
86
|
- The `connect` event is fired when the `RFB` object has completed
|
|
87
87
|
the connection and handshaking with the server.
|
|
88
88
|
|
|
89
|
-
[`disconnect`](#
|
|
89
|
+
[`disconnect`](#disconnect)
|
|
90
90
|
- The `disconnect` event is fired when the `RFB` object disconnects.
|
|
91
91
|
|
|
92
|
+
[`serververification`](#serververification)
|
|
93
|
+
- The `serververification` event is fired when the server identity
|
|
94
|
+
must be confirmed by the user.
|
|
95
|
+
|
|
92
96
|
[`credentialsrequired`](#credentialsrequired)
|
|
93
97
|
- The `credentialsrequired` event is fired when more credentials must
|
|
94
98
|
be given to continue.
|
|
@@ -118,11 +122,16 @@ protocol stream.
|
|
|
118
122
|
[`RFB.disconnect()`](#rfbdisconnect)
|
|
119
123
|
- Disconnect from the server.
|
|
120
124
|
|
|
125
|
+
[`RFB.approveServer()`](#rfbapproveserver)
|
|
126
|
+
- Proceed connecting to the server. Should be called after the
|
|
127
|
+
[`serververification`](#serververification) event has fired and the
|
|
128
|
+
user has verified the identity of the server.
|
|
129
|
+
|
|
121
130
|
[`RFB.sendCredentials()`](#rfbsendcredentials)
|
|
122
131
|
- Send credentials to server. Should be called after the
|
|
123
132
|
[`credentialsrequired`](#credentialsrequired) event has fired.
|
|
124
133
|
|
|
125
|
-
[`RFB.sendKey()`](#
|
|
134
|
+
[`RFB.sendKey()`](#rfbsendkey)
|
|
126
135
|
- Send a key event.
|
|
127
136
|
|
|
128
137
|
[`RFB.sendCtrlAltDel()`](#rfbsendctrlaltdel)
|
|
@@ -143,7 +152,7 @@ protocol stream.
|
|
|
143
152
|
[`RFB.machineReset()`](#rfbmachinereset)
|
|
144
153
|
- Request a reset of the remote machine.
|
|
145
154
|
|
|
146
|
-
[`RFB.clipboardPasteFrom()`](#
|
|
155
|
+
[`RFB.clipboardPasteFrom()`](#rfbclipboardpastefrom)
|
|
147
156
|
- Send clipboard contents to server.
|
|
148
157
|
|
|
149
158
|
### Details
|
|
@@ -165,9 +174,9 @@ connection to a specified VNC server.
|
|
|
165
174
|
existing contents of the `HTMLElement` will be untouched, but new
|
|
166
175
|
elements will be added during the lifetime of the `RFB` object.
|
|
167
176
|
|
|
168
|
-
**`
|
|
177
|
+
**`urlOrDataChannel`**
|
|
169
178
|
- A `DOMString` specifying the VNC server to connect to. This must be
|
|
170
|
-
a valid WebSocket URL.
|
|
179
|
+
a valid WebSocket URL. This can also be a `WebSocket` or `RTCDataChannel`.
|
|
171
180
|
|
|
172
181
|
**`options`** *Optional*
|
|
173
182
|
- An `Object` specifying extra details about how the connection
|
|
@@ -212,6 +221,20 @@ property `clean`. `clean` is a `boolean` indicating if the termination
|
|
|
212
221
|
was clean or not. In the event of an unexpected termination or an error
|
|
213
222
|
`clean` will be set to false.
|
|
214
223
|
|
|
224
|
+
#### serververification
|
|
225
|
+
|
|
226
|
+
The `serververification` event is fired when the server provides
|
|
227
|
+
information that allows the user to verify that it is the correct server
|
|
228
|
+
and protect against a man-in-the-middle attack. The `detail` property is
|
|
229
|
+
an `Object` containing the property `type` which is a `DOMString`
|
|
230
|
+
specifying which type of information the server has provided. Other
|
|
231
|
+
properties are also available, depending on the value of `type`:
|
|
232
|
+
|
|
233
|
+
`"RSA"`
|
|
234
|
+
- The server identity is verified using just a RSA key. The property
|
|
235
|
+
`publickey` is a `Uint8Array` containing the public key in a unsigned
|
|
236
|
+
big endian representation.
|
|
237
|
+
|
|
215
238
|
#### credentialsrequired
|
|
216
239
|
|
|
217
240
|
The `credentialsrequired` event is fired when the server requests more
|
|
@@ -271,6 +294,16 @@ connected server.
|
|
|
271
294
|
|
|
272
295
|
RFB.disconnect( );
|
|
273
296
|
|
|
297
|
+
#### RFB.approveServer()
|
|
298
|
+
|
|
299
|
+
The `RFB.approveServer()` method is used to signal that the user has
|
|
300
|
+
verified the server identity provided in a `serververification` event
|
|
301
|
+
and that the connection can continue.
|
|
302
|
+
|
|
303
|
+
##### Syntax
|
|
304
|
+
|
|
305
|
+
RFB.approveServer( );
|
|
306
|
+
|
|
274
307
|
#### RFB.sendCredentials()
|
|
275
308
|
|
|
276
309
|
The `RFB.sendCredentials()` method is used to provide the missing
|
|
@@ -328,7 +361,14 @@ Keyboard events will be sent to the remote server after this point.
|
|
|
328
361
|
|
|
329
362
|
##### Syntax
|
|
330
363
|
|
|
331
|
-
RFB.focus( );
|
|
364
|
+
RFB.focus( [options] );
|
|
365
|
+
|
|
366
|
+
###### Parameters
|
|
367
|
+
|
|
368
|
+
**`options`** *Optional*
|
|
369
|
+
- A `object` providing options to control how the focus will be
|
|
370
|
+
performed. Please see [`HTMLElement.focus()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)
|
|
371
|
+
for available options.
|
|
332
372
|
|
|
333
373
|
#### RFB.blur()
|
|
334
374
|
|
package/docs/LIBRARY.md
CHANGED
|
@@ -18,18 +18,14 @@ do things.
|
|
|
18
18
|
|
|
19
19
|
## Conversion of Modules
|
|
20
20
|
|
|
21
|
-
noVNC is written using ECMAScript 6 modules.
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
noVNC is written using ECMAScript 6 modules. This is not supported by older
|
|
22
|
+
versions of Node.js. To use noVNC with those older versions of Node.js the
|
|
23
|
+
library must first be converted.
|
|
24
24
|
|
|
25
25
|
Fortunately noVNC includes a script to handle this conversion. Please follow
|
|
26
26
|
the following steps:
|
|
27
27
|
|
|
28
28
|
1. Install Node.js
|
|
29
29
|
2. Run `npm install` in the noVNC directory
|
|
30
|
-
3. Run `./utils/use_require.js --as <module format>`
|
|
31
|
-
|
|
32
|
-
Several module formats are available. Please run
|
|
33
|
-
`./utils/use_require.js --help` to see them all.
|
|
34
30
|
|
|
35
31
|
The result of the conversion is available in the `lib/` directory.
|
package/lib/base64.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var Log = _interopRequireWildcard(require("./util/logging.js"));
|
|
11
11
|
|
|
12
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
12
|
+
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); }
|
|
13
13
|
|
|
14
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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
|
|
14
|
+
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; }
|
|
15
15
|
|
|
16
16
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
17
17
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
@@ -112,4 +112,4 @@ var _default = {
|
|
|
112
112
|
};
|
|
113
113
|
/* End of Base64 namespace */
|
|
114
114
|
|
|
115
|
-
exports
|
|
115
|
+
exports["default"] = _default;
|
package/lib/decoders/copyrect.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
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
|
|
@@ -33,6 +33,11 @@ var CopyRectDecoder = /*#__PURE__*/function () {
|
|
|
33
33
|
|
|
34
34
|
var deltaX = sock.rQshift16();
|
|
35
35
|
var deltaY = sock.rQshift16();
|
|
36
|
+
|
|
37
|
+
if (width === 0 || height === 0) {
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
display.copyImage(deltaX, deltaY, x, y, width, height);
|
|
37
42
|
return true;
|
|
38
43
|
}
|
|
@@ -41,4 +46,4 @@ var CopyRectDecoder = /*#__PURE__*/function () {
|
|
|
41
46
|
return CopyRectDecoder;
|
|
42
47
|
}();
|
|
43
48
|
|
|
44
|
-
exports
|
|
49
|
+
exports["default"] = CopyRectDecoder;
|
package/lib/decoders/hextile.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
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
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var Log = _interopRequireWildcard(require("../util/logging.js"));
|
|
11
11
|
|
|
12
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
12
|
+
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); }
|
|
13
13
|
|
|
14
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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
|
|
14
|
+
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; }
|
|
15
15
|
|
|
16
16
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
17
|
|
|
18
18
|
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); } }
|
|
19
19
|
|
|
20
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
20
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
21
|
|
|
22
22
|
var HextileDecoder = /*#__PURE__*/function () {
|
|
23
23
|
function HextileDecoder() {
|
|
@@ -25,6 +25,7 @@ var HextileDecoder = /*#__PURE__*/function () {
|
|
|
25
25
|
|
|
26
26
|
this._tiles = 0;
|
|
27
27
|
this._lastsubencoding = 0;
|
|
28
|
+
this._tileBuffer = new Uint8Array(16 * 16 * 4);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
_createClass(HextileDecoder, [{
|
|
@@ -110,6 +111,12 @@ var HextileDecoder = /*#__PURE__*/function () {
|
|
|
110
111
|
}
|
|
111
112
|
} else if (subencoding & 0x01) {
|
|
112
113
|
// Raw
|
|
114
|
+
var pixels = tw * th; // Max sure the image is fully opaque
|
|
115
|
+
|
|
116
|
+
for (var i = 0; i < pixels; i++) {
|
|
117
|
+
rQ[rQi + i * 4 + 3] = 255;
|
|
118
|
+
}
|
|
119
|
+
|
|
113
120
|
display.blitImage(tx, ty, tw, th, rQ, rQi);
|
|
114
121
|
rQi += bytes - 1;
|
|
115
122
|
} else {
|
|
@@ -125,7 +132,7 @@ var HextileDecoder = /*#__PURE__*/function () {
|
|
|
125
132
|
rQi += 4;
|
|
126
133
|
}
|
|
127
134
|
|
|
128
|
-
|
|
135
|
+
this._startTile(tx, ty, tw, th, this._background);
|
|
129
136
|
|
|
130
137
|
if (subencoding & 0x08) {
|
|
131
138
|
// AnySubrects
|
|
@@ -151,11 +158,12 @@ var HextileDecoder = /*#__PURE__*/function () {
|
|
|
151
158
|
rQi++;
|
|
152
159
|
var sw = (wh >> 4) + 1;
|
|
153
160
|
var sh = (wh & 0x0f) + 1;
|
|
154
|
-
|
|
161
|
+
|
|
162
|
+
this._subTile(sx, sy, sw, sh, color);
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
165
|
|
|
158
|
-
|
|
166
|
+
this._finishTile(display);
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
sock.rQi = rQi;
|
|
@@ -164,10 +172,58 @@ var HextileDecoder = /*#__PURE__*/function () {
|
|
|
164
172
|
}
|
|
165
173
|
|
|
166
174
|
return true;
|
|
175
|
+
} // start updating a tile
|
|
176
|
+
|
|
177
|
+
}, {
|
|
178
|
+
key: "_startTile",
|
|
179
|
+
value: function _startTile(x, y, width, height, color) {
|
|
180
|
+
this._tileX = x;
|
|
181
|
+
this._tileY = y;
|
|
182
|
+
this._tileW = width;
|
|
183
|
+
this._tileH = height;
|
|
184
|
+
var red = color[0];
|
|
185
|
+
var green = color[1];
|
|
186
|
+
var blue = color[2];
|
|
187
|
+
var data = this._tileBuffer;
|
|
188
|
+
|
|
189
|
+
for (var i = 0; i < width * height * 4; i += 4) {
|
|
190
|
+
data[i] = red;
|
|
191
|
+
data[i + 1] = green;
|
|
192
|
+
data[i + 2] = blue;
|
|
193
|
+
data[i + 3] = 255;
|
|
194
|
+
}
|
|
195
|
+
} // update sub-rectangle of the current tile
|
|
196
|
+
|
|
197
|
+
}, {
|
|
198
|
+
key: "_subTile",
|
|
199
|
+
value: function _subTile(x, y, w, h, color) {
|
|
200
|
+
var red = color[0];
|
|
201
|
+
var green = color[1];
|
|
202
|
+
var blue = color[2];
|
|
203
|
+
var xend = x + w;
|
|
204
|
+
var yend = y + h;
|
|
205
|
+
var data = this._tileBuffer;
|
|
206
|
+
var width = this._tileW;
|
|
207
|
+
|
|
208
|
+
for (var j = y; j < yend; j++) {
|
|
209
|
+
for (var i = x; i < xend; i++) {
|
|
210
|
+
var p = (i + j * width) * 4;
|
|
211
|
+
data[p] = red;
|
|
212
|
+
data[p + 1] = green;
|
|
213
|
+
data[p + 2] = blue;
|
|
214
|
+
data[p + 3] = 255;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
} // draw the current tile to the screen
|
|
218
|
+
|
|
219
|
+
}, {
|
|
220
|
+
key: "_finishTile",
|
|
221
|
+
value: function _finishTile(display) {
|
|
222
|
+
display.blitImage(this._tileX, this._tileY, this._tileW, this._tileH, this._tileBuffer, 0);
|
|
167
223
|
}
|
|
168
224
|
}]);
|
|
169
225
|
|
|
170
226
|
return HextileDecoder;
|
|
171
227
|
}();
|
|
172
228
|
|
|
173
|
-
exports
|
|
229
|
+
exports["default"] = HextileDecoder;
|