mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-29 17:12:20 +00:00
update
This commit is contained in:
12
public/novnc/.gitignore
vendored
12
public/novnc/.gitignore
vendored
@@ -1,12 +0,0 @@
|
||||
*.pyc
|
||||
*.o
|
||||
tests/data_*.js
|
||||
utils/rebind.so
|
||||
utils/websockify
|
||||
/node_modules
|
||||
/build
|
||||
/lib
|
||||
recordings
|
||||
*.swp
|
||||
*~
|
||||
noVNC-*.tgz
|
||||
115
public/novnc/lib/base64.js
Normal file
115
public/novnc/lib/base64.js
Normal file
@@ -0,0 +1,115 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("./util/logging.js"));
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
// From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js
|
||||
var _default = {
|
||||
/* Convert data (an array of integers) to a Base64 string. */
|
||||
toBase64Table: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
|
||||
base64Pad: '=',
|
||||
encode: function encode(data) {
|
||||
"use strict";
|
||||
|
||||
var result = '';
|
||||
var length = data.length;
|
||||
var lengthpad = length % 3; // Convert every three bytes to 4 ascii characters.
|
||||
|
||||
for (var i = 0; i < length - 2; i += 3) {
|
||||
result += this.toBase64Table[data[i] >> 2];
|
||||
result += this.toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
|
||||
result += this.toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
|
||||
result += this.toBase64Table[data[i + 2] & 0x3f];
|
||||
} // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
|
||||
|
||||
|
||||
var j = length - lengthpad;
|
||||
|
||||
if (lengthpad === 2) {
|
||||
result += this.toBase64Table[data[j] >> 2];
|
||||
result += this.toBase64Table[((data[j] & 0x03) << 4) + (data[j + 1] >> 4)];
|
||||
result += this.toBase64Table[(data[j + 1] & 0x0f) << 2];
|
||||
result += this.toBase64Table[64];
|
||||
} else if (lengthpad === 1) {
|
||||
result += this.toBase64Table[data[j] >> 2];
|
||||
result += this.toBase64Table[(data[j] & 0x03) << 4];
|
||||
result += this.toBase64Table[64];
|
||||
result += this.toBase64Table[64];
|
||||
}
|
||||
|
||||
return result;
|
||||
},
|
||||
|
||||
/* Convert Base64 data to a string */
|
||||
|
||||
/* eslint-disable comma-spacing */
|
||||
toBinaryTable: [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1],
|
||||
|
||||
/* eslint-enable comma-spacing */
|
||||
decode: function decode(data) {
|
||||
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var dataLength = data.indexOf('=') - offset;
|
||||
|
||||
if (dataLength < 0) {
|
||||
dataLength = data.length - offset;
|
||||
}
|
||||
/* Every four characters is 3 resulting numbers */
|
||||
|
||||
|
||||
var resultLength = (dataLength >> 2) * 3 + Math.floor(dataLength % 4 / 1.5);
|
||||
var result = new Array(resultLength); // Convert one by one.
|
||||
|
||||
var leftbits = 0; // number of bits decoded, but yet to be appended
|
||||
|
||||
var leftdata = 0; // bits decoded, but yet to be appended
|
||||
|
||||
for (var idx = 0, i = offset; i < data.length; i++) {
|
||||
var c = this.toBinaryTable[data.charCodeAt(i) & 0x7f];
|
||||
var padding = data.charAt(i) === this.base64Pad; // Skip illegal characters and whitespace
|
||||
|
||||
if (c === -1) {
|
||||
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
|
||||
continue;
|
||||
} // Collect data into leftdata, update bitcount
|
||||
|
||||
|
||||
leftdata = leftdata << 6 | c;
|
||||
leftbits += 6; // If we have 8 or more bits, append 8 bits to the result
|
||||
|
||||
if (leftbits >= 8) {
|
||||
leftbits -= 8; // Append if not padding.
|
||||
|
||||
if (!padding) {
|
||||
result[idx++] = leftdata >> leftbits & 0xff;
|
||||
}
|
||||
|
||||
leftdata &= (1 << leftbits) - 1;
|
||||
}
|
||||
} // If there are any bits left, the base64 string was corrupted
|
||||
|
||||
|
||||
if (leftbits) {
|
||||
var err = new Error('Corrupted base64 string');
|
||||
err.name = 'Base64-Error';
|
||||
throw err;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
/* End of Base64 namespace */
|
||||
|
||||
exports["default"] = _default;
|
||||
49
public/novnc/lib/decoders/copyrect.js
Normal file
49
public/novnc/lib/decoders/copyrect.js
Normal file
@@ -0,0 +1,49 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
*/
|
||||
var CopyRectDecoder = /*#__PURE__*/function () {
|
||||
function CopyRectDecoder() {
|
||||
_classCallCheck(this, CopyRectDecoder);
|
||||
}
|
||||
|
||||
_createClass(CopyRectDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (sock.rQwait("COPYRECT", 4)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var deltaX = sock.rQshift16();
|
||||
var deltaY = sock.rQshift16();
|
||||
|
||||
if (width === 0 || height === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
display.copyImage(deltaX, deltaY, x, y, width, height);
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
||||
return CopyRectDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = CopyRectDecoder;
|
||||
229
public/novnc/lib/decoders/hextile.js
Normal file
229
public/novnc/lib/decoders/hextile.js
Normal file
@@ -0,0 +1,229 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("../util/logging.js"));
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var HextileDecoder = /*#__PURE__*/function () {
|
||||
function HextileDecoder() {
|
||||
_classCallCheck(this, HextileDecoder);
|
||||
|
||||
this._tiles = 0;
|
||||
this._lastsubencoding = 0;
|
||||
this._tileBuffer = new Uint8Array(16 * 16 * 4);
|
||||
}
|
||||
|
||||
_createClass(HextileDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (this._tiles === 0) {
|
||||
this._tilesX = Math.ceil(width / 16);
|
||||
this._tilesY = Math.ceil(height / 16);
|
||||
this._totalTiles = this._tilesX * this._tilesY;
|
||||
this._tiles = this._totalTiles;
|
||||
}
|
||||
|
||||
while (this._tiles > 0) {
|
||||
var bytes = 1;
|
||||
|
||||
if (sock.rQwait("HEXTILE", bytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var rQ = sock.rQ;
|
||||
var rQi = sock.rQi;
|
||||
var subencoding = rQ[rQi]; // Peek
|
||||
|
||||
if (subencoding > 30) {
|
||||
// Raw
|
||||
throw new Error("Illegal hextile subencoding (subencoding: " + subencoding + ")");
|
||||
}
|
||||
|
||||
var currTile = this._totalTiles - this._tiles;
|
||||
var tileX = currTile % this._tilesX;
|
||||
var tileY = Math.floor(currTile / this._tilesX);
|
||||
var tx = x + tileX * 16;
|
||||
var ty = y + tileY * 16;
|
||||
var tw = Math.min(16, x + width - tx);
|
||||
var th = Math.min(16, y + height - ty); // Figure out how much we are expecting
|
||||
|
||||
if (subencoding & 0x01) {
|
||||
// Raw
|
||||
bytes += tw * th * 4;
|
||||
} else {
|
||||
if (subencoding & 0x02) {
|
||||
// Background
|
||||
bytes += 4;
|
||||
}
|
||||
|
||||
if (subencoding & 0x04) {
|
||||
// Foreground
|
||||
bytes += 4;
|
||||
}
|
||||
|
||||
if (subencoding & 0x08) {
|
||||
// AnySubrects
|
||||
bytes++; // Since we aren't shifting it off
|
||||
|
||||
if (sock.rQwait("HEXTILE", bytes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var subrects = rQ[rQi + bytes - 1]; // Peek
|
||||
|
||||
if (subencoding & 0x10) {
|
||||
// SubrectsColoured
|
||||
bytes += subrects * (4 + 2);
|
||||
} else {
|
||||
bytes += subrects * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sock.rQwait("HEXTILE", bytes)) {
|
||||
return false;
|
||||
} // We know the encoding and have a whole tile
|
||||
|
||||
|
||||
rQi++;
|
||||
|
||||
if (subencoding === 0) {
|
||||
if (this._lastsubencoding & 0x01) {
|
||||
// Weird: ignore blanks are RAW
|
||||
Log.Debug(" Ignoring blank after RAW");
|
||||
} else {
|
||||
display.fillRect(tx, ty, tw, th, this._background);
|
||||
}
|
||||
} else if (subencoding & 0x01) {
|
||||
// Raw
|
||||
var pixels = tw * th; // Max sure the image is fully opaque
|
||||
|
||||
for (var i = 0; i < pixels; i++) {
|
||||
rQ[rQi + i * 4 + 3] = 255;
|
||||
}
|
||||
|
||||
display.blitImage(tx, ty, tw, th, rQ, rQi);
|
||||
rQi += bytes - 1;
|
||||
} else {
|
||||
if (subencoding & 0x02) {
|
||||
// Background
|
||||
this._background = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]];
|
||||
rQi += 4;
|
||||
}
|
||||
|
||||
if (subencoding & 0x04) {
|
||||
// Foreground
|
||||
this._foreground = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]];
|
||||
rQi += 4;
|
||||
}
|
||||
|
||||
this._startTile(tx, ty, tw, th, this._background);
|
||||
|
||||
if (subencoding & 0x08) {
|
||||
// AnySubrects
|
||||
var _subrects = rQ[rQi];
|
||||
rQi++;
|
||||
|
||||
for (var s = 0; s < _subrects; s++) {
|
||||
var color = void 0;
|
||||
|
||||
if (subencoding & 0x10) {
|
||||
// SubrectsColoured
|
||||
color = [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2], rQ[rQi + 3]];
|
||||
rQi += 4;
|
||||
} else {
|
||||
color = this._foreground;
|
||||
}
|
||||
|
||||
var xy = rQ[rQi];
|
||||
rQi++;
|
||||
var sx = xy >> 4;
|
||||
var sy = xy & 0x0f;
|
||||
var wh = rQ[rQi];
|
||||
rQi++;
|
||||
var sw = (wh >> 4) + 1;
|
||||
var sh = (wh & 0x0f) + 1;
|
||||
|
||||
this._subTile(sx, sy, sw, sh, color);
|
||||
}
|
||||
}
|
||||
|
||||
this._finishTile(display);
|
||||
}
|
||||
|
||||
sock.rQi = rQi;
|
||||
this._lastsubencoding = subencoding;
|
||||
this._tiles--;
|
||||
}
|
||||
|
||||
return true;
|
||||
} // start updating a tile
|
||||
|
||||
}, {
|
||||
key: "_startTile",
|
||||
value: function _startTile(x, y, width, height, color) {
|
||||
this._tileX = x;
|
||||
this._tileY = y;
|
||||
this._tileW = width;
|
||||
this._tileH = height;
|
||||
var red = color[0];
|
||||
var green = color[1];
|
||||
var blue = color[2];
|
||||
var data = this._tileBuffer;
|
||||
|
||||
for (var i = 0; i < width * height * 4; i += 4) {
|
||||
data[i] = red;
|
||||
data[i + 1] = green;
|
||||
data[i + 2] = blue;
|
||||
data[i + 3] = 255;
|
||||
}
|
||||
} // update sub-rectangle of the current tile
|
||||
|
||||
}, {
|
||||
key: "_subTile",
|
||||
value: function _subTile(x, y, w, h, color) {
|
||||
var red = color[0];
|
||||
var green = color[1];
|
||||
var blue = color[2];
|
||||
var xend = x + w;
|
||||
var yend = y + h;
|
||||
var data = this._tileBuffer;
|
||||
var width = this._tileW;
|
||||
|
||||
for (var j = y; j < yend; j++) {
|
||||
for (var i = x; i < xend; i++) {
|
||||
var p = (i + j * width) * 4;
|
||||
data[p] = red;
|
||||
data[p + 1] = green;
|
||||
data[p + 2] = blue;
|
||||
data[p + 3] = 255;
|
||||
}
|
||||
}
|
||||
} // draw the current tile to the screen
|
||||
|
||||
}, {
|
||||
key: "_finishTile",
|
||||
value: function _finishTile(display) {
|
||||
display.blitImage(this._tileX, this._tileY, this._tileW, this._tileH, this._tileBuffer, 0);
|
||||
}
|
||||
}]);
|
||||
|
||||
return HextileDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = HextileDecoder;
|
||||
188
public/novnc/lib/decoders/jpeg.js
Normal file
188
public/novnc/lib/decoders/jpeg.js
Normal file
@@ -0,0 +1,188 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
*/
|
||||
var JPEGDecoder = /*#__PURE__*/function () {
|
||||
function JPEGDecoder() {
|
||||
_classCallCheck(this, JPEGDecoder);
|
||||
|
||||
// RealVNC will reuse the quantization tables
|
||||
// and Huffman tables, so we need to cache them.
|
||||
this._quantTables = [];
|
||||
this._huffmanTables = [];
|
||||
this._cachedQuantTables = [];
|
||||
this._cachedHuffmanTables = [];
|
||||
this._jpegLength = 0;
|
||||
this._segments = [];
|
||||
}
|
||||
|
||||
_createClass(JPEGDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
// A rect of JPEG encodings is simply a JPEG file
|
||||
if (!this._parseJPEG(sock.rQslice(0))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = sock.rQshiftBytes(this._jpegLength);
|
||||
|
||||
if (this._quantTables.length != 0 && this._huffmanTables.length != 0) {
|
||||
// If there are quantization tables and Huffman tables in the JPEG
|
||||
// image, we can directly render it.
|
||||
display.imageRect(x, y, width, height, "image/jpeg", data);
|
||||
return true;
|
||||
} else {
|
||||
// Otherwise we need to insert cached tables.
|
||||
var sofIndex = this._segments.findIndex(function (x) {
|
||||
return x[1] == 0xC0 || x[1] == 0xC2;
|
||||
});
|
||||
|
||||
if (sofIndex == -1) {
|
||||
throw new Error("Illegal JPEG image without SOF");
|
||||
}
|
||||
|
||||
var segments = this._segments.slice(0, sofIndex);
|
||||
|
||||
segments = segments.concat(this._quantTables.length ? this._quantTables : this._cachedQuantTables);
|
||||
segments.push(this._segments[sofIndex]);
|
||||
segments = segments.concat(this._huffmanTables.length ? this._huffmanTables : this._cachedHuffmanTables, this._segments.slice(sofIndex + 1));
|
||||
var length = 0;
|
||||
|
||||
for (var i = 0; i < segments.length; i++) {
|
||||
length += segments[i].length;
|
||||
}
|
||||
|
||||
var _data = new Uint8Array(length);
|
||||
|
||||
length = 0;
|
||||
|
||||
for (var _i = 0; _i < segments.length; _i++) {
|
||||
_data.set(segments[_i], length);
|
||||
|
||||
length += segments[_i].length;
|
||||
}
|
||||
|
||||
display.imageRect(x, y, width, height, "image/jpeg", _data);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_parseJPEG",
|
||||
value: function _parseJPEG(buffer) {
|
||||
if (this._quantTables.length != 0) {
|
||||
this._cachedQuantTables = this._quantTables;
|
||||
}
|
||||
|
||||
if (this._huffmanTables.length != 0) {
|
||||
this._cachedHuffmanTables = this._huffmanTables;
|
||||
}
|
||||
|
||||
this._quantTables = [];
|
||||
this._huffmanTables = [];
|
||||
this._segments = [];
|
||||
var i = 0;
|
||||
var bufferLength = buffer.length;
|
||||
|
||||
while (true) {
|
||||
var j = i;
|
||||
|
||||
if (j + 2 > bufferLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (buffer[j] != 0xFF) {
|
||||
throw new Error("Illegal JPEG marker received (byte: " + buffer[j] + ")");
|
||||
}
|
||||
|
||||
var type = buffer[j + 1];
|
||||
j += 2;
|
||||
|
||||
if (type == 0xD9) {
|
||||
this._jpegLength = j;
|
||||
|
||||
this._segments.push(buffer.slice(i, j));
|
||||
|
||||
return true;
|
||||
} else if (type == 0xDA) {
|
||||
// start of scan
|
||||
var hasFoundEndOfScan = false;
|
||||
|
||||
for (var k = j + 3; k + 1 < bufferLength; k++) {
|
||||
if (buffer[k] == 0xFF && buffer[k + 1] != 0x00 && !(buffer[k + 1] >= 0xD0 && buffer[k + 1] <= 0xD7)) {
|
||||
j = k;
|
||||
hasFoundEndOfScan = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasFoundEndOfScan) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._segments.push(buffer.slice(i, j));
|
||||
|
||||
i = j;
|
||||
continue;
|
||||
} else if (type >= 0xD0 && type < 0xD9 || type == 0x01) {
|
||||
// No length after marker
|
||||
this._segments.push(buffer.slice(i, j));
|
||||
|
||||
i = j;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (j + 2 > bufferLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var length = (buffer[j] << 8) + buffer[j + 1] - 2;
|
||||
|
||||
if (length < 0) {
|
||||
throw new Error("Illegal JPEG length received (length: " + length + ")");
|
||||
}
|
||||
|
||||
j += 2;
|
||||
|
||||
if (j + length > bufferLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
j += length;
|
||||
var segment = buffer.slice(i, j);
|
||||
|
||||
if (type == 0xC4) {
|
||||
// Huffman tables
|
||||
this._huffmanTables.push(segment);
|
||||
} else if (type == 0xDB) {
|
||||
// Quantization tables
|
||||
this._quantTables.push(segment);
|
||||
}
|
||||
|
||||
this._segments.push(segment);
|
||||
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return JPEGDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = JPEGDecoder;
|
||||
87
public/novnc/lib/decoders/raw.js
Normal file
87
public/novnc/lib/decoders/raw.js
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
*/
|
||||
var RawDecoder = /*#__PURE__*/function () {
|
||||
function RawDecoder() {
|
||||
_classCallCheck(this, RawDecoder);
|
||||
|
||||
this._lines = 0;
|
||||
}
|
||||
|
||||
_createClass(RawDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (width === 0 || height === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this._lines === 0) {
|
||||
this._lines = height;
|
||||
}
|
||||
|
||||
var pixelSize = depth == 8 ? 1 : 4;
|
||||
var bytesPerLine = width * pixelSize;
|
||||
|
||||
if (sock.rQwait("RAW", bytesPerLine)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var curY = y + (height - this._lines);
|
||||
var currHeight = Math.min(this._lines, Math.floor(sock.rQlen / bytesPerLine));
|
||||
var pixels = width * currHeight;
|
||||
var data = sock.rQ;
|
||||
var index = sock.rQi; // Convert data if needed
|
||||
|
||||
if (depth == 8) {
|
||||
var newdata = new Uint8Array(pixels * 4);
|
||||
|
||||
for (var i = 0; i < pixels; i++) {
|
||||
newdata[i * 4 + 0] = (data[index + i] >> 0 & 0x3) * 255 / 3;
|
||||
newdata[i * 4 + 1] = (data[index + i] >> 2 & 0x3) * 255 / 3;
|
||||
newdata[i * 4 + 2] = (data[index + i] >> 4 & 0x3) * 255 / 3;
|
||||
newdata[i * 4 + 3] = 255;
|
||||
}
|
||||
|
||||
data = newdata;
|
||||
index = 0;
|
||||
} // Max sure the image is fully opaque
|
||||
|
||||
|
||||
for (var _i = 0; _i < pixels; _i++) {
|
||||
data[index + _i * 4 + 3] = 255;
|
||||
}
|
||||
|
||||
display.blitImage(x, curY, width, currHeight, data, index);
|
||||
sock.rQskipBytes(currHeight * bytesPerLine);
|
||||
this._lines -= currHeight;
|
||||
|
||||
if (this._lines > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
||||
return RawDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = RawDecoder;
|
||||
65
public/novnc/lib/decoders/rre.js
Normal file
65
public/novnc/lib/decoders/rre.js
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
*/
|
||||
var RREDecoder = /*#__PURE__*/function () {
|
||||
function RREDecoder() {
|
||||
_classCallCheck(this, RREDecoder);
|
||||
|
||||
this._subrects = 0;
|
||||
}
|
||||
|
||||
_createClass(RREDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (this._subrects === 0) {
|
||||
if (sock.rQwait("RRE", 4 + 4)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._subrects = sock.rQshift32();
|
||||
var color = sock.rQshiftBytes(4); // Background
|
||||
|
||||
display.fillRect(x, y, width, height, color);
|
||||
}
|
||||
|
||||
while (this._subrects > 0) {
|
||||
if (sock.rQwait("RRE", 4 + 8)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var _color = sock.rQshiftBytes(4);
|
||||
|
||||
var sx = sock.rQshift16();
|
||||
var sy = sock.rQshift16();
|
||||
var swidth = sock.rQshift16();
|
||||
var sheight = sock.rQshift16();
|
||||
display.fillRect(x + sx, y + sy, swidth, sheight, _color);
|
||||
this._subrects--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
||||
return RREDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = RREDecoder;
|
||||
368
public/novnc/lib/decoders/tight.js
Normal file
368
public/novnc/lib/decoders/tight.js
Normal file
@@ -0,0 +1,368 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("../util/logging.js"));
|
||||
|
||||
var _inflator = _interopRequireDefault(require("../inflator.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var TightDecoder = /*#__PURE__*/function () {
|
||||
function TightDecoder() {
|
||||
_classCallCheck(this, TightDecoder);
|
||||
|
||||
this._ctl = null;
|
||||
this._filter = null;
|
||||
this._numColors = 0;
|
||||
this._palette = new Uint8Array(1024); // 256 * 4 (max palette size * max bytes-per-pixel)
|
||||
|
||||
this._len = 0;
|
||||
this._zlibs = [];
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
this._zlibs[i] = new _inflator["default"]();
|
||||
}
|
||||
}
|
||||
|
||||
_createClass(TightDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (this._ctl === null) {
|
||||
if (sock.rQwait("TIGHT compression-control", 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._ctl = sock.rQshift8(); // Reset streams if the server requests it
|
||||
|
||||
for (var i = 0; i < 4; i++) {
|
||||
if (this._ctl >> i & 1) {
|
||||
this._zlibs[i].reset();
|
||||
|
||||
Log.Info("Reset zlib stream " + i);
|
||||
}
|
||||
} // Figure out filter
|
||||
|
||||
|
||||
this._ctl = this._ctl >> 4;
|
||||
}
|
||||
|
||||
var ret;
|
||||
|
||||
if (this._ctl === 0x08) {
|
||||
ret = this._fillRect(x, y, width, height, sock, display, depth);
|
||||
} else if (this._ctl === 0x09) {
|
||||
ret = this._jpegRect(x, y, width, height, sock, display, depth);
|
||||
} else if (this._ctl === 0x0A) {
|
||||
ret = this._pngRect(x, y, width, height, sock, display, depth);
|
||||
} else if ((this._ctl & 0x08) == 0) {
|
||||
ret = this._basicRect(this._ctl, x, y, width, height, sock, display, depth);
|
||||
} else {
|
||||
throw new Error("Illegal tight compression received (ctl: " + this._ctl + ")");
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
this._ctl = null;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}, {
|
||||
key: "_fillRect",
|
||||
value: function _fillRect(x, y, width, height, sock, display, depth) {
|
||||
if (sock.rQwait("TIGHT", 3)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var rQi = sock.rQi;
|
||||
var rQ = sock.rQ;
|
||||
display.fillRect(x, y, width, height, [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2]], false);
|
||||
sock.rQskipBytes(3);
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_jpegRect",
|
||||
value: function _jpegRect(x, y, width, height, sock, display, depth) {
|
||||
var data = this._readData(sock);
|
||||
|
||||
if (data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
display.imageRect(x, y, width, height, "image/jpeg", data);
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_pngRect",
|
||||
value: function _pngRect(x, y, width, height, sock, display, depth) {
|
||||
throw new Error("PNG received in standard Tight rect");
|
||||
}
|
||||
}, {
|
||||
key: "_basicRect",
|
||||
value: function _basicRect(ctl, x, y, width, height, sock, display, depth) {
|
||||
if (this._filter === null) {
|
||||
if (ctl & 0x4) {
|
||||
if (sock.rQwait("TIGHT", 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._filter = sock.rQshift8();
|
||||
} else {
|
||||
// Implicit CopyFilter
|
||||
this._filter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
var streamId = ctl & 0x3;
|
||||
var ret;
|
||||
|
||||
switch (this._filter) {
|
||||
case 0:
|
||||
// CopyFilter
|
||||
ret = this._copyFilter(streamId, x, y, width, height, sock, display, depth);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// PaletteFilter
|
||||
ret = this._paletteFilter(streamId, x, y, width, height, sock, display, depth);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
// GradientFilter
|
||||
ret = this._gradientFilter(streamId, x, y, width, height, sock, display, depth);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Error("Illegal tight filter received (ctl: " + this._filter + ")");
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
this._filter = null;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}, {
|
||||
key: "_copyFilter",
|
||||
value: function _copyFilter(streamId, x, y, width, height, sock, display, depth) {
|
||||
var uncompressedSize = width * height * 3;
|
||||
var data;
|
||||
|
||||
if (uncompressedSize === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (uncompressedSize < 12) {
|
||||
if (sock.rQwait("TIGHT", uncompressedSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
data = sock.rQshiftBytes(uncompressedSize);
|
||||
} else {
|
||||
data = this._readData(sock);
|
||||
|
||||
if (data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._zlibs[streamId].setInput(data);
|
||||
|
||||
data = this._zlibs[streamId].inflate(uncompressedSize);
|
||||
|
||||
this._zlibs[streamId].setInput(null);
|
||||
}
|
||||
|
||||
var rgbx = new Uint8Array(width * height * 4);
|
||||
|
||||
for (var i = 0, j = 0; i < width * height * 4; i += 4, j += 3) {
|
||||
rgbx[i] = data[j];
|
||||
rgbx[i + 1] = data[j + 1];
|
||||
rgbx[i + 2] = data[j + 2];
|
||||
rgbx[i + 3] = 255; // Alpha
|
||||
}
|
||||
|
||||
display.blitImage(x, y, width, height, rgbx, 0, false);
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_paletteFilter",
|
||||
value: function _paletteFilter(streamId, x, y, width, height, sock, display, depth) {
|
||||
if (this._numColors === 0) {
|
||||
if (sock.rQwait("TIGHT palette", 1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var numColors = sock.rQpeek8() + 1;
|
||||
var paletteSize = numColors * 3;
|
||||
|
||||
if (sock.rQwait("TIGHT palette", 1 + paletteSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._numColors = numColors;
|
||||
sock.rQskipBytes(1);
|
||||
sock.rQshiftTo(this._palette, paletteSize);
|
||||
}
|
||||
|
||||
var bpp = this._numColors <= 2 ? 1 : 8;
|
||||
var rowSize = Math.floor((width * bpp + 7) / 8);
|
||||
var uncompressedSize = rowSize * height;
|
||||
var data;
|
||||
|
||||
if (uncompressedSize === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (uncompressedSize < 12) {
|
||||
if (sock.rQwait("TIGHT", uncompressedSize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
data = sock.rQshiftBytes(uncompressedSize);
|
||||
} else {
|
||||
data = this._readData(sock);
|
||||
|
||||
if (data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._zlibs[streamId].setInput(data);
|
||||
|
||||
data = this._zlibs[streamId].inflate(uncompressedSize);
|
||||
|
||||
this._zlibs[streamId].setInput(null);
|
||||
} // Convert indexed (palette based) image data to RGB
|
||||
|
||||
|
||||
if (this._numColors == 2) {
|
||||
this._monoRect(x, y, width, height, data, this._palette, display);
|
||||
} else {
|
||||
this._paletteRect(x, y, width, height, data, this._palette, display);
|
||||
}
|
||||
|
||||
this._numColors = 0;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_monoRect",
|
||||
value: function _monoRect(x, y, width, height, data, palette, display) {
|
||||
// Convert indexed (palette based) image data to RGB
|
||||
// TODO: reduce number of calculations inside loop
|
||||
var dest = this._getScratchBuffer(width * height * 4);
|
||||
|
||||
var w = Math.floor((width + 7) / 8);
|
||||
var w1 = Math.floor(width / 8);
|
||||
|
||||
for (var _y = 0; _y < height; _y++) {
|
||||
var dp = void 0,
|
||||
sp = void 0,
|
||||
_x = void 0;
|
||||
|
||||
for (_x = 0; _x < w1; _x++) {
|
||||
for (var b = 7; b >= 0; b--) {
|
||||
dp = (_y * width + _x * 8 + 7 - b) * 4;
|
||||
sp = (data[_y * w + _x] >> b & 1) * 3;
|
||||
dest[dp] = palette[sp];
|
||||
dest[dp + 1] = palette[sp + 1];
|
||||
dest[dp + 2] = palette[sp + 2];
|
||||
dest[dp + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
for (var _b = 7; _b >= 8 - width % 8; _b--) {
|
||||
dp = (_y * width + _x * 8 + 7 - _b) * 4;
|
||||
sp = (data[_y * w + _x] >> _b & 1) * 3;
|
||||
dest[dp] = palette[sp];
|
||||
dest[dp + 1] = palette[sp + 1];
|
||||
dest[dp + 2] = palette[sp + 2];
|
||||
dest[dp + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
display.blitImage(x, y, width, height, dest, 0, false);
|
||||
}
|
||||
}, {
|
||||
key: "_paletteRect",
|
||||
value: function _paletteRect(x, y, width, height, data, palette, display) {
|
||||
// Convert indexed (palette based) image data to RGB
|
||||
var dest = this._getScratchBuffer(width * height * 4);
|
||||
|
||||
var total = width * height * 4;
|
||||
|
||||
for (var i = 0, j = 0; i < total; i += 4, j++) {
|
||||
var sp = data[j] * 3;
|
||||
dest[i] = palette[sp];
|
||||
dest[i + 1] = palette[sp + 1];
|
||||
dest[i + 2] = palette[sp + 2];
|
||||
dest[i + 3] = 255;
|
||||
}
|
||||
|
||||
display.blitImage(x, y, width, height, dest, 0, false);
|
||||
}
|
||||
}, {
|
||||
key: "_gradientFilter",
|
||||
value: function _gradientFilter(streamId, x, y, width, height, sock, display, depth) {
|
||||
throw new Error("Gradient filter not implemented");
|
||||
}
|
||||
}, {
|
||||
key: "_readData",
|
||||
value: function _readData(sock) {
|
||||
if (this._len === 0) {
|
||||
if (sock.rQwait("TIGHT", 3)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var _byte;
|
||||
|
||||
_byte = sock.rQshift8();
|
||||
this._len = _byte & 0x7f;
|
||||
|
||||
if (_byte & 0x80) {
|
||||
_byte = sock.rQshift8();
|
||||
this._len |= (_byte & 0x7f) << 7;
|
||||
|
||||
if (_byte & 0x80) {
|
||||
_byte = sock.rQshift8();
|
||||
this._len |= _byte << 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (sock.rQwait("TIGHT", this._len)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var data = sock.rQshiftBytes(this._len);
|
||||
this._len = 0;
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "_getScratchBuffer",
|
||||
value: function _getScratchBuffer(size) {
|
||||
if (!this._scratchBuffer || this._scratchBuffer.length < size) {
|
||||
this._scratchBuffer = new Uint8Array(size);
|
||||
}
|
||||
|
||||
return this._scratchBuffer;
|
||||
}
|
||||
}]);
|
||||
|
||||
return TightDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = TightDecoder;
|
||||
67
public/novnc/lib/decoders/tightpng.js
Normal file
67
public/novnc/lib/decoders/tightpng.js
Normal file
@@ -0,0 +1,67 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _tight = _interopRequireDefault(require("./tight.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var TightPNGDecoder = /*#__PURE__*/function (_TightDecoder) {
|
||||
_inherits(TightPNGDecoder, _TightDecoder);
|
||||
|
||||
var _super = _createSuper(TightPNGDecoder);
|
||||
|
||||
function TightPNGDecoder() {
|
||||
_classCallCheck(this, TightPNGDecoder);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(TightPNGDecoder, [{
|
||||
key: "_pngRect",
|
||||
value: function _pngRect(x, y, width, height, sock, display, depth) {
|
||||
var data = this._readData(sock);
|
||||
|
||||
if (data === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
display.imageRect(x, y, width, height, "image/png", data);
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_basicRect",
|
||||
value: function _basicRect(ctl, x, y, width, height, sock, display, depth) {
|
||||
throw new Error("BasicCompression received in TightPNG rect");
|
||||
}
|
||||
}]);
|
||||
|
||||
return TightPNGDecoder;
|
||||
}(_tight["default"]);
|
||||
|
||||
exports["default"] = TightPNGDecoder;
|
||||
234
public/novnc/lib/decoders/zrle.js
Normal file
234
public/novnc/lib/decoders/zrle.js
Normal file
@@ -0,0 +1,234 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _inflator = _interopRequireDefault(require("../inflator.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var ZRLE_TILE_WIDTH = 64;
|
||||
var ZRLE_TILE_HEIGHT = 64;
|
||||
|
||||
var ZRLEDecoder = /*#__PURE__*/function () {
|
||||
function ZRLEDecoder() {
|
||||
_classCallCheck(this, ZRLEDecoder);
|
||||
|
||||
this._length = 0;
|
||||
this._inflator = new _inflator["default"]();
|
||||
this._pixelBuffer = new Uint8Array(ZRLE_TILE_WIDTH * ZRLE_TILE_HEIGHT * 4);
|
||||
this._tileBuffer = new Uint8Array(ZRLE_TILE_WIDTH * ZRLE_TILE_HEIGHT * 4);
|
||||
}
|
||||
|
||||
_createClass(ZRLEDecoder, [{
|
||||
key: "decodeRect",
|
||||
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
||||
if (this._length === 0) {
|
||||
if (sock.rQwait("ZLib data length", 4)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this._length = sock.rQshift32();
|
||||
}
|
||||
|
||||
if (sock.rQwait("Zlib data", this._length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = sock.rQshiftBytes(this._length);
|
||||
|
||||
this._inflator.setInput(data);
|
||||
|
||||
for (var ty = y; ty < y + height; ty += ZRLE_TILE_HEIGHT) {
|
||||
var th = Math.min(ZRLE_TILE_HEIGHT, y + height - ty);
|
||||
|
||||
for (var tx = x; tx < x + width; tx += ZRLE_TILE_WIDTH) {
|
||||
var tw = Math.min(ZRLE_TILE_WIDTH, x + width - tx);
|
||||
var tileSize = tw * th;
|
||||
|
||||
var subencoding = this._inflator.inflate(1)[0];
|
||||
|
||||
if (subencoding === 0) {
|
||||
// raw data
|
||||
var _data = this._readPixels(tileSize);
|
||||
|
||||
display.blitImage(tx, ty, tw, th, _data, 0, false);
|
||||
} else if (subencoding === 1) {
|
||||
// solid
|
||||
var background = this._readPixels(1);
|
||||
|
||||
display.fillRect(tx, ty, tw, th, [background[0], background[1], background[2]]);
|
||||
} else if (subencoding >= 2 && subencoding <= 16) {
|
||||
var _data2 = this._decodePaletteTile(subencoding, tileSize, tw, th);
|
||||
|
||||
display.blitImage(tx, ty, tw, th, _data2, 0, false);
|
||||
} else if (subencoding === 128) {
|
||||
var _data3 = this._decodeRLETile(tileSize);
|
||||
|
||||
display.blitImage(tx, ty, tw, th, _data3, 0, false);
|
||||
} else if (subencoding >= 130 && subencoding <= 255) {
|
||||
var _data4 = this._decodeRLEPaletteTile(subencoding - 128, tileSize);
|
||||
|
||||
display.blitImage(tx, ty, tw, th, _data4, 0, false);
|
||||
} else {
|
||||
throw new Error('Unknown subencoding: ' + subencoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._length = 0;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_getBitsPerPixelInPalette",
|
||||
value: function _getBitsPerPixelInPalette(paletteSize) {
|
||||
if (paletteSize <= 2) {
|
||||
return 1;
|
||||
} else if (paletteSize <= 4) {
|
||||
return 2;
|
||||
} else if (paletteSize <= 16) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_readPixels",
|
||||
value: function _readPixels(pixels) {
|
||||
var data = this._pixelBuffer;
|
||||
|
||||
var buffer = this._inflator.inflate(3 * pixels);
|
||||
|
||||
for (var i = 0, j = 0; i < pixels * 4; i += 4, j += 3) {
|
||||
data[i] = buffer[j];
|
||||
data[i + 1] = buffer[j + 1];
|
||||
data[i + 2] = buffer[j + 2];
|
||||
data[i + 3] = 255; // Add the Alpha
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "_decodePaletteTile",
|
||||
value: function _decodePaletteTile(paletteSize, tileSize, tilew, tileh) {
|
||||
var data = this._tileBuffer;
|
||||
|
||||
var palette = this._readPixels(paletteSize);
|
||||
|
||||
var bitsPerPixel = this._getBitsPerPixelInPalette(paletteSize);
|
||||
|
||||
var mask = (1 << bitsPerPixel) - 1;
|
||||
var offset = 0;
|
||||
|
||||
var encoded = this._inflator.inflate(1)[0];
|
||||
|
||||
for (var y = 0; y < tileh; y++) {
|
||||
var shift = 8 - bitsPerPixel;
|
||||
|
||||
for (var x = 0; x < tilew; x++) {
|
||||
if (shift < 0) {
|
||||
shift = 8 - bitsPerPixel;
|
||||
encoded = this._inflator.inflate(1)[0];
|
||||
}
|
||||
|
||||
var indexInPalette = encoded >> shift & mask;
|
||||
data[offset] = palette[indexInPalette * 4];
|
||||
data[offset + 1] = palette[indexInPalette * 4 + 1];
|
||||
data[offset + 2] = palette[indexInPalette * 4 + 2];
|
||||
data[offset + 3] = palette[indexInPalette * 4 + 3];
|
||||
offset += 4;
|
||||
shift -= bitsPerPixel;
|
||||
}
|
||||
|
||||
if (shift < 8 - bitsPerPixel && y < tileh - 1) {
|
||||
encoded = this._inflator.inflate(1)[0];
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "_decodeRLETile",
|
||||
value: function _decodeRLETile(tileSize) {
|
||||
var data = this._tileBuffer;
|
||||
var i = 0;
|
||||
|
||||
while (i < tileSize) {
|
||||
var pixel = this._readPixels(1);
|
||||
|
||||
var length = this._readRLELength();
|
||||
|
||||
for (var j = 0; j < length; j++) {
|
||||
data[i * 4] = pixel[0];
|
||||
data[i * 4 + 1] = pixel[1];
|
||||
data[i * 4 + 2] = pixel[2];
|
||||
data[i * 4 + 3] = pixel[3];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "_decodeRLEPaletteTile",
|
||||
value: function _decodeRLEPaletteTile(paletteSize, tileSize) {
|
||||
var data = this._tileBuffer; // palette
|
||||
|
||||
var palette = this._readPixels(paletteSize);
|
||||
|
||||
var offset = 0;
|
||||
|
||||
while (offset < tileSize) {
|
||||
var indexInPalette = this._inflator.inflate(1)[0];
|
||||
|
||||
var length = 1;
|
||||
|
||||
if (indexInPalette >= 128) {
|
||||
indexInPalette -= 128;
|
||||
length = this._readRLELength();
|
||||
}
|
||||
|
||||
if (indexInPalette > paletteSize) {
|
||||
throw new Error('Too big index in palette: ' + indexInPalette + ', palette size: ' + paletteSize);
|
||||
}
|
||||
|
||||
if (offset + length > tileSize) {
|
||||
throw new Error('Too big rle length in palette mode: ' + length + ', allowed length is: ' + (tileSize - offset));
|
||||
}
|
||||
|
||||
for (var j = 0; j < length; j++) {
|
||||
data[offset * 4] = palette[indexInPalette * 4];
|
||||
data[offset * 4 + 1] = palette[indexInPalette * 4 + 1];
|
||||
data[offset * 4 + 2] = palette[indexInPalette * 4 + 2];
|
||||
data[offset * 4 + 3] = palette[indexInPalette * 4 + 3];
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}, {
|
||||
key: "_readRLELength",
|
||||
value: function _readRLELength() {
|
||||
var length = 0;
|
||||
var current = 0;
|
||||
|
||||
do {
|
||||
current = this._inflator.inflate(1)[0];
|
||||
length += current;
|
||||
} while (current === 255);
|
||||
|
||||
return length + 1;
|
||||
}
|
||||
}]);
|
||||
|
||||
return ZRLEDecoder;
|
||||
}();
|
||||
|
||||
exports["default"] = ZRLEDecoder;
|
||||
99
public/novnc/lib/deflator.js
Normal file
99
public/novnc/lib/deflator.js
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _deflate2 = require("../lib/vendor/pako/lib/zlib/deflate.js");
|
||||
|
||||
var _zstream = _interopRequireDefault(require("../lib/vendor/pako/lib/zlib/zstream.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var Deflator = /*#__PURE__*/function () {
|
||||
function Deflator() {
|
||||
_classCallCheck(this, Deflator);
|
||||
|
||||
this.strm = new _zstream["default"]();
|
||||
this.chunkSize = 1024 * 10 * 10;
|
||||
this.outputBuffer = new Uint8Array(this.chunkSize);
|
||||
this.windowBits = 5;
|
||||
(0, _deflate2.deflateInit)(this.strm, this.windowBits);
|
||||
}
|
||||
|
||||
_createClass(Deflator, [{
|
||||
key: "deflate",
|
||||
value: function deflate(inData) {
|
||||
/* eslint-disable camelcase */
|
||||
this.strm.input = inData;
|
||||
this.strm.avail_in = this.strm.input.length;
|
||||
this.strm.next_in = 0;
|
||||
this.strm.output = this.outputBuffer;
|
||||
this.strm.avail_out = this.chunkSize;
|
||||
this.strm.next_out = 0;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
var lastRet = (0, _deflate2.deflate)(this.strm, _deflate2.Z_FULL_FLUSH);
|
||||
var outData = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||
|
||||
if (lastRet < 0) {
|
||||
throw new Error("zlib deflate failed");
|
||||
}
|
||||
|
||||
if (this.strm.avail_in > 0) {
|
||||
// Read chunks until done
|
||||
var chunks = [outData];
|
||||
var totalLen = outData.length;
|
||||
|
||||
do {
|
||||
/* eslint-disable camelcase */
|
||||
this.strm.output = new Uint8Array(this.chunkSize);
|
||||
this.strm.next_out = 0;
|
||||
this.strm.avail_out = this.chunkSize;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
lastRet = (0, _deflate2.deflate)(this.strm, _deflate2.Z_FULL_FLUSH);
|
||||
|
||||
if (lastRet < 0) {
|
||||
throw new Error("zlib deflate failed");
|
||||
}
|
||||
|
||||
var chunk = new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||
totalLen += chunk.length;
|
||||
chunks.push(chunk);
|
||||
} while (this.strm.avail_in > 0); // Combine chunks into a single data
|
||||
|
||||
|
||||
var newData = new Uint8Array(totalLen);
|
||||
var offset = 0;
|
||||
|
||||
for (var i = 0; i < chunks.length; i++) {
|
||||
newData.set(chunks[i], offset);
|
||||
offset += chunks[i].length;
|
||||
}
|
||||
|
||||
outData = newData;
|
||||
}
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
|
||||
this.strm.input = null;
|
||||
this.strm.avail_in = 0;
|
||||
this.strm.next_in = 0;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
return outData;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Deflator;
|
||||
}();
|
||||
|
||||
exports["default"] = Deflator;
|
||||
314
public/novnc/lib/des.js
Normal file
314
public/novnc/lib/des.js
Normal file
@@ -0,0 +1,314 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* Ported from Flashlight VNC ActionScript implementation:
|
||||
* http://www.wizhelp.com/flashlight-vnc/
|
||||
*
|
||||
* Full attribution follows:
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* This DES class has been extracted from package Acme.Crypto for use in VNC.
|
||||
* The unnecessary odd parity code has been removed.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
|
||||
* DesCipher - the DES encryption method
|
||||
*
|
||||
* The meat of this code is by Dave Zimmerman <dzimm@widget.com>, and is:
|
||||
*
|
||||
* Copyright (c) 1996 Widget Workshop, Inc. All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software
|
||||
* and its documentation for NON-COMMERCIAL or COMMERCIAL purposes and
|
||||
* without fee is hereby granted, provided that this copyright notice is kept
|
||||
* intact.
|
||||
*
|
||||
* WIDGET WORKSHOP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
|
||||
* OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WIDGET WORKSHOP SHALL NOT BE LIABLE
|
||||
* FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
|
||||
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
|
||||
*
|
||||
* THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
|
||||
* CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
|
||||
* PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
|
||||
* NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
|
||||
* SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
|
||||
* SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
|
||||
* PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). WIDGET WORKSHOP
|
||||
* SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR
|
||||
* HIGH RISK ACTIVITIES.
|
||||
*
|
||||
*
|
||||
* The rest is:
|
||||
*
|
||||
* Copyright (C) 1996 by Jef Poskanzer <jef@acme.com>. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Visit the ACME Labs Java page for up-to-date versions of this and other
|
||||
* fine Java utilities: http://www.acme.com/java/
|
||||
*/
|
||||
|
||||
/* eslint-disable comma-spacing */
|
||||
// Tables, permutations, S-boxes, etc.
|
||||
var PC2 = [13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9, 22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1, 40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47, 43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31],
|
||||
totrot = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
|
||||
var z = 0x0;
|
||||
var a, b, c, d, e, f;
|
||||
a = 1 << 16;
|
||||
b = 1 << 24;
|
||||
c = a | b;
|
||||
d = 1 << 2;
|
||||
e = 1 << 10;
|
||||
f = d | e;
|
||||
var SP1 = [c | e, z | z, a | z, c | f, c | d, a | f, z | d, a | z, z | e, c | e, c | f, z | e, b | f, c | d, b | z, z | d, z | f, b | e, b | e, a | e, a | e, c | z, c | z, b | f, a | d, b | d, b | d, a | d, z | z, z | f, a | f, b | z, a | z, c | f, z | d, c | z, c | e, b | z, b | z, z | e, c | d, a | z, a | e, b | d, z | e, z | d, b | f, a | f, c | f, a | d, c | z, b | f, b | d, z | f, a | f, c | e, z | f, b | e, b | e, z | z, a | d, a | e, z | z, c | d];
|
||||
a = 1 << 20;
|
||||
b = 1 << 31;
|
||||
c = a | b;
|
||||
d = 1 << 5;
|
||||
e = 1 << 15;
|
||||
f = d | e;
|
||||
var SP2 = [c | f, b | e, z | e, a | f, a | z, z | d, c | d, b | f, b | d, c | f, c | e, b | z, b | e, a | z, z | d, c | d, a | e, a | d, b | f, z | z, b | z, z | e, a | f, c | z, a | d, b | d, z | z, a | e, z | f, c | e, c | z, z | f, z | z, a | f, c | d, a | z, b | f, c | z, c | e, z | e, c | z, b | e, z | d, c | f, a | f, z | d, z | e, b | z, z | f, c | e, a | z, b | d, a | d, b | f, b | d, a | d, a | e, z | z, b | e, z | f, b | z, c | d, c | f, a | e];
|
||||
a = 1 << 17;
|
||||
b = 1 << 27;
|
||||
c = a | b;
|
||||
d = 1 << 3;
|
||||
e = 1 << 9;
|
||||
f = d | e;
|
||||
var SP3 = [z | f, c | e, z | z, c | d, b | e, z | z, a | f, b | e, a | d, b | d, b | d, a | z, c | f, a | d, c | z, z | f, b | z, z | d, c | e, z | e, a | e, c | z, c | d, a | f, b | f, a | e, a | z, b | f, z | d, c | f, z | e, b | z, c | e, b | z, a | d, z | f, a | z, c | e, b | e, z | z, z | e, a | d, c | f, b | e, b | d, z | e, z | z, c | d, b | f, a | z, b | z, c | f, z | d, a | f, a | e, b | d, c | z, b | f, z | f, c | z, a | f, z | d, c | d, a | e];
|
||||
a = 1 << 13;
|
||||
b = 1 << 23;
|
||||
c = a | b;
|
||||
d = 1 << 0;
|
||||
e = 1 << 7;
|
||||
f = d | e;
|
||||
var SP4 = [c | d, a | f, a | f, z | e, c | e, b | f, b | d, a | d, z | z, c | z, c | z, c | f, z | f, z | z, b | e, b | d, z | d, a | z, b | z, c | d, z | e, b | z, a | d, a | e, b | f, z | d, a | e, b | e, a | z, c | e, c | f, z | f, b | e, b | d, c | z, c | f, z | f, z | z, z | z, c | z, a | e, b | e, b | f, z | d, c | d, a | f, a | f, z | e, c | f, z | f, z | d, a | z, b | d, a | d, c | e, b | f, a | d, a | e, b | z, c | d, z | e, b | z, a | z, c | e];
|
||||
a = 1 << 25;
|
||||
b = 1 << 30;
|
||||
c = a | b;
|
||||
d = 1 << 8;
|
||||
e = 1 << 19;
|
||||
f = d | e;
|
||||
var SP5 = [z | d, a | f, a | e, c | d, z | e, z | d, b | z, a | e, b | f, z | e, a | d, b | f, c | d, c | e, z | f, b | z, a | z, b | e, b | e, z | z, b | d, c | f, c | f, a | d, c | e, b | d, z | z, c | z, a | f, a | z, c | z, z | f, z | e, c | d, z | d, a | z, b | z, a | e, c | d, b | f, a | d, b | z, c | e, a | f, b | f, z | d, a | z, c | e, c | f, z | f, c | z, c | f, a | e, z | z, b | e, c | z, z | f, a | d, b | d, z | e, z | z, b | e, a | f, b | d];
|
||||
a = 1 << 22;
|
||||
b = 1 << 29;
|
||||
c = a | b;
|
||||
d = 1 << 4;
|
||||
e = 1 << 14;
|
||||
f = d | e;
|
||||
var SP6 = [b | d, c | z, z | e, c | f, c | z, z | d, c | f, a | z, b | e, a | f, a | z, b | d, a | d, b | e, b | z, z | f, z | z, a | d, b | f, z | e, a | e, b | f, z | d, c | d, c | d, z | z, a | f, c | e, z | f, a | e, c | e, b | z, b | e, z | d, c | d, a | e, c | f, a | z, z | f, b | d, a | z, b | e, b | z, z | f, b | d, c | f, a | e, c | z, a | f, c | e, z | z, c | d, z | d, z | e, c | z, a | f, z | e, a | d, b | f, z | z, c | e, b | z, a | d, b | f];
|
||||
a = 1 << 21;
|
||||
b = 1 << 26;
|
||||
c = a | b;
|
||||
d = 1 << 1;
|
||||
e = 1 << 11;
|
||||
f = d | e;
|
||||
var SP7 = [a | z, c | d, b | f, z | z, z | e, b | f, a | f, c | e, c | f, a | z, z | z, b | d, z | d, b | z, c | d, z | f, b | e, a | f, a | d, b | e, b | d, c | z, c | e, a | d, c | z, z | e, z | f, c | f, a | e, z | d, b | z, a | e, b | z, a | e, a | z, b | f, b | f, c | d, c | d, z | d, a | d, b | z, b | e, a | z, c | e, z | f, a | f, c | e, z | f, b | d, c | f, c | z, a | e, z | z, z | d, c | f, z | z, a | f, c | z, z | e, b | d, b | e, z | e, a | d];
|
||||
a = 1 << 18;
|
||||
b = 1 << 28;
|
||||
c = a | b;
|
||||
d = 1 << 6;
|
||||
e = 1 << 12;
|
||||
f = d | e;
|
||||
var SP8 = [b | f, z | e, a | z, c | f, b | z, b | f, z | d, b | z, a | d, c | z, c | f, a | e, c | e, a | f, z | e, z | d, c | z, b | d, b | e, z | f, a | e, a | d, c | d, c | e, z | f, z | z, z | z, c | d, b | d, b | e, a | f, a | z, a | f, a | z, c | e, z | e, z | d, c | d, z | e, a | f, b | e, z | d, b | d, c | z, c | d, b | z, a | z, b | f, z | z, c | f, a | d, b | d, c | z, b | e, b | f, z | z, c | f, a | e, a | e, z | f, z | f, a | d, b | z, c | e];
|
||||
/* eslint-enable comma-spacing */
|
||||
|
||||
var DES = /*#__PURE__*/function () {
|
||||
function DES(password) {
|
||||
_classCallCheck(this, DES);
|
||||
|
||||
this.keys = []; // Set the key.
|
||||
|
||||
var pc1m = [],
|
||||
pcr = [],
|
||||
kn = [];
|
||||
|
||||
for (var j = 0, l = 56; j < 56; ++j, l -= 8) {
|
||||
l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1
|
||||
|
||||
var m = l & 0x7;
|
||||
pc1m[j] = (password[l >>> 3] & 1 << m) !== 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 16; ++i) {
|
||||
var _m = i << 1;
|
||||
|
||||
var n = _m + 1;
|
||||
kn[_m] = kn[n] = 0;
|
||||
|
||||
for (var o = 28; o < 59; o += 28) {
|
||||
for (var _j = o - 28; _j < o; ++_j) {
|
||||
var _l = _j + totrot[i];
|
||||
|
||||
pcr[_j] = _l < o ? pc1m[_l] : pc1m[_l - 28];
|
||||
}
|
||||
}
|
||||
|
||||
for (var _j2 = 0; _j2 < 24; ++_j2) {
|
||||
if (pcr[PC2[_j2]] !== 0) {
|
||||
kn[_m] |= 1 << 23 - _j2;
|
||||
}
|
||||
|
||||
if (pcr[PC2[_j2 + 24]] !== 0) {
|
||||
kn[n] |= 1 << 23 - _j2;
|
||||
}
|
||||
}
|
||||
} // cookey
|
||||
|
||||
|
||||
for (var _i = 0, rawi = 0, KnLi = 0; _i < 16; ++_i) {
|
||||
var raw0 = kn[rawi++];
|
||||
var raw1 = kn[rawi++];
|
||||
this.keys[KnLi] = (raw0 & 0x00fc0000) << 6;
|
||||
this.keys[KnLi] |= (raw0 & 0x00000fc0) << 10;
|
||||
this.keys[KnLi] |= (raw1 & 0x00fc0000) >>> 10;
|
||||
this.keys[KnLi] |= (raw1 & 0x00000fc0) >>> 6;
|
||||
++KnLi;
|
||||
this.keys[KnLi] = (raw0 & 0x0003f000) << 12;
|
||||
this.keys[KnLi] |= (raw0 & 0x0000003f) << 16;
|
||||
this.keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
|
||||
this.keys[KnLi] |= raw1 & 0x0000003f;
|
||||
++KnLi;
|
||||
}
|
||||
} // Encrypt 8 bytes of text
|
||||
|
||||
|
||||
_createClass(DES, [{
|
||||
key: "enc8",
|
||||
value: function enc8(text) {
|
||||
var b = text.slice();
|
||||
var i = 0,
|
||||
l,
|
||||
r,
|
||||
x; // left, right, accumulator
|
||||
// Squash 8 bytes to 2 ints
|
||||
|
||||
l = b[i++] << 24 | b[i++] << 16 | b[i++] << 8 | b[i++];
|
||||
r = b[i++] << 24 | b[i++] << 16 | b[i++] << 8 | b[i++];
|
||||
x = (l >>> 4 ^ r) & 0x0f0f0f0f;
|
||||
r ^= x;
|
||||
l ^= x << 4;
|
||||
x = (l >>> 16 ^ r) & 0x0000ffff;
|
||||
r ^= x;
|
||||
l ^= x << 16;
|
||||
x = (r >>> 2 ^ l) & 0x33333333;
|
||||
l ^= x;
|
||||
r ^= x << 2;
|
||||
x = (r >>> 8 ^ l) & 0x00ff00ff;
|
||||
l ^= x;
|
||||
r ^= x << 8;
|
||||
r = r << 1 | r >>> 31 & 1;
|
||||
x = (l ^ r) & 0xaaaaaaaa;
|
||||
l ^= x;
|
||||
r ^= x;
|
||||
l = l << 1 | l >>> 31 & 1;
|
||||
|
||||
for (var _i2 = 0, keysi = 0; _i2 < 8; ++_i2) {
|
||||
x = r << 28 | r >>> 4;
|
||||
x ^= this.keys[keysi++];
|
||||
var fval = SP7[x & 0x3f];
|
||||
fval |= SP5[x >>> 8 & 0x3f];
|
||||
fval |= SP3[x >>> 16 & 0x3f];
|
||||
fval |= SP1[x >>> 24 & 0x3f];
|
||||
x = r ^ this.keys[keysi++];
|
||||
fval |= SP8[x & 0x3f];
|
||||
fval |= SP6[x >>> 8 & 0x3f];
|
||||
fval |= SP4[x >>> 16 & 0x3f];
|
||||
fval |= SP2[x >>> 24 & 0x3f];
|
||||
l ^= fval;
|
||||
x = l << 28 | l >>> 4;
|
||||
x ^= this.keys[keysi++];
|
||||
fval = SP7[x & 0x3f];
|
||||
fval |= SP5[x >>> 8 & 0x3f];
|
||||
fval |= SP3[x >>> 16 & 0x3f];
|
||||
fval |= SP1[x >>> 24 & 0x3f];
|
||||
x = l ^ this.keys[keysi++];
|
||||
fval |= SP8[x & 0x0000003f];
|
||||
fval |= SP6[x >>> 8 & 0x3f];
|
||||
fval |= SP4[x >>> 16 & 0x3f];
|
||||
fval |= SP2[x >>> 24 & 0x3f];
|
||||
r ^= fval;
|
||||
}
|
||||
|
||||
r = r << 31 | r >>> 1;
|
||||
x = (l ^ r) & 0xaaaaaaaa;
|
||||
l ^= x;
|
||||
r ^= x;
|
||||
l = l << 31 | l >>> 1;
|
||||
x = (l >>> 8 ^ r) & 0x00ff00ff;
|
||||
r ^= x;
|
||||
l ^= x << 8;
|
||||
x = (l >>> 2 ^ r) & 0x33333333;
|
||||
r ^= x;
|
||||
l ^= x << 2;
|
||||
x = (r >>> 16 ^ l) & 0x0000ffff;
|
||||
l ^= x;
|
||||
r ^= x << 16;
|
||||
x = (r >>> 4 ^ l) & 0x0f0f0f0f;
|
||||
l ^= x;
|
||||
r ^= x << 4; // Spread ints to bytes
|
||||
|
||||
x = [r, l];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
b[i] = (x[i >>> 2] >>> 8 * (3 - i % 4)) % 256;
|
||||
|
||||
if (b[i] < 0) {
|
||||
b[i] += 256;
|
||||
} // unsigned
|
||||
|
||||
}
|
||||
|
||||
return b;
|
||||
} // Encrypt 16 bytes of text using passwd as key
|
||||
|
||||
}, {
|
||||
key: "encrypt",
|
||||
value: function encrypt(t) {
|
||||
return this.enc8(t.slice(0, 8)).concat(this.enc8(t.slice(8, 16)));
|
||||
}
|
||||
}]);
|
||||
|
||||
return DES;
|
||||
}();
|
||||
|
||||
exports["default"] = DES;
|
||||
566
public/novnc/lib/display.js
Normal file
566
public/novnc/lib/display.js
Normal file
@@ -0,0 +1,566 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("./util/logging.js"));
|
||||
|
||||
var _base = _interopRequireDefault(require("./base64.js"));
|
||||
|
||||
var _int = require("./util/int.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var Display = /*#__PURE__*/function () {
|
||||
function Display(target) {
|
||||
_classCallCheck(this, Display);
|
||||
|
||||
this._drawCtx = null;
|
||||
this._renderQ = []; // queue drawing actions for in-oder rendering
|
||||
|
||||
this._flushing = false; // the full frame buffer (logical canvas) size
|
||||
|
||||
this._fbWidth = 0;
|
||||
this._fbHeight = 0;
|
||||
this._prevDrawStyle = "";
|
||||
Log.Debug(">> Display.constructor"); // The visible canvas
|
||||
|
||||
this._target = target;
|
||||
|
||||
if (!this._target) {
|
||||
throw new Error("Target must be set");
|
||||
}
|
||||
|
||||
if (typeof this._target === 'string') {
|
||||
throw new Error('target must be a DOM element');
|
||||
}
|
||||
|
||||
if (!this._target.getContext) {
|
||||
throw new Error("no getContext method");
|
||||
}
|
||||
|
||||
this._targetCtx = this._target.getContext('2d'); // the visible canvas viewport (i.e. what actually gets seen)
|
||||
|
||||
this._viewportLoc = {
|
||||
'x': 0,
|
||||
'y': 0,
|
||||
'w': this._target.width,
|
||||
'h': this._target.height
|
||||
}; // The hidden canvas, where we do the actual rendering
|
||||
|
||||
this._backbuffer = document.createElement('canvas');
|
||||
this._drawCtx = this._backbuffer.getContext('2d');
|
||||
this._damageBounds = {
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: this._backbuffer.width,
|
||||
bottom: this._backbuffer.height
|
||||
};
|
||||
Log.Debug("User Agent: " + navigator.userAgent);
|
||||
Log.Debug("<< Display.constructor"); // ===== PROPERTIES =====
|
||||
|
||||
this._scale = 1.0;
|
||||
this._clipViewport = false; // ===== EVENT HANDLERS =====
|
||||
|
||||
this.onflush = function () {}; // A flush request has finished
|
||||
|
||||
} // ===== PROPERTIES =====
|
||||
|
||||
|
||||
_createClass(Display, [{
|
||||
key: "scale",
|
||||
get: function get() {
|
||||
return this._scale;
|
||||
},
|
||||
set: function set(scale) {
|
||||
this._rescale(scale);
|
||||
}
|
||||
}, {
|
||||
key: "clipViewport",
|
||||
get: function get() {
|
||||
return this._clipViewport;
|
||||
},
|
||||
set: function set(viewport) {
|
||||
this._clipViewport = viewport; // May need to readjust the viewport dimensions
|
||||
|
||||
var vp = this._viewportLoc;
|
||||
this.viewportChangeSize(vp.w, vp.h);
|
||||
this.viewportChangePos(0, 0);
|
||||
}
|
||||
}, {
|
||||
key: "width",
|
||||
get: function get() {
|
||||
return this._fbWidth;
|
||||
}
|
||||
}, {
|
||||
key: "height",
|
||||
get: function get() {
|
||||
return this._fbHeight;
|
||||
} // ===== PUBLIC METHODS =====
|
||||
|
||||
}, {
|
||||
key: "viewportChangePos",
|
||||
value: function viewportChangePos(deltaX, deltaY) {
|
||||
var vp = this._viewportLoc;
|
||||
deltaX = Math.floor(deltaX);
|
||||
deltaY = Math.floor(deltaY);
|
||||
|
||||
if (!this._clipViewport) {
|
||||
deltaX = -vp.w; // clamped later of out of bounds
|
||||
|
||||
deltaY = -vp.h;
|
||||
}
|
||||
|
||||
var vx2 = vp.x + vp.w - 1;
|
||||
var vy2 = vp.y + vp.h - 1; // Position change
|
||||
|
||||
if (deltaX < 0 && vp.x + deltaX < 0) {
|
||||
deltaX = -vp.x;
|
||||
}
|
||||
|
||||
if (vx2 + deltaX >= this._fbWidth) {
|
||||
deltaX -= vx2 + deltaX - this._fbWidth + 1;
|
||||
}
|
||||
|
||||
if (vp.y + deltaY < 0) {
|
||||
deltaY = -vp.y;
|
||||
}
|
||||
|
||||
if (vy2 + deltaY >= this._fbHeight) {
|
||||
deltaY -= vy2 + deltaY - this._fbHeight + 1;
|
||||
}
|
||||
|
||||
if (deltaX === 0 && deltaY === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.Debug("viewportChange deltaX: " + deltaX + ", deltaY: " + deltaY);
|
||||
vp.x += deltaX;
|
||||
vp.y += deltaY;
|
||||
|
||||
this._damage(vp.x, vp.y, vp.w, vp.h);
|
||||
|
||||
this.flip();
|
||||
}
|
||||
}, {
|
||||
key: "viewportChangeSize",
|
||||
value: function viewportChangeSize(width, height) {
|
||||
if (!this._clipViewport || typeof width === "undefined" || typeof height === "undefined") {
|
||||
Log.Debug("Setting viewport to full display region");
|
||||
width = this._fbWidth;
|
||||
height = this._fbHeight;
|
||||
}
|
||||
|
||||
width = Math.floor(width);
|
||||
height = Math.floor(height);
|
||||
|
||||
if (width > this._fbWidth) {
|
||||
width = this._fbWidth;
|
||||
}
|
||||
|
||||
if (height > this._fbHeight) {
|
||||
height = this._fbHeight;
|
||||
}
|
||||
|
||||
var vp = this._viewportLoc;
|
||||
|
||||
if (vp.w !== width || vp.h !== height) {
|
||||
vp.w = width;
|
||||
vp.h = height;
|
||||
var canvas = this._target;
|
||||
canvas.width = width;
|
||||
canvas.height = height; // The position might need to be updated if we've grown
|
||||
|
||||
this.viewportChangePos(0, 0);
|
||||
|
||||
this._damage(vp.x, vp.y, vp.w, vp.h);
|
||||
|
||||
this.flip(); // Update the visible size of the target canvas
|
||||
|
||||
this._rescale(this._scale);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "absX",
|
||||
value: function absX(x) {
|
||||
if (this._scale === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (0, _int.toSigned32bit)(x / this._scale + this._viewportLoc.x);
|
||||
}
|
||||
}, {
|
||||
key: "absY",
|
||||
value: function absY(y) {
|
||||
if (this._scale === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (0, _int.toSigned32bit)(y / this._scale + this._viewportLoc.y);
|
||||
}
|
||||
}, {
|
||||
key: "resize",
|
||||
value: function resize(width, height) {
|
||||
this._prevDrawStyle = "";
|
||||
this._fbWidth = width;
|
||||
this._fbHeight = height;
|
||||
var canvas = this._backbuffer;
|
||||
|
||||
if (canvas.width !== width || canvas.height !== height) {
|
||||
// We have to save the canvas data since changing the size will clear it
|
||||
var saveImg = null;
|
||||
|
||||
if (canvas.width > 0 && canvas.height > 0) {
|
||||
saveImg = this._drawCtx.getImageData(0, 0, canvas.width, canvas.height);
|
||||
}
|
||||
|
||||
if (canvas.width !== width) {
|
||||
canvas.width = width;
|
||||
}
|
||||
|
||||
if (canvas.height !== height) {
|
||||
canvas.height = height;
|
||||
}
|
||||
|
||||
if (saveImg) {
|
||||
this._drawCtx.putImageData(saveImg, 0, 0);
|
||||
}
|
||||
} // Readjust the viewport as it may be incorrectly sized
|
||||
// and positioned
|
||||
|
||||
|
||||
var vp = this._viewportLoc;
|
||||
this.viewportChangeSize(vp.w, vp.h);
|
||||
this.viewportChangePos(0, 0);
|
||||
} // Track what parts of the visible canvas that need updating
|
||||
|
||||
}, {
|
||||
key: "_damage",
|
||||
value: function _damage(x, y, w, h) {
|
||||
if (x < this._damageBounds.left) {
|
||||
this._damageBounds.left = x;
|
||||
}
|
||||
|
||||
if (y < this._damageBounds.top) {
|
||||
this._damageBounds.top = y;
|
||||
}
|
||||
|
||||
if (x + w > this._damageBounds.right) {
|
||||
this._damageBounds.right = x + w;
|
||||
}
|
||||
|
||||
if (y + h > this._damageBounds.bottom) {
|
||||
this._damageBounds.bottom = y + h;
|
||||
}
|
||||
} // Update the visible canvas with the contents of the
|
||||
// rendering canvas
|
||||
|
||||
}, {
|
||||
key: "flip",
|
||||
value: function flip(fromQueue) {
|
||||
if (this._renderQ.length !== 0 && !fromQueue) {
|
||||
this._renderQPush({
|
||||
'type': 'flip'
|
||||
});
|
||||
} else {
|
||||
var x = this._damageBounds.left;
|
||||
var y = this._damageBounds.top;
|
||||
var w = this._damageBounds.right - x;
|
||||
var h = this._damageBounds.bottom - y;
|
||||
var vx = x - this._viewportLoc.x;
|
||||
var vy = y - this._viewportLoc.y;
|
||||
|
||||
if (vx < 0) {
|
||||
w += vx;
|
||||
x -= vx;
|
||||
vx = 0;
|
||||
}
|
||||
|
||||
if (vy < 0) {
|
||||
h += vy;
|
||||
y -= vy;
|
||||
vy = 0;
|
||||
}
|
||||
|
||||
if (vx + w > this._viewportLoc.w) {
|
||||
w = this._viewportLoc.w - vx;
|
||||
}
|
||||
|
||||
if (vy + h > this._viewportLoc.h) {
|
||||
h = this._viewportLoc.h - vy;
|
||||
}
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
// FIXME: We may need to disable image smoothing here
|
||||
// as well (see copyImage()), but we haven't
|
||||
// noticed any problem yet.
|
||||
this._targetCtx.drawImage(this._backbuffer, x, y, w, h, vx, vy, w, h);
|
||||
}
|
||||
|
||||
this._damageBounds.left = this._damageBounds.top = 65535;
|
||||
this._damageBounds.right = this._damageBounds.bottom = 0;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "pending",
|
||||
value: function pending() {
|
||||
return this._renderQ.length > 0;
|
||||
}
|
||||
}, {
|
||||
key: "flush",
|
||||
value: function flush() {
|
||||
if (this._renderQ.length === 0) {
|
||||
this.onflush();
|
||||
} else {
|
||||
this._flushing = true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "fillRect",
|
||||
value: function fillRect(x, y, width, height, color, fromQueue) {
|
||||
if (this._renderQ.length !== 0 && !fromQueue) {
|
||||
this._renderQPush({
|
||||
'type': 'fill',
|
||||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height,
|
||||
'color': color
|
||||
});
|
||||
} else {
|
||||
this._setFillColor(color);
|
||||
|
||||
this._drawCtx.fillRect(x, y, width, height);
|
||||
|
||||
this._damage(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "copyImage",
|
||||
value: function copyImage(oldX, oldY, newX, newY, w, h, fromQueue) {
|
||||
if (this._renderQ.length !== 0 && !fromQueue) {
|
||||
this._renderQPush({
|
||||
'type': 'copy',
|
||||
'oldX': oldX,
|
||||
'oldY': oldY,
|
||||
'x': newX,
|
||||
'y': newY,
|
||||
'width': w,
|
||||
'height': h
|
||||
});
|
||||
} else {
|
||||
// Due to this bug among others [1] we need to disable the image-smoothing to
|
||||
// avoid getting a blur effect when copying data.
|
||||
//
|
||||
// 1. https://bugzilla.mozilla.org/show_bug.cgi?id=1194719
|
||||
//
|
||||
// We need to set these every time since all properties are reset
|
||||
// when the the size is changed
|
||||
this._drawCtx.mozImageSmoothingEnabled = false;
|
||||
this._drawCtx.webkitImageSmoothingEnabled = false;
|
||||
this._drawCtx.msImageSmoothingEnabled = false;
|
||||
this._drawCtx.imageSmoothingEnabled = false;
|
||||
|
||||
this._drawCtx.drawImage(this._backbuffer, oldX, oldY, w, h, newX, newY, w, h);
|
||||
|
||||
this._damage(newX, newY, w, h);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "imageRect",
|
||||
value: function imageRect(x, y, width, height, mime, arr) {
|
||||
/* The internal logic cannot handle empty images, so bail early */
|
||||
if (width === 0 || height === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var img = new Image();
|
||||
img.src = "data: " + mime + ";base64," + _base["default"].encode(arr);
|
||||
|
||||
this._renderQPush({
|
||||
'type': 'img',
|
||||
'img': img,
|
||||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "blitImage",
|
||||
value: function blitImage(x, y, width, height, arr, offset, fromQueue) {
|
||||
if (this._renderQ.length !== 0 && !fromQueue) {
|
||||
// NB(directxman12): it's technically more performant here to use preallocated arrays,
|
||||
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
|
||||
// this probably isn't getting called *nearly* as much
|
||||
var newArr = new Uint8Array(width * height * 4);
|
||||
newArr.set(new Uint8Array(arr.buffer, 0, newArr.length));
|
||||
|
||||
this._renderQPush({
|
||||
'type': 'blit',
|
||||
'data': newArr,
|
||||
'x': x,
|
||||
'y': y,
|
||||
'width': width,
|
||||
'height': height
|
||||
});
|
||||
} else {
|
||||
// NB(directxman12): arr must be an Type Array view
|
||||
var data = new Uint8ClampedArray(arr.buffer, arr.byteOffset + offset, width * height * 4);
|
||||
var img = new ImageData(data, width, height);
|
||||
|
||||
this._drawCtx.putImageData(img, x, y);
|
||||
|
||||
this._damage(x, y, width, height);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "drawImage",
|
||||
value: function drawImage(img, x, y) {
|
||||
this._drawCtx.drawImage(img, x, y);
|
||||
|
||||
this._damage(x, y, img.width, img.height);
|
||||
}
|
||||
}, {
|
||||
key: "autoscale",
|
||||
value: function autoscale(containerWidth, containerHeight) {
|
||||
var scaleRatio;
|
||||
|
||||
if (containerWidth === 0 || containerHeight === 0) {
|
||||
scaleRatio = 0;
|
||||
} else {
|
||||
var vp = this._viewportLoc;
|
||||
var targetAspectRatio = containerWidth / containerHeight;
|
||||
var fbAspectRatio = vp.w / vp.h;
|
||||
|
||||
if (fbAspectRatio >= targetAspectRatio) {
|
||||
scaleRatio = containerWidth / vp.w;
|
||||
} else {
|
||||
scaleRatio = containerHeight / vp.h;
|
||||
}
|
||||
}
|
||||
|
||||
this._rescale(scaleRatio);
|
||||
} // ===== PRIVATE METHODS =====
|
||||
|
||||
}, {
|
||||
key: "_rescale",
|
||||
value: function _rescale(factor) {
|
||||
this._scale = factor;
|
||||
var vp = this._viewportLoc; // NB(directxman12): If you set the width directly, or set the
|
||||
// style width to a number, the canvas is cleared.
|
||||
// However, if you set the style width to a string
|
||||
// ('NNNpx'), the canvas is scaled without clearing.
|
||||
|
||||
var width = factor * vp.w + 'px';
|
||||
var height = factor * vp.h + 'px';
|
||||
|
||||
if (this._target.style.width !== width || this._target.style.height !== height) {
|
||||
this._target.style.width = width;
|
||||
this._target.style.height = height;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_setFillColor",
|
||||
value: function _setFillColor(color) {
|
||||
var newStyle = 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';
|
||||
|
||||
if (newStyle !== this._prevDrawStyle) {
|
||||
this._drawCtx.fillStyle = newStyle;
|
||||
this._prevDrawStyle = newStyle;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_renderQPush",
|
||||
value: function _renderQPush(action) {
|
||||
this._renderQ.push(action);
|
||||
|
||||
if (this._renderQ.length === 1) {
|
||||
// If this can be rendered immediately it will be, otherwise
|
||||
// the scanner will wait for the relevant event
|
||||
this._scanRenderQ();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_resumeRenderQ",
|
||||
value: function _resumeRenderQ() {
|
||||
// "this" is the object that is ready, not the
|
||||
// display object
|
||||
this.removeEventListener('load', this._noVNCDisplay._resumeRenderQ);
|
||||
|
||||
this._noVNCDisplay._scanRenderQ();
|
||||
}
|
||||
}, {
|
||||
key: "_scanRenderQ",
|
||||
value: function _scanRenderQ() {
|
||||
var ready = true;
|
||||
|
||||
while (ready && this._renderQ.length > 0) {
|
||||
var a = this._renderQ[0];
|
||||
|
||||
switch (a.type) {
|
||||
case 'flip':
|
||||
this.flip(true);
|
||||
break;
|
||||
|
||||
case 'copy':
|
||||
this.copyImage(a.oldX, a.oldY, a.x, a.y, a.width, a.height, true);
|
||||
break;
|
||||
|
||||
case 'fill':
|
||||
this.fillRect(a.x, a.y, a.width, a.height, a.color, true);
|
||||
break;
|
||||
|
||||
case 'blit':
|
||||
this.blitImage(a.x, a.y, a.width, a.height, a.data, 0, true);
|
||||
break;
|
||||
|
||||
case 'img':
|
||||
if (a.img.complete) {
|
||||
if (a.img.width !== a.width || a.img.height !== a.height) {
|
||||
Log.Error("Decoded image has incorrect dimensions. Got " + a.img.width + "x" + a.img.height + ". Expected " + a.width + "x" + a.height + ".");
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawImage(a.img, a.x, a.y);
|
||||
} else {
|
||||
a.img._noVNCDisplay = this;
|
||||
a.img.addEventListener('load', this._resumeRenderQ); // We need to wait for this image to 'load'
|
||||
// to keep things in-order
|
||||
|
||||
ready = false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (ready) {
|
||||
this._renderQ.shift();
|
||||
}
|
||||
}
|
||||
|
||||
if (this._renderQ.length === 0 && this._flushing) {
|
||||
this._flushing = false;
|
||||
this.onflush();
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Display;
|
||||
}();
|
||||
|
||||
exports["default"] = Display;
|
||||
72
public/novnc/lib/encodings.js
Normal file
72
public/novnc/lib/encodings.js
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.encodingName = encodingName;
|
||||
exports.encodings = void 0;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
var encodings = {
|
||||
encodingRaw: 0,
|
||||
encodingCopyRect: 1,
|
||||
encodingRRE: 2,
|
||||
encodingHextile: 5,
|
||||
encodingTight: 7,
|
||||
encodingZRLE: 16,
|
||||
encodingTightPNG: -260,
|
||||
encodingJPEG: 21,
|
||||
pseudoEncodingQualityLevel9: -23,
|
||||
pseudoEncodingQualityLevel0: -32,
|
||||
pseudoEncodingDesktopSize: -223,
|
||||
pseudoEncodingLastRect: -224,
|
||||
pseudoEncodingCursor: -239,
|
||||
pseudoEncodingQEMUExtendedKeyEvent: -258,
|
||||
pseudoEncodingDesktopName: -307,
|
||||
pseudoEncodingExtendedDesktopSize: -308,
|
||||
pseudoEncodingXvp: -309,
|
||||
pseudoEncodingFence: -312,
|
||||
pseudoEncodingContinuousUpdates: -313,
|
||||
pseudoEncodingCompressLevel9: -247,
|
||||
pseudoEncodingCompressLevel0: -256,
|
||||
pseudoEncodingVMwareCursor: 0x574d5664,
|
||||
pseudoEncodingExtendedClipboard: 0xc0a1e5ce
|
||||
};
|
||||
exports.encodings = encodings;
|
||||
|
||||
function encodingName(num) {
|
||||
switch (num) {
|
||||
case encodings.encodingRaw:
|
||||
return "Raw";
|
||||
|
||||
case encodings.encodingCopyRect:
|
||||
return "CopyRect";
|
||||
|
||||
case encodings.encodingRRE:
|
||||
return "RRE";
|
||||
|
||||
case encodings.encodingHextile:
|
||||
return "Hextile";
|
||||
|
||||
case encodings.encodingTight:
|
||||
return "Tight";
|
||||
|
||||
case encodings.encodingZRLE:
|
||||
return "ZRLE";
|
||||
|
||||
case encodings.encodingTightPNG:
|
||||
return "TightPNG";
|
||||
|
||||
case encodings.encodingJPEG:
|
||||
return "JPEG";
|
||||
|
||||
default:
|
||||
return "[unknown encoding " + num + "]";
|
||||
}
|
||||
}
|
||||
87
public/novnc/lib/inflator.js
Normal file
87
public/novnc/lib/inflator.js
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _inflate2 = require("../lib/vendor/pako/lib/zlib/inflate.js");
|
||||
|
||||
var _zstream = _interopRequireDefault(require("../lib/vendor/pako/lib/zlib/zstream.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var Inflate = /*#__PURE__*/function () {
|
||||
function Inflate() {
|
||||
_classCallCheck(this, Inflate);
|
||||
|
||||
this.strm = new _zstream["default"]();
|
||||
this.chunkSize = 1024 * 10 * 10;
|
||||
this.strm.output = new Uint8Array(this.chunkSize);
|
||||
this.windowBits = 5;
|
||||
(0, _inflate2.inflateInit)(this.strm, this.windowBits);
|
||||
}
|
||||
|
||||
_createClass(Inflate, [{
|
||||
key: "setInput",
|
||||
value: function setInput(data) {
|
||||
if (!data) {
|
||||
//FIXME: flush remaining data.
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
this.strm.input = null;
|
||||
this.strm.avail_in = 0;
|
||||
this.strm.next_in = 0;
|
||||
} else {
|
||||
this.strm.input = data;
|
||||
this.strm.avail_in = this.strm.input.length;
|
||||
this.strm.next_in = 0;
|
||||
/* eslint-enable camelcase */
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "inflate",
|
||||
value: function inflate(expected) {
|
||||
// resize our output buffer if it's too small
|
||||
// (we could just use multiple chunks, but that would cause an extra
|
||||
// allocation each time to flatten the chunks)
|
||||
if (expected > this.chunkSize) {
|
||||
this.chunkSize = expected;
|
||||
this.strm.output = new Uint8Array(this.chunkSize);
|
||||
}
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
|
||||
this.strm.next_out = 0;
|
||||
this.strm.avail_out = expected;
|
||||
/* eslint-enable camelcase */
|
||||
|
||||
var ret = (0, _inflate2.inflate)(this.strm, 0); // Flush argument not used.
|
||||
|
||||
if (ret < 0) {
|
||||
throw new Error("zlib inflate failed");
|
||||
}
|
||||
|
||||
if (this.strm.next_out != expected) {
|
||||
throw new Error("Incomplete zlib block");
|
||||
}
|
||||
|
||||
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
|
||||
}
|
||||
}, {
|
||||
key: "reset",
|
||||
value: function reset() {
|
||||
(0, _inflate2.inflateReset)(this.strm);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Inflate;
|
||||
}();
|
||||
|
||||
exports["default"] = Inflate;
|
||||
285
public/novnc/lib/input/domkeytable.js
Normal file
285
public/novnc/lib/input/domkeytable.js
Normal file
@@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _keysym = _interopRequireDefault(require("./keysym.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2018 The noVNC Authors
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mapping between HTML key values and VNC/X11 keysyms for "special"
|
||||
* keys that cannot be handled via their Unicode codepoint.
|
||||
*
|
||||
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||
*/
|
||||
var DOMKeyTable = {};
|
||||
|
||||
function addStandard(key, standard) {
|
||||
if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
|
||||
if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
|
||||
DOMKeyTable[key] = [standard, standard, standard, standard];
|
||||
}
|
||||
|
||||
function addLeftRight(key, left, right) {
|
||||
if (left === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
|
||||
if (right === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
|
||||
if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
|
||||
DOMKeyTable[key] = [left, left, right, left];
|
||||
}
|
||||
|
||||
function addNumpad(key, standard, numpad) {
|
||||
if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
|
||||
if (numpad === undefined) throw new Error("Undefined keysym for key \"" + key + "\"");
|
||||
if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\"");
|
||||
DOMKeyTable[key] = [standard, standard, standard, numpad];
|
||||
} // 3.2. Modifier Keys
|
||||
|
||||
|
||||
addLeftRight("Alt", _keysym["default"].XK_Alt_L, _keysym["default"].XK_Alt_R);
|
||||
addStandard("AltGraph", _keysym["default"].XK_ISO_Level3_Shift);
|
||||
addStandard("CapsLock", _keysym["default"].XK_Caps_Lock);
|
||||
addLeftRight("Control", _keysym["default"].XK_Control_L, _keysym["default"].XK_Control_R); // - Fn
|
||||
// - FnLock
|
||||
|
||||
addLeftRight("Meta", _keysym["default"].XK_Super_L, _keysym["default"].XK_Super_R);
|
||||
addStandard("NumLock", _keysym["default"].XK_Num_Lock);
|
||||
addStandard("ScrollLock", _keysym["default"].XK_Scroll_Lock);
|
||||
addLeftRight("Shift", _keysym["default"].XK_Shift_L, _keysym["default"].XK_Shift_R); // - Symbol
|
||||
// - SymbolLock
|
||||
// - Hyper
|
||||
// - Super
|
||||
// 3.3. Whitespace Keys
|
||||
|
||||
addNumpad("Enter", _keysym["default"].XK_Return, _keysym["default"].XK_KP_Enter);
|
||||
addStandard("Tab", _keysym["default"].XK_Tab);
|
||||
addNumpad(" ", _keysym["default"].XK_space, _keysym["default"].XK_KP_Space); // 3.4. Navigation Keys
|
||||
|
||||
addNumpad("ArrowDown", _keysym["default"].XK_Down, _keysym["default"].XK_KP_Down);
|
||||
addNumpad("ArrowLeft", _keysym["default"].XK_Left, _keysym["default"].XK_KP_Left);
|
||||
addNumpad("ArrowRight", _keysym["default"].XK_Right, _keysym["default"].XK_KP_Right);
|
||||
addNumpad("ArrowUp", _keysym["default"].XK_Up, _keysym["default"].XK_KP_Up);
|
||||
addNumpad("End", _keysym["default"].XK_End, _keysym["default"].XK_KP_End);
|
||||
addNumpad("Home", _keysym["default"].XK_Home, _keysym["default"].XK_KP_Home);
|
||||
addNumpad("PageDown", _keysym["default"].XK_Next, _keysym["default"].XK_KP_Next);
|
||||
addNumpad("PageUp", _keysym["default"].XK_Prior, _keysym["default"].XK_KP_Prior); // 3.5. Editing Keys
|
||||
|
||||
addStandard("Backspace", _keysym["default"].XK_BackSpace); // Browsers send "Clear" for the numpad 5 without NumLock because
|
||||
// Windows uses VK_Clear for that key. But Unix expects KP_Begin for
|
||||
// that scenario.
|
||||
|
||||
addNumpad("Clear", _keysym["default"].XK_Clear, _keysym["default"].XK_KP_Begin);
|
||||
addStandard("Copy", _keysym["default"].XF86XK_Copy); // - CrSel
|
||||
|
||||
addStandard("Cut", _keysym["default"].XF86XK_Cut);
|
||||
addNumpad("Delete", _keysym["default"].XK_Delete, _keysym["default"].XK_KP_Delete); // - EraseEof
|
||||
// - ExSel
|
||||
|
||||
addNumpad("Insert", _keysym["default"].XK_Insert, _keysym["default"].XK_KP_Insert);
|
||||
addStandard("Paste", _keysym["default"].XF86XK_Paste);
|
||||
addStandard("Redo", _keysym["default"].XK_Redo);
|
||||
addStandard("Undo", _keysym["default"].XK_Undo); // 3.6. UI Keys
|
||||
// - Accept
|
||||
// - Again (could just be XK_Redo)
|
||||
// - Attn
|
||||
|
||||
addStandard("Cancel", _keysym["default"].XK_Cancel);
|
||||
addStandard("ContextMenu", _keysym["default"].XK_Menu);
|
||||
addStandard("Escape", _keysym["default"].XK_Escape);
|
||||
addStandard("Execute", _keysym["default"].XK_Execute);
|
||||
addStandard("Find", _keysym["default"].XK_Find);
|
||||
addStandard("Help", _keysym["default"].XK_Help);
|
||||
addStandard("Pause", _keysym["default"].XK_Pause); // - Play
|
||||
// - Props
|
||||
|
||||
addStandard("Select", _keysym["default"].XK_Select);
|
||||
addStandard("ZoomIn", _keysym["default"].XF86XK_ZoomIn);
|
||||
addStandard("ZoomOut", _keysym["default"].XF86XK_ZoomOut); // 3.7. Device Keys
|
||||
|
||||
addStandard("BrightnessDown", _keysym["default"].XF86XK_MonBrightnessDown);
|
||||
addStandard("BrightnessUp", _keysym["default"].XF86XK_MonBrightnessUp);
|
||||
addStandard("Eject", _keysym["default"].XF86XK_Eject);
|
||||
addStandard("LogOff", _keysym["default"].XF86XK_LogOff);
|
||||
addStandard("Power", _keysym["default"].XF86XK_PowerOff);
|
||||
addStandard("PowerOff", _keysym["default"].XF86XK_PowerDown);
|
||||
addStandard("PrintScreen", _keysym["default"].XK_Print);
|
||||
addStandard("Hibernate", _keysym["default"].XF86XK_Hibernate);
|
||||
addStandard("Standby", _keysym["default"].XF86XK_Standby);
|
||||
addStandard("WakeUp", _keysym["default"].XF86XK_WakeUp); // 3.8. IME and Composition Keys
|
||||
|
||||
addStandard("AllCandidates", _keysym["default"].XK_MultipleCandidate);
|
||||
addStandard("Alphanumeric", _keysym["default"].XK_Eisu_toggle);
|
||||
addStandard("CodeInput", _keysym["default"].XK_Codeinput);
|
||||
addStandard("Compose", _keysym["default"].XK_Multi_key);
|
||||
addStandard("Convert", _keysym["default"].XK_Henkan); // - Dead
|
||||
// - FinalMode
|
||||
|
||||
addStandard("GroupFirst", _keysym["default"].XK_ISO_First_Group);
|
||||
addStandard("GroupLast", _keysym["default"].XK_ISO_Last_Group);
|
||||
addStandard("GroupNext", _keysym["default"].XK_ISO_Next_Group);
|
||||
addStandard("GroupPrevious", _keysym["default"].XK_ISO_Prev_Group); // - ModeChange (XK_Mode_switch is often used for AltGr)
|
||||
// - NextCandidate
|
||||
|
||||
addStandard("NonConvert", _keysym["default"].XK_Muhenkan);
|
||||
addStandard("PreviousCandidate", _keysym["default"].XK_PreviousCandidate); // - Process
|
||||
|
||||
addStandard("SingleCandidate", _keysym["default"].XK_SingleCandidate);
|
||||
addStandard("HangulMode", _keysym["default"].XK_Hangul);
|
||||
addStandard("HanjaMode", _keysym["default"].XK_Hangul_Hanja);
|
||||
addStandard("JunjaMode", _keysym["default"].XK_Hangul_Jeonja);
|
||||
addStandard("Eisu", _keysym["default"].XK_Eisu_toggle);
|
||||
addStandard("Hankaku", _keysym["default"].XK_Hankaku);
|
||||
addStandard("Hiragana", _keysym["default"].XK_Hiragana);
|
||||
addStandard("HiraganaKatakana", _keysym["default"].XK_Hiragana_Katakana);
|
||||
addStandard("KanaMode", _keysym["default"].XK_Kana_Shift); // could also be _Kana_Lock
|
||||
|
||||
addStandard("KanjiMode", _keysym["default"].XK_Kanji);
|
||||
addStandard("Katakana", _keysym["default"].XK_Katakana);
|
||||
addStandard("Romaji", _keysym["default"].XK_Romaji);
|
||||
addStandard("Zenkaku", _keysym["default"].XK_Zenkaku);
|
||||
addStandard("ZenkakuHankaku", _keysym["default"].XK_Zenkaku_Hankaku); // 3.9. General-Purpose Function Keys
|
||||
|
||||
addStandard("F1", _keysym["default"].XK_F1);
|
||||
addStandard("F2", _keysym["default"].XK_F2);
|
||||
addStandard("F3", _keysym["default"].XK_F3);
|
||||
addStandard("F4", _keysym["default"].XK_F4);
|
||||
addStandard("F5", _keysym["default"].XK_F5);
|
||||
addStandard("F6", _keysym["default"].XK_F6);
|
||||
addStandard("F7", _keysym["default"].XK_F7);
|
||||
addStandard("F8", _keysym["default"].XK_F8);
|
||||
addStandard("F9", _keysym["default"].XK_F9);
|
||||
addStandard("F10", _keysym["default"].XK_F10);
|
||||
addStandard("F11", _keysym["default"].XK_F11);
|
||||
addStandard("F12", _keysym["default"].XK_F12);
|
||||
addStandard("F13", _keysym["default"].XK_F13);
|
||||
addStandard("F14", _keysym["default"].XK_F14);
|
||||
addStandard("F15", _keysym["default"].XK_F15);
|
||||
addStandard("F16", _keysym["default"].XK_F16);
|
||||
addStandard("F17", _keysym["default"].XK_F17);
|
||||
addStandard("F18", _keysym["default"].XK_F18);
|
||||
addStandard("F19", _keysym["default"].XK_F19);
|
||||
addStandard("F20", _keysym["default"].XK_F20);
|
||||
addStandard("F21", _keysym["default"].XK_F21);
|
||||
addStandard("F22", _keysym["default"].XK_F22);
|
||||
addStandard("F23", _keysym["default"].XK_F23);
|
||||
addStandard("F24", _keysym["default"].XK_F24);
|
||||
addStandard("F25", _keysym["default"].XK_F25);
|
||||
addStandard("F26", _keysym["default"].XK_F26);
|
||||
addStandard("F27", _keysym["default"].XK_F27);
|
||||
addStandard("F28", _keysym["default"].XK_F28);
|
||||
addStandard("F29", _keysym["default"].XK_F29);
|
||||
addStandard("F30", _keysym["default"].XK_F30);
|
||||
addStandard("F31", _keysym["default"].XK_F31);
|
||||
addStandard("F32", _keysym["default"].XK_F32);
|
||||
addStandard("F33", _keysym["default"].XK_F33);
|
||||
addStandard("F34", _keysym["default"].XK_F34);
|
||||
addStandard("F35", _keysym["default"].XK_F35); // - Soft1...
|
||||
// 3.10. Multimedia Keys
|
||||
// - ChannelDown
|
||||
// - ChannelUp
|
||||
|
||||
addStandard("Close", _keysym["default"].XF86XK_Close);
|
||||
addStandard("MailForward", _keysym["default"].XF86XK_MailForward);
|
||||
addStandard("MailReply", _keysym["default"].XF86XK_Reply);
|
||||
addStandard("MailSend", _keysym["default"].XF86XK_Send); // - MediaClose
|
||||
|
||||
addStandard("MediaFastForward", _keysym["default"].XF86XK_AudioForward);
|
||||
addStandard("MediaPause", _keysym["default"].XF86XK_AudioPause);
|
||||
addStandard("MediaPlay", _keysym["default"].XF86XK_AudioPlay); // - MediaPlayPause
|
||||
|
||||
addStandard("MediaRecord", _keysym["default"].XF86XK_AudioRecord);
|
||||
addStandard("MediaRewind", _keysym["default"].XF86XK_AudioRewind);
|
||||
addStandard("MediaStop", _keysym["default"].XF86XK_AudioStop);
|
||||
addStandard("MediaTrackNext", _keysym["default"].XF86XK_AudioNext);
|
||||
addStandard("MediaTrackPrevious", _keysym["default"].XF86XK_AudioPrev);
|
||||
addStandard("New", _keysym["default"].XF86XK_New);
|
||||
addStandard("Open", _keysym["default"].XF86XK_Open);
|
||||
addStandard("Print", _keysym["default"].XK_Print);
|
||||
addStandard("Save", _keysym["default"].XF86XK_Save);
|
||||
addStandard("SpellCheck", _keysym["default"].XF86XK_Spell); // 3.11. Multimedia Numpad Keys
|
||||
// - Key11
|
||||
// - Key12
|
||||
// 3.12. Audio Keys
|
||||
// - AudioBalanceLeft
|
||||
// - AudioBalanceRight
|
||||
// - AudioBassBoostDown
|
||||
// - AudioBassBoostToggle
|
||||
// - AudioBassBoostUp
|
||||
// - AudioFaderFront
|
||||
// - AudioFaderRear
|
||||
// - AudioSurroundModeNext
|
||||
// - AudioTrebleDown
|
||||
// - AudioTrebleUp
|
||||
|
||||
addStandard("AudioVolumeDown", _keysym["default"].XF86XK_AudioLowerVolume);
|
||||
addStandard("AudioVolumeUp", _keysym["default"].XF86XK_AudioRaiseVolume);
|
||||
addStandard("AudioVolumeMute", _keysym["default"].XF86XK_AudioMute); // - MicrophoneToggle
|
||||
// - MicrophoneVolumeDown
|
||||
// - MicrophoneVolumeUp
|
||||
|
||||
addStandard("MicrophoneVolumeMute", _keysym["default"].XF86XK_AudioMicMute); // 3.13. Speech Keys
|
||||
// - SpeechCorrectionList
|
||||
// - SpeechInputToggle
|
||||
// 3.14. Application Keys
|
||||
|
||||
addStandard("LaunchApplication1", _keysym["default"].XF86XK_MyComputer);
|
||||
addStandard("LaunchApplication2", _keysym["default"].XF86XK_Calculator);
|
||||
addStandard("LaunchCalendar", _keysym["default"].XF86XK_Calendar); // - LaunchContacts
|
||||
|
||||
addStandard("LaunchMail", _keysym["default"].XF86XK_Mail);
|
||||
addStandard("LaunchMediaPlayer", _keysym["default"].XF86XK_AudioMedia);
|
||||
addStandard("LaunchMusicPlayer", _keysym["default"].XF86XK_Music);
|
||||
addStandard("LaunchPhone", _keysym["default"].XF86XK_Phone);
|
||||
addStandard("LaunchScreenSaver", _keysym["default"].XF86XK_ScreenSaver);
|
||||
addStandard("LaunchSpreadsheet", _keysym["default"].XF86XK_Excel);
|
||||
addStandard("LaunchWebBrowser", _keysym["default"].XF86XK_WWW);
|
||||
addStandard("LaunchWebCam", _keysym["default"].XF86XK_WebCam);
|
||||
addStandard("LaunchWordProcessor", _keysym["default"].XF86XK_Word); // 3.15. Browser Keys
|
||||
|
||||
addStandard("BrowserBack", _keysym["default"].XF86XK_Back);
|
||||
addStandard("BrowserFavorites", _keysym["default"].XF86XK_Favorites);
|
||||
addStandard("BrowserForward", _keysym["default"].XF86XK_Forward);
|
||||
addStandard("BrowserHome", _keysym["default"].XF86XK_HomePage);
|
||||
addStandard("BrowserRefresh", _keysym["default"].XF86XK_Refresh);
|
||||
addStandard("BrowserSearch", _keysym["default"].XF86XK_Search);
|
||||
addStandard("BrowserStop", _keysym["default"].XF86XK_Stop); // 3.16. Mobile Phone Keys
|
||||
// - A whole bunch...
|
||||
// 3.17. TV Keys
|
||||
// - A whole bunch...
|
||||
// 3.18. Media Controller Keys
|
||||
// - A whole bunch...
|
||||
|
||||
addStandard("Dimmer", _keysym["default"].XF86XK_BrightnessAdjust);
|
||||
addStandard("MediaAudioTrack", _keysym["default"].XF86XK_AudioCycleTrack);
|
||||
addStandard("RandomToggle", _keysym["default"].XF86XK_AudioRandomPlay);
|
||||
addStandard("SplitScreenToggle", _keysym["default"].XF86XK_SplitScreen);
|
||||
addStandard("Subtitle", _keysym["default"].XF86XK_Subtitle);
|
||||
addStandard("VideoModeNext", _keysym["default"].XF86XK_Next_VMode); // Extra: Numpad
|
||||
|
||||
addNumpad("=", _keysym["default"].XK_equal, _keysym["default"].XK_KP_Equal);
|
||||
addNumpad("+", _keysym["default"].XK_plus, _keysym["default"].XK_KP_Add);
|
||||
addNumpad("-", _keysym["default"].XK_minus, _keysym["default"].XK_KP_Subtract);
|
||||
addNumpad("*", _keysym["default"].XK_asterisk, _keysym["default"].XK_KP_Multiply);
|
||||
addNumpad("/", _keysym["default"].XK_slash, _keysym["default"].XK_KP_Divide);
|
||||
addNumpad(".", _keysym["default"].XK_period, _keysym["default"].XK_KP_Decimal);
|
||||
addNumpad(",", _keysym["default"].XK_comma, _keysym["default"].XK_KP_Separator);
|
||||
addNumpad("0", _keysym["default"].XK_0, _keysym["default"].XK_KP_0);
|
||||
addNumpad("1", _keysym["default"].XK_1, _keysym["default"].XK_KP_1);
|
||||
addNumpad("2", _keysym["default"].XK_2, _keysym["default"].XK_KP_2);
|
||||
addNumpad("3", _keysym["default"].XK_3, _keysym["default"].XK_KP_3);
|
||||
addNumpad("4", _keysym["default"].XK_4, _keysym["default"].XK_KP_4);
|
||||
addNumpad("5", _keysym["default"].XK_5, _keysym["default"].XK_KP_5);
|
||||
addNumpad("6", _keysym["default"].XK_6, _keysym["default"].XK_KP_6);
|
||||
addNumpad("7", _keysym["default"].XK_7, _keysym["default"].XK_KP_7);
|
||||
addNumpad("8", _keysym["default"].XK_8, _keysym["default"].XK_KP_8);
|
||||
addNumpad("9", _keysym["default"].XK_9, _keysym["default"].XK_KP_9);
|
||||
var _default = DOMKeyTable;
|
||||
exports["default"] = _default;
|
||||
123
public/novnc/lib/input/fixedkeys.js
Normal file
123
public/novnc/lib/input/fixedkeys.js
Normal file
@@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2018 The noVNC Authors
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Fallback mapping between HTML key codes (physical keys) and
|
||||
* HTML key values. This only works for keys that don't vary
|
||||
* between layouts. We also omit those who manage fine by mapping the
|
||||
* Unicode representation.
|
||||
*
|
||||
* See https://www.w3.org/TR/uievents-code/ for possible codes.
|
||||
* See https://www.w3.org/TR/uievents-key/ for possible values.
|
||||
*/
|
||||
|
||||
/* eslint-disable key-spacing */
|
||||
var _default = {
|
||||
// 3.1.1.1. Writing System Keys
|
||||
'Backspace': 'Backspace',
|
||||
// 3.1.1.2. Functional Keys
|
||||
'AltLeft': 'Alt',
|
||||
'AltRight': 'Alt',
|
||||
// This could also be 'AltGraph'
|
||||
'CapsLock': 'CapsLock',
|
||||
'ContextMenu': 'ContextMenu',
|
||||
'ControlLeft': 'Control',
|
||||
'ControlRight': 'Control',
|
||||
'Enter': 'Enter',
|
||||
'MetaLeft': 'Meta',
|
||||
'MetaRight': 'Meta',
|
||||
'ShiftLeft': 'Shift',
|
||||
'ShiftRight': 'Shift',
|
||||
'Tab': 'Tab',
|
||||
// FIXME: Japanese/Korean keys
|
||||
// 3.1.2. Control Pad Section
|
||||
'Delete': 'Delete',
|
||||
'End': 'End',
|
||||
'Help': 'Help',
|
||||
'Home': 'Home',
|
||||
'Insert': 'Insert',
|
||||
'PageDown': 'PageDown',
|
||||
'PageUp': 'PageUp',
|
||||
// 3.1.3. Arrow Pad Section
|
||||
'ArrowDown': 'ArrowDown',
|
||||
'ArrowLeft': 'ArrowLeft',
|
||||
'ArrowRight': 'ArrowRight',
|
||||
'ArrowUp': 'ArrowUp',
|
||||
// 3.1.4. Numpad Section
|
||||
'NumLock': 'NumLock',
|
||||
'NumpadBackspace': 'Backspace',
|
||||
'NumpadClear': 'Clear',
|
||||
// 3.1.5. Function Section
|
||||
'Escape': 'Escape',
|
||||
'F1': 'F1',
|
||||
'F2': 'F2',
|
||||
'F3': 'F3',
|
||||
'F4': 'F4',
|
||||
'F5': 'F5',
|
||||
'F6': 'F6',
|
||||
'F7': 'F7',
|
||||
'F8': 'F8',
|
||||
'F9': 'F9',
|
||||
'F10': 'F10',
|
||||
'F11': 'F11',
|
||||
'F12': 'F12',
|
||||
'F13': 'F13',
|
||||
'F14': 'F14',
|
||||
'F15': 'F15',
|
||||
'F16': 'F16',
|
||||
'F17': 'F17',
|
||||
'F18': 'F18',
|
||||
'F19': 'F19',
|
||||
'F20': 'F20',
|
||||
'F21': 'F21',
|
||||
'F22': 'F22',
|
||||
'F23': 'F23',
|
||||
'F24': 'F24',
|
||||
'F25': 'F25',
|
||||
'F26': 'F26',
|
||||
'F27': 'F27',
|
||||
'F28': 'F28',
|
||||
'F29': 'F29',
|
||||
'F30': 'F30',
|
||||
'F31': 'F31',
|
||||
'F32': 'F32',
|
||||
'F33': 'F33',
|
||||
'F34': 'F34',
|
||||
'F35': 'F35',
|
||||
'PrintScreen': 'PrintScreen',
|
||||
'ScrollLock': 'ScrollLock',
|
||||
'Pause': 'Pause',
|
||||
// 3.1.6. Media Keys
|
||||
'BrowserBack': 'BrowserBack',
|
||||
'BrowserFavorites': 'BrowserFavorites',
|
||||
'BrowserForward': 'BrowserForward',
|
||||
'BrowserHome': 'BrowserHome',
|
||||
'BrowserRefresh': 'BrowserRefresh',
|
||||
'BrowserSearch': 'BrowserSearch',
|
||||
'BrowserStop': 'BrowserStop',
|
||||
'Eject': 'Eject',
|
||||
'LaunchApp1': 'LaunchMyComputer',
|
||||
'LaunchApp2': 'LaunchCalendar',
|
||||
'LaunchMail': 'LaunchMail',
|
||||
'MediaPlayPause': 'MediaPlay',
|
||||
'MediaStop': 'MediaStop',
|
||||
'MediaTrackNext': 'MediaTrackNext',
|
||||
'MediaTrackPrevious': 'MediaTrackPrevious',
|
||||
'Power': 'Power',
|
||||
'Sleep': 'Sleep',
|
||||
'AudioVolumeDown': 'AudioVolumeDown',
|
||||
'AudioVolumeMute': 'AudioVolumeMute',
|
||||
'AudioVolumeUp': 'AudioVolumeUp',
|
||||
'WakeUp': 'WakeUp'
|
||||
};
|
||||
exports["default"] = _default;
|
||||
642
public/novnc/lib/input/gesturehandler.js
Normal file
642
public/novnc/lib/input/gesturehandler.js
Normal file
@@ -0,0 +1,642 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2020 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
*/
|
||||
var GH_NOGESTURE = 0;
|
||||
var GH_ONETAP = 1;
|
||||
var GH_TWOTAP = 2;
|
||||
var GH_THREETAP = 4;
|
||||
var GH_DRAG = 8;
|
||||
var GH_LONGPRESS = 16;
|
||||
var GH_TWODRAG = 32;
|
||||
var GH_PINCH = 64;
|
||||
var GH_INITSTATE = 127;
|
||||
var GH_MOVE_THRESHOLD = 50;
|
||||
var GH_ANGLE_THRESHOLD = 90; // Degrees
|
||||
// Timeout when waiting for gestures (ms)
|
||||
|
||||
var GH_MULTITOUCH_TIMEOUT = 250; // Maximum time between press and release for a tap (ms)
|
||||
|
||||
var GH_TAP_TIMEOUT = 1000; // Timeout when waiting for longpress (ms)
|
||||
|
||||
var GH_LONGPRESS_TIMEOUT = 1000; // Timeout when waiting to decide between PINCH and TWODRAG (ms)
|
||||
|
||||
var GH_TWOTOUCH_TIMEOUT = 50;
|
||||
|
||||
var GestureHandler = /*#__PURE__*/function () {
|
||||
function GestureHandler() {
|
||||
_classCallCheck(this, GestureHandler);
|
||||
|
||||
this._target = null;
|
||||
this._state = GH_INITSTATE;
|
||||
this._tracked = [];
|
||||
this._ignored = [];
|
||||
this._waitingRelease = false;
|
||||
this._releaseStart = 0.0;
|
||||
this._longpressTimeoutId = null;
|
||||
this._twoTouchTimeoutId = null;
|
||||
this._boundEventHandler = this._eventHandler.bind(this);
|
||||
}
|
||||
|
||||
_createClass(GestureHandler, [{
|
||||
key: "attach",
|
||||
value: function attach(target) {
|
||||
this.detach();
|
||||
this._target = target;
|
||||
|
||||
this._target.addEventListener('touchstart', this._boundEventHandler);
|
||||
|
||||
this._target.addEventListener('touchmove', this._boundEventHandler);
|
||||
|
||||
this._target.addEventListener('touchend', this._boundEventHandler);
|
||||
|
||||
this._target.addEventListener('touchcancel', this._boundEventHandler);
|
||||
}
|
||||
}, {
|
||||
key: "detach",
|
||||
value: function detach() {
|
||||
if (!this._target) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._stopLongpressTimeout();
|
||||
|
||||
this._stopTwoTouchTimeout();
|
||||
|
||||
this._target.removeEventListener('touchstart', this._boundEventHandler);
|
||||
|
||||
this._target.removeEventListener('touchmove', this._boundEventHandler);
|
||||
|
||||
this._target.removeEventListener('touchend', this._boundEventHandler);
|
||||
|
||||
this._target.removeEventListener('touchcancel', this._boundEventHandler);
|
||||
|
||||
this._target = null;
|
||||
}
|
||||
}, {
|
||||
key: "_eventHandler",
|
||||
value: function _eventHandler(e) {
|
||||
var fn;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
switch (e.type) {
|
||||
case 'touchstart':
|
||||
fn = this._touchStart;
|
||||
break;
|
||||
|
||||
case 'touchmove':
|
||||
fn = this._touchMove;
|
||||
break;
|
||||
|
||||
case 'touchend':
|
||||
case 'touchcancel':
|
||||
fn = this._touchEnd;
|
||||
break;
|
||||
}
|
||||
|
||||
for (var i = 0; i < e.changedTouches.length; i++) {
|
||||
var touch = e.changedTouches[i];
|
||||
fn.call(this, touch.identifier, touch.clientX, touch.clientY);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_touchStart",
|
||||
value: function _touchStart(id, x, y) {
|
||||
// Ignore any new touches if there is already an active gesture,
|
||||
// or we're in a cleanup state
|
||||
if (this._hasDetectedGesture() || this._state === GH_NOGESTURE) {
|
||||
this._ignored.push(id);
|
||||
|
||||
return;
|
||||
} // Did it take too long between touches that we should no longer
|
||||
// consider this a single gesture?
|
||||
|
||||
|
||||
if (this._tracked.length > 0 && Date.now() - this._tracked[0].started > GH_MULTITOUCH_TIMEOUT) {
|
||||
this._state = GH_NOGESTURE;
|
||||
|
||||
this._ignored.push(id);
|
||||
|
||||
return;
|
||||
} // If we're waiting for fingers to release then we should no longer
|
||||
// recognize new touches
|
||||
|
||||
|
||||
if (this._waitingRelease) {
|
||||
this._state = GH_NOGESTURE;
|
||||
|
||||
this._ignored.push(id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this._tracked.push({
|
||||
id: id,
|
||||
started: Date.now(),
|
||||
active: true,
|
||||
firstX: x,
|
||||
firstY: y,
|
||||
lastX: x,
|
||||
lastY: y,
|
||||
angle: 0
|
||||
});
|
||||
|
||||
switch (this._tracked.length) {
|
||||
case 1:
|
||||
this._startLongpressTimeout();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this._state &= ~(GH_ONETAP | GH_DRAG | GH_LONGPRESS);
|
||||
|
||||
this._stopLongpressTimeout();
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this._state &= ~(GH_TWOTAP | GH_TWODRAG | GH_PINCH);
|
||||
break;
|
||||
|
||||
default:
|
||||
this._state = GH_NOGESTURE;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_touchMove",
|
||||
value: function _touchMove(id, x, y) {
|
||||
var touch = this._tracked.find(function (t) {
|
||||
return t.id === id;
|
||||
}); // If this is an update for a touch we're not tracking, ignore it
|
||||
|
||||
|
||||
if (touch === undefined) {
|
||||
return;
|
||||
} // Update the touches last position with the event coordinates
|
||||
|
||||
|
||||
touch.lastX = x;
|
||||
touch.lastY = y;
|
||||
var deltaX = x - touch.firstX;
|
||||
var deltaY = y - touch.firstY; // Update angle when the touch has moved
|
||||
|
||||
if (touch.firstX !== touch.lastX || touch.firstY !== touch.lastY) {
|
||||
touch.angle = Math.atan2(deltaY, deltaX) * 180 / Math.PI;
|
||||
}
|
||||
|
||||
if (!this._hasDetectedGesture()) {
|
||||
// Ignore moves smaller than the minimum threshold
|
||||
if (Math.hypot(deltaX, deltaY) < GH_MOVE_THRESHOLD) {
|
||||
return;
|
||||
} // Can't be a tap or long press as we've seen movement
|
||||
|
||||
|
||||
this._state &= ~(GH_ONETAP | GH_TWOTAP | GH_THREETAP | GH_LONGPRESS);
|
||||
|
||||
this._stopLongpressTimeout();
|
||||
|
||||
if (this._tracked.length !== 1) {
|
||||
this._state &= ~GH_DRAG;
|
||||
}
|
||||
|
||||
if (this._tracked.length !== 2) {
|
||||
this._state &= ~(GH_TWODRAG | GH_PINCH);
|
||||
} // We need to figure out which of our different two touch gestures
|
||||
// this might be
|
||||
|
||||
|
||||
if (this._tracked.length === 2) {
|
||||
// The other touch is the one where the id doesn't match
|
||||
var prevTouch = this._tracked.find(function (t) {
|
||||
return t.id !== id;
|
||||
}); // How far the previous touch point has moved since start
|
||||
|
||||
|
||||
var prevDeltaMove = Math.hypot(prevTouch.firstX - prevTouch.lastX, prevTouch.firstY - prevTouch.lastY); // We know that the current touch moved far enough,
|
||||
// but unless both touches moved further than their
|
||||
// threshold we don't want to disqualify any gestures
|
||||
|
||||
if (prevDeltaMove > GH_MOVE_THRESHOLD) {
|
||||
// The angle difference between the direction of the touch points
|
||||
var deltaAngle = Math.abs(touch.angle - prevTouch.angle);
|
||||
deltaAngle = Math.abs((deltaAngle + 180) % 360 - 180); // PINCH or TWODRAG can be eliminated depending on the angle
|
||||
|
||||
if (deltaAngle > GH_ANGLE_THRESHOLD) {
|
||||
this._state &= ~GH_TWODRAG;
|
||||
} else {
|
||||
this._state &= ~GH_PINCH;
|
||||
}
|
||||
|
||||
if (this._isTwoTouchTimeoutRunning()) {
|
||||
this._stopTwoTouchTimeout();
|
||||
}
|
||||
} else if (!this._isTwoTouchTimeoutRunning()) {
|
||||
// We can't determine the gesture right now, let's
|
||||
// wait and see if more events are on their way
|
||||
this._startTwoTouchTimeout();
|
||||
}
|
||||
}
|
||||
|
||||
if (!this._hasDetectedGesture()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._pushEvent('gesturestart');
|
||||
}
|
||||
|
||||
this._pushEvent('gesturemove');
|
||||
}
|
||||
}, {
|
||||
key: "_touchEnd",
|
||||
value: function _touchEnd(id, x, y) {
|
||||
// Check if this is an ignored touch
|
||||
if (this._ignored.indexOf(id) !== -1) {
|
||||
// Remove this touch from ignored
|
||||
this._ignored.splice(this._ignored.indexOf(id), 1); // And reset the state if there are no more touches
|
||||
|
||||
|
||||
if (this._ignored.length === 0 && this._tracked.length === 0) {
|
||||
this._state = GH_INITSTATE;
|
||||
this._waitingRelease = false;
|
||||
}
|
||||
|
||||
return;
|
||||
} // We got a touchend before the timer triggered,
|
||||
// this cannot result in a gesture anymore.
|
||||
|
||||
|
||||
if (!this._hasDetectedGesture() && this._isTwoTouchTimeoutRunning()) {
|
||||
this._stopTwoTouchTimeout();
|
||||
|
||||
this._state = GH_NOGESTURE;
|
||||
} // Some gestures don't trigger until a touch is released
|
||||
|
||||
|
||||
if (!this._hasDetectedGesture()) {
|
||||
// Can't be a gesture that relies on movement
|
||||
this._state &= ~(GH_DRAG | GH_TWODRAG | GH_PINCH); // Or something that relies on more time
|
||||
|
||||
this._state &= ~GH_LONGPRESS;
|
||||
|
||||
this._stopLongpressTimeout();
|
||||
|
||||
if (!this._waitingRelease) {
|
||||
this._releaseStart = Date.now();
|
||||
this._waitingRelease = true; // Can't be a tap that requires more touches than we current have
|
||||
|
||||
switch (this._tracked.length) {
|
||||
case 1:
|
||||
this._state &= ~(GH_TWOTAP | GH_THREETAP);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this._state &= ~(GH_ONETAP | GH_THREETAP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // Waiting for all touches to release? (i.e. some tap)
|
||||
|
||||
|
||||
if (this._waitingRelease) {
|
||||
// Were all touches released at roughly the same time?
|
||||
if (Date.now() - this._releaseStart > GH_MULTITOUCH_TIMEOUT) {
|
||||
this._state = GH_NOGESTURE;
|
||||
} // Did too long time pass between press and release?
|
||||
|
||||
|
||||
if (this._tracked.some(function (t) {
|
||||
return Date.now() - t.started > GH_TAP_TIMEOUT;
|
||||
})) {
|
||||
this._state = GH_NOGESTURE;
|
||||
}
|
||||
|
||||
var touch = this._tracked.find(function (t) {
|
||||
return t.id === id;
|
||||
});
|
||||
|
||||
touch.active = false; // Are we still waiting for more releases?
|
||||
|
||||
if (this._hasDetectedGesture()) {
|
||||
this._pushEvent('gesturestart');
|
||||
} else {
|
||||
// Have we reached a dead end?
|
||||
if (this._state !== GH_NOGESTURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this._hasDetectedGesture()) {
|
||||
this._pushEvent('gestureend');
|
||||
} // Ignore any remaining touches until they are ended
|
||||
|
||||
|
||||
for (var i = 0; i < this._tracked.length; i++) {
|
||||
if (this._tracked[i].active) {
|
||||
this._ignored.push(this._tracked[i].id);
|
||||
}
|
||||
}
|
||||
|
||||
this._tracked = [];
|
||||
this._state = GH_NOGESTURE; // Remove this touch from ignored if it's in there
|
||||
|
||||
if (this._ignored.indexOf(id) !== -1) {
|
||||
this._ignored.splice(this._ignored.indexOf(id), 1);
|
||||
} // We reset the state if ignored is empty
|
||||
|
||||
|
||||
if (this._ignored.length === 0) {
|
||||
this._state = GH_INITSTATE;
|
||||
this._waitingRelease = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_hasDetectedGesture",
|
||||
value: function _hasDetectedGesture() {
|
||||
if (this._state === GH_NOGESTURE) {
|
||||
return false;
|
||||
} // Check to see if the bitmask value is a power of 2
|
||||
// (i.e. only one bit set). If it is, we have a state.
|
||||
|
||||
|
||||
if (this._state & this._state - 1) {
|
||||
return false;
|
||||
} // For taps we also need to have all touches released
|
||||
// before we've fully detected the gesture
|
||||
|
||||
|
||||
if (this._state & (GH_ONETAP | GH_TWOTAP | GH_THREETAP)) {
|
||||
if (this._tracked.some(function (t) {
|
||||
return t.active;
|
||||
})) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_startLongpressTimeout",
|
||||
value: function _startLongpressTimeout() {
|
||||
var _this = this;
|
||||
|
||||
this._stopLongpressTimeout();
|
||||
|
||||
this._longpressTimeoutId = setTimeout(function () {
|
||||
return _this._longpressTimeout();
|
||||
}, GH_LONGPRESS_TIMEOUT);
|
||||
}
|
||||
}, {
|
||||
key: "_stopLongpressTimeout",
|
||||
value: function _stopLongpressTimeout() {
|
||||
clearTimeout(this._longpressTimeoutId);
|
||||
this._longpressTimeoutId = null;
|
||||
}
|
||||
}, {
|
||||
key: "_longpressTimeout",
|
||||
value: function _longpressTimeout() {
|
||||
if (this._hasDetectedGesture()) {
|
||||
throw new Error("A longpress gesture failed, conflict with a different gesture");
|
||||
}
|
||||
|
||||
this._state = GH_LONGPRESS;
|
||||
|
||||
this._pushEvent('gesturestart');
|
||||
}
|
||||
}, {
|
||||
key: "_startTwoTouchTimeout",
|
||||
value: function _startTwoTouchTimeout() {
|
||||
var _this2 = this;
|
||||
|
||||
this._stopTwoTouchTimeout();
|
||||
|
||||
this._twoTouchTimeoutId = setTimeout(function () {
|
||||
return _this2._twoTouchTimeout();
|
||||
}, GH_TWOTOUCH_TIMEOUT);
|
||||
}
|
||||
}, {
|
||||
key: "_stopTwoTouchTimeout",
|
||||
value: function _stopTwoTouchTimeout() {
|
||||
clearTimeout(this._twoTouchTimeoutId);
|
||||
this._twoTouchTimeoutId = null;
|
||||
}
|
||||
}, {
|
||||
key: "_isTwoTouchTimeoutRunning",
|
||||
value: function _isTwoTouchTimeoutRunning() {
|
||||
return this._twoTouchTimeoutId !== null;
|
||||
}
|
||||
}, {
|
||||
key: "_twoTouchTimeout",
|
||||
value: function _twoTouchTimeout() {
|
||||
if (this._tracked.length === 0) {
|
||||
throw new Error("A pinch or two drag gesture failed, no tracked touches");
|
||||
} // How far each touch point has moved since start
|
||||
|
||||
|
||||
var avgM = this._getAverageMovement();
|
||||
|
||||
var avgMoveH = Math.abs(avgM.x);
|
||||
var avgMoveV = Math.abs(avgM.y); // The difference in the distance between where
|
||||
// the touch points started and where they are now
|
||||
|
||||
var avgD = this._getAverageDistance();
|
||||
|
||||
var deltaTouchDistance = Math.abs(Math.hypot(avgD.first.x, avgD.first.y) - Math.hypot(avgD.last.x, avgD.last.y));
|
||||
|
||||
if (avgMoveV < deltaTouchDistance && avgMoveH < deltaTouchDistance) {
|
||||
this._state = GH_PINCH;
|
||||
} else {
|
||||
this._state = GH_TWODRAG;
|
||||
}
|
||||
|
||||
this._pushEvent('gesturestart');
|
||||
|
||||
this._pushEvent('gesturemove');
|
||||
}
|
||||
}, {
|
||||
key: "_pushEvent",
|
||||
value: function _pushEvent(type) {
|
||||
var detail = {
|
||||
type: this._stateToGesture(this._state)
|
||||
}; // For most gesture events the current (average) position is the
|
||||
// most useful
|
||||
|
||||
var avg = this._getPosition();
|
||||
|
||||
var pos = avg.last; // However we have a slight distance to detect gestures, so for the
|
||||
// first gesture event we want to use the first positions we saw
|
||||
|
||||
if (type === 'gesturestart') {
|
||||
pos = avg.first;
|
||||
} // For these gestures, we always want the event coordinates
|
||||
// to be where the gesture began, not the current touch location.
|
||||
|
||||
|
||||
switch (this._state) {
|
||||
case GH_TWODRAG:
|
||||
case GH_PINCH:
|
||||
pos = avg.first;
|
||||
break;
|
||||
}
|
||||
|
||||
detail['clientX'] = pos.x;
|
||||
detail['clientY'] = pos.y; // FIXME: other coordinates?
|
||||
// Some gestures also have a magnitude
|
||||
|
||||
if (this._state === GH_PINCH) {
|
||||
var distance = this._getAverageDistance();
|
||||
|
||||
if (type === 'gesturestart') {
|
||||
detail['magnitudeX'] = distance.first.x;
|
||||
detail['magnitudeY'] = distance.first.y;
|
||||
} else {
|
||||
detail['magnitudeX'] = distance.last.x;
|
||||
detail['magnitudeY'] = distance.last.y;
|
||||
}
|
||||
} else if (this._state === GH_TWODRAG) {
|
||||
if (type === 'gesturestart') {
|
||||
detail['magnitudeX'] = 0.0;
|
||||
detail['magnitudeY'] = 0.0;
|
||||
} else {
|
||||
var movement = this._getAverageMovement();
|
||||
|
||||
detail['magnitudeX'] = movement.x;
|
||||
detail['magnitudeY'] = movement.y;
|
||||
}
|
||||
}
|
||||
|
||||
var gev = new CustomEvent(type, {
|
||||
detail: detail
|
||||
});
|
||||
|
||||
this._target.dispatchEvent(gev);
|
||||
}
|
||||
}, {
|
||||
key: "_stateToGesture",
|
||||
value: function _stateToGesture(state) {
|
||||
switch (state) {
|
||||
case GH_ONETAP:
|
||||
return 'onetap';
|
||||
|
||||
case GH_TWOTAP:
|
||||
return 'twotap';
|
||||
|
||||
case GH_THREETAP:
|
||||
return 'threetap';
|
||||
|
||||
case GH_DRAG:
|
||||
return 'drag';
|
||||
|
||||
case GH_LONGPRESS:
|
||||
return 'longpress';
|
||||
|
||||
case GH_TWODRAG:
|
||||
return 'twodrag';
|
||||
|
||||
case GH_PINCH:
|
||||
return 'pinch';
|
||||
}
|
||||
|
||||
throw new Error("Unknown gesture state: " + state);
|
||||
}
|
||||
}, {
|
||||
key: "_getPosition",
|
||||
value: function _getPosition() {
|
||||
if (this._tracked.length === 0) {
|
||||
throw new Error("Failed to get gesture position, no tracked touches");
|
||||
}
|
||||
|
||||
var size = this._tracked.length;
|
||||
var fx = 0,
|
||||
fy = 0,
|
||||
lx = 0,
|
||||
ly = 0;
|
||||
|
||||
for (var i = 0; i < this._tracked.length; i++) {
|
||||
fx += this._tracked[i].firstX;
|
||||
fy += this._tracked[i].firstY;
|
||||
lx += this._tracked[i].lastX;
|
||||
ly += this._tracked[i].lastY;
|
||||
}
|
||||
|
||||
return {
|
||||
first: {
|
||||
x: fx / size,
|
||||
y: fy / size
|
||||
},
|
||||
last: {
|
||||
x: lx / size,
|
||||
y: ly / size
|
||||
}
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "_getAverageMovement",
|
||||
value: function _getAverageMovement() {
|
||||
if (this._tracked.length === 0) {
|
||||
throw new Error("Failed to get gesture movement, no tracked touches");
|
||||
}
|
||||
|
||||
var totalH, totalV;
|
||||
totalH = totalV = 0;
|
||||
var size = this._tracked.length;
|
||||
|
||||
for (var i = 0; i < this._tracked.length; i++) {
|
||||
totalH += this._tracked[i].lastX - this._tracked[i].firstX;
|
||||
totalV += this._tracked[i].lastY - this._tracked[i].firstY;
|
||||
}
|
||||
|
||||
return {
|
||||
x: totalH / size,
|
||||
y: totalV / size
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "_getAverageDistance",
|
||||
value: function _getAverageDistance() {
|
||||
if (this._tracked.length === 0) {
|
||||
throw new Error("Failed to get gesture distance, no tracked touches");
|
||||
} // Distance between the first and last tracked touches
|
||||
|
||||
|
||||
var first = this._tracked[0];
|
||||
var last = this._tracked[this._tracked.length - 1];
|
||||
var fdx = Math.abs(last.firstX - first.firstX);
|
||||
var fdy = Math.abs(last.firstY - first.firstY);
|
||||
var ldx = Math.abs(last.lastX - first.lastX);
|
||||
var ldy = Math.abs(last.lastY - first.lastY);
|
||||
return {
|
||||
first: {
|
||||
x: fdx,
|
||||
y: fdy
|
||||
},
|
||||
last: {
|
||||
x: ldx,
|
||||
y: ldy
|
||||
}
|
||||
};
|
||||
}
|
||||
}]);
|
||||
|
||||
return GestureHandler;
|
||||
}();
|
||||
|
||||
exports["default"] = GestureHandler;
|
||||
309
public/novnc/lib/input/keyboard.js
Normal file
309
public/novnc/lib/input/keyboard.js
Normal file
@@ -0,0 +1,309 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("../util/logging.js"));
|
||||
|
||||
var _events = require("../util/events.js");
|
||||
|
||||
var KeyboardUtil = _interopRequireWildcard(require("./util.js"));
|
||||
|
||||
var _keysym = _interopRequireDefault(require("./keysym.js"));
|
||||
|
||||
var browser = _interopRequireWildcard(require("../util/browser.js"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
//
|
||||
// Keyboard event handler
|
||||
//
|
||||
var Keyboard = /*#__PURE__*/function () {
|
||||
function Keyboard(target) {
|
||||
_classCallCheck(this, Keyboard);
|
||||
|
||||
this._target = target || null;
|
||||
this._keyDownList = {}; // List of depressed keys
|
||||
// (even if they are happy)
|
||||
|
||||
this._altGrArmed = false; // Windows AltGr detection
|
||||
// keep these here so we can refer to them later
|
||||
|
||||
this._eventHandlers = {
|
||||
'keyup': this._handleKeyUp.bind(this),
|
||||
'keydown': this._handleKeyDown.bind(this),
|
||||
'blur': this._allKeysUp.bind(this)
|
||||
}; // ===== EVENT HANDLERS =====
|
||||
|
||||
this.onkeyevent = function () {}; // Handler for key press/release
|
||||
|
||||
} // ===== PRIVATE METHODS =====
|
||||
|
||||
|
||||
_createClass(Keyboard, [{
|
||||
key: "_sendKeyEvent",
|
||||
value: function _sendKeyEvent(keysym, code, down) {
|
||||
if (down) {
|
||||
this._keyDownList[code] = keysym;
|
||||
} else {
|
||||
// Do we really think this key is down?
|
||||
if (!(code in this._keyDownList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete this._keyDownList[code];
|
||||
}
|
||||
|
||||
Log.Debug("onkeyevent " + (down ? "down" : "up") + ", keysym: " + keysym, ", code: " + code);
|
||||
this.onkeyevent(keysym, code, down);
|
||||
}
|
||||
}, {
|
||||
key: "_getKeyCode",
|
||||
value: function _getKeyCode(e) {
|
||||
var code = KeyboardUtil.getKeycode(e);
|
||||
|
||||
if (code !== 'Unidentified') {
|
||||
return code;
|
||||
} // Unstable, but we don't have anything else to go on
|
||||
|
||||
|
||||
if (e.keyCode) {
|
||||
// 229 is used for composition events
|
||||
if (e.keyCode !== 229) {
|
||||
return 'Platform' + e.keyCode;
|
||||
}
|
||||
} // A precursor to the final DOM3 standard. Unfortunately it
|
||||
// is not layout independent, so it is as bad as using keyCode
|
||||
|
||||
|
||||
if (e.keyIdentifier) {
|
||||
// Non-character key?
|
||||
if (e.keyIdentifier.substr(0, 2) !== 'U+') {
|
||||
return e.keyIdentifier;
|
||||
}
|
||||
|
||||
var codepoint = parseInt(e.keyIdentifier.substr(2), 16);
|
||||
|
||||
var _char = String.fromCharCode(codepoint).toUpperCase();
|
||||
|
||||
return 'Platform' + _char.charCodeAt();
|
||||
}
|
||||
|
||||
return 'Unidentified';
|
||||
}
|
||||
}, {
|
||||
key: "_handleKeyDown",
|
||||
value: function _handleKeyDown(e) {
|
||||
var code = this._getKeyCode(e);
|
||||
|
||||
var keysym = KeyboardUtil.getKeysym(e); // Windows doesn't have a proper AltGr, but handles it using
|
||||
// fake Ctrl+Alt. However the remote end might not be Windows,
|
||||
// so we need to merge those in to a single AltGr event. We
|
||||
// detect this case by seeing the two key events directly after
|
||||
// each other with a very short time between them (<50ms).
|
||||
|
||||
if (this._altGrArmed) {
|
||||
this._altGrArmed = false;
|
||||
clearTimeout(this._altGrTimeout);
|
||||
|
||||
if (code === "AltRight" && e.timeStamp - this._altGrCtrlTime < 50) {
|
||||
// FIXME: We fail to detect this if either Ctrl key is
|
||||
// first manually pressed as Windows then no
|
||||
// longer sends the fake Ctrl down event. It
|
||||
// does however happily send real Ctrl events
|
||||
// even when AltGr is already down. Some
|
||||
// browsers detect this for us though and set the
|
||||
// key to "AltGraph".
|
||||
keysym = _keysym["default"].XK_ISO_Level3_Shift;
|
||||
} else {
|
||||
this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
|
||||
}
|
||||
} // We cannot handle keys we cannot track, but we also need
|
||||
// to deal with virtual keyboards which omit key info
|
||||
|
||||
|
||||
if (code === 'Unidentified') {
|
||||
if (keysym) {
|
||||
// If it's a virtual keyboard then it should be
|
||||
// sufficient to just send press and release right
|
||||
// after each other
|
||||
this._sendKeyEvent(keysym, code, true);
|
||||
|
||||
this._sendKeyEvent(keysym, code, false);
|
||||
}
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
return;
|
||||
} // Alt behaves more like AltGraph on macOS, so shuffle the
|
||||
// keys around a bit to make things more sane for the remote
|
||||
// server. This method is used by RealVNC and TigerVNC (and
|
||||
// possibly others).
|
||||
|
||||
|
||||
if (browser.isMac() || browser.isIOS()) {
|
||||
switch (keysym) {
|
||||
case _keysym["default"].XK_Super_L:
|
||||
keysym = _keysym["default"].XK_Alt_L;
|
||||
break;
|
||||
|
||||
case _keysym["default"].XK_Super_R:
|
||||
keysym = _keysym["default"].XK_Super_L;
|
||||
break;
|
||||
|
||||
case _keysym["default"].XK_Alt_L:
|
||||
keysym = _keysym["default"].XK_Mode_switch;
|
||||
break;
|
||||
|
||||
case _keysym["default"].XK_Alt_R:
|
||||
keysym = _keysym["default"].XK_ISO_Level3_Shift;
|
||||
break;
|
||||
}
|
||||
} // Is this key already pressed? If so, then we must use the
|
||||
// same keysym or we'll confuse the server
|
||||
|
||||
|
||||
if (code in this._keyDownList) {
|
||||
keysym = this._keyDownList[code];
|
||||
} // macOS doesn't send proper key events for modifiers, only
|
||||
// state change events. That gets extra confusing for CapsLock
|
||||
// which toggles on each press, but not on release. So pretend
|
||||
// it was a quick press and release of the button.
|
||||
|
||||
|
||||
if ((browser.isMac() || browser.isIOS()) && code === 'CapsLock') {
|
||||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true);
|
||||
|
||||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false);
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
return;
|
||||
} // Windows doesn't send proper key releases for a bunch of
|
||||
// Japanese IM keys so we have to fake the release right away
|
||||
|
||||
|
||||
var jpBadKeys = [_keysym["default"].XK_Zenkaku_Hankaku, _keysym["default"].XK_Eisu_toggle, _keysym["default"].XK_Katakana, _keysym["default"].XK_Hiragana, _keysym["default"].XK_Romaji];
|
||||
|
||||
if (browser.isWindows() && jpBadKeys.includes(keysym)) {
|
||||
this._sendKeyEvent(keysym, code, true);
|
||||
|
||||
this._sendKeyEvent(keysym, code, false);
|
||||
|
||||
(0, _events.stopEvent)(e);
|
||||
return;
|
||||
}
|
||||
|
||||
(0, _events.stopEvent)(e); // Possible start of AltGr sequence? (see above)
|
||||
|
||||
if (code === "ControlLeft" && browser.isWindows() && !("ControlLeft" in this._keyDownList)) {
|
||||
this._altGrArmed = true;
|
||||
this._altGrTimeout = setTimeout(this._handleAltGrTimeout.bind(this), 100);
|
||||
this._altGrCtrlTime = e.timeStamp;
|
||||
return;
|
||||
}
|
||||
|
||||
this._sendKeyEvent(keysym, code, true);
|
||||
}
|
||||
}, {
|
||||
key: "_handleKeyUp",
|
||||
value: function _handleKeyUp(e) {
|
||||
(0, _events.stopEvent)(e);
|
||||
|
||||
var code = this._getKeyCode(e); // We can't get a release in the middle of an AltGr sequence, so
|
||||
// abort that detection
|
||||
|
||||
|
||||
if (this._altGrArmed) {
|
||||
this._altGrArmed = false;
|
||||
clearTimeout(this._altGrTimeout);
|
||||
|
||||
this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
|
||||
} // See comment in _handleKeyDown()
|
||||
|
||||
|
||||
if ((browser.isMac() || browser.isIOS()) && code === 'CapsLock') {
|
||||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true);
|
||||
|
||||
this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this._sendKeyEvent(this._keyDownList[code], code, false); // Windows has a rather nasty bug where it won't send key
|
||||
// release events for a Shift button if the other Shift is still
|
||||
// pressed
|
||||
|
||||
|
||||
if (browser.isWindows() && (code === 'ShiftLeft' || code === 'ShiftRight')) {
|
||||
if ('ShiftRight' in this._keyDownList) {
|
||||
this._sendKeyEvent(this._keyDownList['ShiftRight'], 'ShiftRight', false);
|
||||
}
|
||||
|
||||
if ('ShiftLeft' in this._keyDownList) {
|
||||
this._sendKeyEvent(this._keyDownList['ShiftLeft'], 'ShiftLeft', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_handleAltGrTimeout",
|
||||
value: function _handleAltGrTimeout() {
|
||||
this._altGrArmed = false;
|
||||
clearTimeout(this._altGrTimeout);
|
||||
|
||||
this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
|
||||
}
|
||||
}, {
|
||||
key: "_allKeysUp",
|
||||
value: function _allKeysUp() {
|
||||
Log.Debug(">> Keyboard.allKeysUp");
|
||||
|
||||
for (var code in this._keyDownList) {
|
||||
this._sendKeyEvent(this._keyDownList[code], code, false);
|
||||
}
|
||||
|
||||
Log.Debug("<< Keyboard.allKeysUp");
|
||||
} // ===== PUBLIC METHODS =====
|
||||
|
||||
}, {
|
||||
key: "grab",
|
||||
value: function grab() {
|
||||
//Log.Debug(">> Keyboard.grab");
|
||||
this._target.addEventListener('keydown', this._eventHandlers.keydown);
|
||||
|
||||
this._target.addEventListener('keyup', this._eventHandlers.keyup); // Release (key up) if window loses focus
|
||||
|
||||
|
||||
window.addEventListener('blur', this._eventHandlers.blur); //Log.Debug("<< Keyboard.grab");
|
||||
}
|
||||
}, {
|
||||
key: "ungrab",
|
||||
value: function ungrab() {
|
||||
//Log.Debug(">> Keyboard.ungrab");
|
||||
this._target.removeEventListener('keydown', this._eventHandlers.keydown);
|
||||
|
||||
this._target.removeEventListener('keyup', this._eventHandlers.keyup);
|
||||
|
||||
window.removeEventListener('blur', this._eventHandlers.blur); // Release (key up) all keys that are in a down state
|
||||
|
||||
this._allKeysUp(); //Log.Debug(">> Keyboard.ungrab");
|
||||
|
||||
}
|
||||
}]);
|
||||
|
||||
return Keyboard;
|
||||
}();
|
||||
|
||||
exports["default"] = Keyboard;
|
||||
1135
public/novnc/lib/input/keysym.js
Normal file
1135
public/novnc/lib/input/keysym.js
Normal file
File diff suppressed because it is too large
Load Diff
1354
public/novnc/lib/input/keysymdef.js
Normal file
1354
public/novnc/lib/input/keysymdef.js
Normal file
File diff suppressed because it is too large
Load Diff
259
public/novnc/lib/input/util.js
Normal file
259
public/novnc/lib/input/util.js
Normal file
@@ -0,0 +1,259 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getKey = getKey;
|
||||
exports.getKeycode = getKeycode;
|
||||
exports.getKeysym = getKeysym;
|
||||
|
||||
var _keysym = _interopRequireDefault(require("./keysym.js"));
|
||||
|
||||
var _keysymdef = _interopRequireDefault(require("./keysymdef.js"));
|
||||
|
||||
var _vkeys = _interopRequireDefault(require("./vkeys.js"));
|
||||
|
||||
var _fixedkeys = _interopRequireDefault(require("./fixedkeys.js"));
|
||||
|
||||
var _domkeytable = _interopRequireDefault(require("./domkeytable.js"));
|
||||
|
||||
var browser = _interopRequireWildcard(require("../util/browser.js"));
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
// Get 'KeyboardEvent.code', handling legacy browsers
|
||||
function getKeycode(evt) {
|
||||
// Are we getting proper key identifiers?
|
||||
// (unfortunately Firefox and Chrome are crappy here and gives
|
||||
// us an empty string on some platforms, rather than leaving it
|
||||
// undefined)
|
||||
if (evt.code) {
|
||||
// Mozilla isn't fully in sync with the spec yet
|
||||
switch (evt.code) {
|
||||
case 'OSLeft':
|
||||
return 'MetaLeft';
|
||||
|
||||
case 'OSRight':
|
||||
return 'MetaRight';
|
||||
}
|
||||
|
||||
return evt.code;
|
||||
} // The de-facto standard is to use Windows Virtual-Key codes
|
||||
// in the 'keyCode' field for non-printable characters
|
||||
|
||||
|
||||
if (evt.keyCode in _vkeys["default"]) {
|
||||
var code = _vkeys["default"][evt.keyCode]; // macOS has messed up this code for some reason
|
||||
|
||||
if (browser.isMac() && code === 'ContextMenu') {
|
||||
code = 'MetaRight';
|
||||
} // The keyCode doesn't distinguish between left and right
|
||||
// for the standard modifiers
|
||||
|
||||
|
||||
if (evt.location === 2) {
|
||||
switch (code) {
|
||||
case 'ShiftLeft':
|
||||
return 'ShiftRight';
|
||||
|
||||
case 'ControlLeft':
|
||||
return 'ControlRight';
|
||||
|
||||
case 'AltLeft':
|
||||
return 'AltRight';
|
||||
}
|
||||
} // Nor a bunch of the numpad keys
|
||||
|
||||
|
||||
if (evt.location === 3) {
|
||||
switch (code) {
|
||||
case 'Delete':
|
||||
return 'NumpadDecimal';
|
||||
|
||||
case 'Insert':
|
||||
return 'Numpad0';
|
||||
|
||||
case 'End':
|
||||
return 'Numpad1';
|
||||
|
||||
case 'ArrowDown':
|
||||
return 'Numpad2';
|
||||
|
||||
case 'PageDown':
|
||||
return 'Numpad3';
|
||||
|
||||
case 'ArrowLeft':
|
||||
return 'Numpad4';
|
||||
|
||||
case 'ArrowRight':
|
||||
return 'Numpad6';
|
||||
|
||||
case 'Home':
|
||||
return 'Numpad7';
|
||||
|
||||
case 'ArrowUp':
|
||||
return 'Numpad8';
|
||||
|
||||
case 'PageUp':
|
||||
return 'Numpad9';
|
||||
|
||||
case 'Enter':
|
||||
return 'NumpadEnter';
|
||||
}
|
||||
}
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
return 'Unidentified';
|
||||
} // Get 'KeyboardEvent.key', handling legacy browsers
|
||||
|
||||
|
||||
function getKey(evt) {
|
||||
// Are we getting a proper key value?
|
||||
if (evt.key !== undefined) {
|
||||
// Mozilla isn't fully in sync with the spec yet
|
||||
switch (evt.key) {
|
||||
case 'OS':
|
||||
return 'Meta';
|
||||
|
||||
case 'LaunchMyComputer':
|
||||
return 'LaunchApplication1';
|
||||
|
||||
case 'LaunchCalculator':
|
||||
return 'LaunchApplication2';
|
||||
} // iOS leaks some OS names
|
||||
|
||||
|
||||
switch (evt.key) {
|
||||
case 'UIKeyInputUpArrow':
|
||||
return 'ArrowUp';
|
||||
|
||||
case 'UIKeyInputDownArrow':
|
||||
return 'ArrowDown';
|
||||
|
||||
case 'UIKeyInputLeftArrow':
|
||||
return 'ArrowLeft';
|
||||
|
||||
case 'UIKeyInputRightArrow':
|
||||
return 'ArrowRight';
|
||||
|
||||
case 'UIKeyInputEscape':
|
||||
return 'Escape';
|
||||
} // Broken behaviour in Chrome
|
||||
|
||||
|
||||
if (evt.key === '\x00' && evt.code === 'NumpadDecimal') {
|
||||
return 'Delete';
|
||||
}
|
||||
|
||||
return evt.key;
|
||||
} // Try to deduce it based on the physical key
|
||||
|
||||
|
||||
var code = getKeycode(evt);
|
||||
|
||||
if (code in _fixedkeys["default"]) {
|
||||
return _fixedkeys["default"][code];
|
||||
} // If that failed, then see if we have a printable character
|
||||
|
||||
|
||||
if (evt.charCode) {
|
||||
return String.fromCharCode(evt.charCode);
|
||||
} // At this point we have nothing left to go on
|
||||
|
||||
|
||||
return 'Unidentified';
|
||||
} // Get the most reliable keysym value we can get from a key event
|
||||
|
||||
|
||||
function getKeysym(evt) {
|
||||
var key = getKey(evt);
|
||||
|
||||
if (key === 'Unidentified') {
|
||||
return null;
|
||||
} // First look up special keys
|
||||
|
||||
|
||||
if (key in _domkeytable["default"]) {
|
||||
var location = evt.location; // Safari screws up location for the right cmd key
|
||||
|
||||
if (key === 'Meta' && location === 0) {
|
||||
location = 2;
|
||||
} // And for Clear
|
||||
|
||||
|
||||
if (key === 'Clear' && location === 3) {
|
||||
var code = getKeycode(evt);
|
||||
|
||||
if (code === 'NumLock') {
|
||||
location = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (location === undefined || location > 3) {
|
||||
location = 0;
|
||||
} // The original Meta key now gets confused with the Windows key
|
||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1020141
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1232918
|
||||
|
||||
|
||||
if (key === 'Meta') {
|
||||
var _code = getKeycode(evt);
|
||||
|
||||
if (_code === 'AltLeft') {
|
||||
return _keysym["default"].XK_Meta_L;
|
||||
} else if (_code === 'AltRight') {
|
||||
return _keysym["default"].XK_Meta_R;
|
||||
}
|
||||
} // macOS has Clear instead of NumLock, but the remote system is
|
||||
// probably not macOS, so lying here is probably best...
|
||||
|
||||
|
||||
if (key === 'Clear') {
|
||||
var _code2 = getKeycode(evt);
|
||||
|
||||
if (_code2 === 'NumLock') {
|
||||
return _keysym["default"].XK_Num_Lock;
|
||||
}
|
||||
} // Windows sends alternating symbols for some keys when using a
|
||||
// Japanese layout. We have no way of synchronising with the IM
|
||||
// running on the remote system, so we send some combined keysym
|
||||
// instead and hope for the best.
|
||||
|
||||
|
||||
if (browser.isWindows()) {
|
||||
switch (key) {
|
||||
case 'Zenkaku':
|
||||
case 'Hankaku':
|
||||
return _keysym["default"].XK_Zenkaku_Hankaku;
|
||||
|
||||
case 'Romaji':
|
||||
case 'KanaMode':
|
||||
return _keysym["default"].XK_Romaji;
|
||||
}
|
||||
}
|
||||
|
||||
return _domkeytable["default"][key][location];
|
||||
} // Now we need to look at the Unicode symbol instead
|
||||
// Special key? (FIXME: Should have been caught earlier)
|
||||
|
||||
|
||||
if (key.length !== 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var codepoint = key.charCodeAt();
|
||||
|
||||
if (codepoint) {
|
||||
return _keysymdef["default"].lookup(codepoint);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
125
public/novnc/lib/input/vkeys.js
Normal file
125
public/novnc/lib/input/vkeys.js
Normal file
@@ -0,0 +1,125 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2018 The noVNC Authors
|
||||
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Mapping between Microsoft® Windows® Virtual-Key codes and
|
||||
* HTML key codes.
|
||||
*/
|
||||
var _default = {
|
||||
0x08: 'Backspace',
|
||||
0x09: 'Tab',
|
||||
0x0a: 'NumpadClear',
|
||||
0x0d: 'Enter',
|
||||
0x10: 'ShiftLeft',
|
||||
0x11: 'ControlLeft',
|
||||
0x12: 'AltLeft',
|
||||
0x13: 'Pause',
|
||||
0x14: 'CapsLock',
|
||||
0x15: 'Lang1',
|
||||
0x19: 'Lang2',
|
||||
0x1b: 'Escape',
|
||||
0x1c: 'Convert',
|
||||
0x1d: 'NonConvert',
|
||||
0x20: 'Space',
|
||||
0x21: 'PageUp',
|
||||
0x22: 'PageDown',
|
||||
0x23: 'End',
|
||||
0x24: 'Home',
|
||||
0x25: 'ArrowLeft',
|
||||
0x26: 'ArrowUp',
|
||||
0x27: 'ArrowRight',
|
||||
0x28: 'ArrowDown',
|
||||
0x29: 'Select',
|
||||
0x2c: 'PrintScreen',
|
||||
0x2d: 'Insert',
|
||||
0x2e: 'Delete',
|
||||
0x2f: 'Help',
|
||||
0x30: 'Digit0',
|
||||
0x31: 'Digit1',
|
||||
0x32: 'Digit2',
|
||||
0x33: 'Digit3',
|
||||
0x34: 'Digit4',
|
||||
0x35: 'Digit5',
|
||||
0x36: 'Digit6',
|
||||
0x37: 'Digit7',
|
||||
0x38: 'Digit8',
|
||||
0x39: 'Digit9',
|
||||
0x5b: 'MetaLeft',
|
||||
0x5c: 'MetaRight',
|
||||
0x5d: 'ContextMenu',
|
||||
0x5f: 'Sleep',
|
||||
0x60: 'Numpad0',
|
||||
0x61: 'Numpad1',
|
||||
0x62: 'Numpad2',
|
||||
0x63: 'Numpad3',
|
||||
0x64: 'Numpad4',
|
||||
0x65: 'Numpad5',
|
||||
0x66: 'Numpad6',
|
||||
0x67: 'Numpad7',
|
||||
0x68: 'Numpad8',
|
||||
0x69: 'Numpad9',
|
||||
0x6a: 'NumpadMultiply',
|
||||
0x6b: 'NumpadAdd',
|
||||
0x6c: 'NumpadDecimal',
|
||||
0x6d: 'NumpadSubtract',
|
||||
0x6e: 'NumpadDecimal',
|
||||
// Duplicate, because buggy on Windows
|
||||
0x6f: 'NumpadDivide',
|
||||
0x70: 'F1',
|
||||
0x71: 'F2',
|
||||
0x72: 'F3',
|
||||
0x73: 'F4',
|
||||
0x74: 'F5',
|
||||
0x75: 'F6',
|
||||
0x76: 'F7',
|
||||
0x77: 'F8',
|
||||
0x78: 'F9',
|
||||
0x79: 'F10',
|
||||
0x7a: 'F11',
|
||||
0x7b: 'F12',
|
||||
0x7c: 'F13',
|
||||
0x7d: 'F14',
|
||||
0x7e: 'F15',
|
||||
0x7f: 'F16',
|
||||
0x80: 'F17',
|
||||
0x81: 'F18',
|
||||
0x82: 'F19',
|
||||
0x83: 'F20',
|
||||
0x84: 'F21',
|
||||
0x85: 'F22',
|
||||
0x86: 'F23',
|
||||
0x87: 'F24',
|
||||
0x90: 'NumLock',
|
||||
0x91: 'ScrollLock',
|
||||
0xa6: 'BrowserBack',
|
||||
0xa7: 'BrowserForward',
|
||||
0xa8: 'BrowserRefresh',
|
||||
0xa9: 'BrowserStop',
|
||||
0xaa: 'BrowserSearch',
|
||||
0xab: 'BrowserFavorites',
|
||||
0xac: 'BrowserHome',
|
||||
0xad: 'AudioVolumeMute',
|
||||
0xae: 'AudioVolumeDown',
|
||||
0xaf: 'AudioVolumeUp',
|
||||
0xb0: 'MediaTrackNext',
|
||||
0xb1: 'MediaTrackPrevious',
|
||||
0xb2: 'MediaStop',
|
||||
0xb3: 'MediaPlayPause',
|
||||
0xb4: 'LaunchMail',
|
||||
0xb5: 'MediaSelect',
|
||||
0xb6: 'LaunchApp1',
|
||||
0xb7: 'LaunchApp2',
|
||||
0xe1: 'AltRight' // Only when it is AltGraph
|
||||
|
||||
};
|
||||
exports["default"] = _default;
|
||||
511
public/novnc/lib/input/xtscancodes.js
Normal file
511
public/novnc/lib/input/xtscancodes.js
Normal file
@@ -0,0 +1,511 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
/*
|
||||
* This file is auto-generated from keymaps.csv
|
||||
* Database checksum sha256(76d68c10e97d37fe2ea459e210125ae41796253fb217e900bf2983ade13a7920)
|
||||
* To re-generate, run:
|
||||
* keymap-gen code-map --lang=js keymaps.csv html atset1
|
||||
*/
|
||||
var _default = {
|
||||
"Again": 0xe005,
|
||||
|
||||
/* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */
|
||||
"AltLeft": 0x38,
|
||||
|
||||
/* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */
|
||||
"AltRight": 0xe038,
|
||||
|
||||
/* html:AltRight (AltRight) -> linux:100 (KEY_RIGHTALT) -> atset1:57400 */
|
||||
"ArrowDown": 0xe050,
|
||||
|
||||
/* html:ArrowDown (ArrowDown) -> linux:108 (KEY_DOWN) -> atset1:57424 */
|
||||
"ArrowLeft": 0xe04b,
|
||||
|
||||
/* html:ArrowLeft (ArrowLeft) -> linux:105 (KEY_LEFT) -> atset1:57419 */
|
||||
"ArrowRight": 0xe04d,
|
||||
|
||||
/* html:ArrowRight (ArrowRight) -> linux:106 (KEY_RIGHT) -> atset1:57421 */
|
||||
"ArrowUp": 0xe048,
|
||||
|
||||
/* html:ArrowUp (ArrowUp) -> linux:103 (KEY_UP) -> atset1:57416 */
|
||||
"AudioVolumeDown": 0xe02e,
|
||||
|
||||
/* html:AudioVolumeDown (AudioVolumeDown) -> linux:114 (KEY_VOLUMEDOWN) -> atset1:57390 */
|
||||
"AudioVolumeMute": 0xe020,
|
||||
|
||||
/* html:AudioVolumeMute (AudioVolumeMute) -> linux:113 (KEY_MUTE) -> atset1:57376 */
|
||||
"AudioVolumeUp": 0xe030,
|
||||
|
||||
/* html:AudioVolumeUp (AudioVolumeUp) -> linux:115 (KEY_VOLUMEUP) -> atset1:57392 */
|
||||
"Backquote": 0x29,
|
||||
|
||||
/* html:Backquote (Backquote) -> linux:41 (KEY_GRAVE) -> atset1:41 */
|
||||
"Backslash": 0x2b,
|
||||
|
||||
/* html:Backslash (Backslash) -> linux:43 (KEY_BACKSLASH) -> atset1:43 */
|
||||
"Backspace": 0xe,
|
||||
|
||||
/* html:Backspace (Backspace) -> linux:14 (KEY_BACKSPACE) -> atset1:14 */
|
||||
"BracketLeft": 0x1a,
|
||||
|
||||
/* html:BracketLeft (BracketLeft) -> linux:26 (KEY_LEFTBRACE) -> atset1:26 */
|
||||
"BracketRight": 0x1b,
|
||||
|
||||
/* html:BracketRight (BracketRight) -> linux:27 (KEY_RIGHTBRACE) -> atset1:27 */
|
||||
"BrowserBack": 0xe06a,
|
||||
|
||||
/* html:BrowserBack (BrowserBack) -> linux:158 (KEY_BACK) -> atset1:57450 */
|
||||
"BrowserFavorites": 0xe066,
|
||||
|
||||
/* html:BrowserFavorites (BrowserFavorites) -> linux:156 (KEY_BOOKMARKS) -> atset1:57446 */
|
||||
"BrowserForward": 0xe069,
|
||||
|
||||
/* html:BrowserForward (BrowserForward) -> linux:159 (KEY_FORWARD) -> atset1:57449 */
|
||||
"BrowserHome": 0xe032,
|
||||
|
||||
/* html:BrowserHome (BrowserHome) -> linux:172 (KEY_HOMEPAGE) -> atset1:57394 */
|
||||
"BrowserRefresh": 0xe067,
|
||||
|
||||
/* html:BrowserRefresh (BrowserRefresh) -> linux:173 (KEY_REFRESH) -> atset1:57447 */
|
||||
"BrowserSearch": 0xe065,
|
||||
|
||||
/* html:BrowserSearch (BrowserSearch) -> linux:217 (KEY_SEARCH) -> atset1:57445 */
|
||||
"BrowserStop": 0xe068,
|
||||
|
||||
/* html:BrowserStop (BrowserStop) -> linux:128 (KEY_STOP) -> atset1:57448 */
|
||||
"CapsLock": 0x3a,
|
||||
|
||||
/* html:CapsLock (CapsLock) -> linux:58 (KEY_CAPSLOCK) -> atset1:58 */
|
||||
"Comma": 0x33,
|
||||
|
||||
/* html:Comma (Comma) -> linux:51 (KEY_COMMA) -> atset1:51 */
|
||||
"ContextMenu": 0xe05d,
|
||||
|
||||
/* html:ContextMenu (ContextMenu) -> linux:127 (KEY_COMPOSE) -> atset1:57437 */
|
||||
"ControlLeft": 0x1d,
|
||||
|
||||
/* html:ControlLeft (ControlLeft) -> linux:29 (KEY_LEFTCTRL) -> atset1:29 */
|
||||
"ControlRight": 0xe01d,
|
||||
|
||||
/* html:ControlRight (ControlRight) -> linux:97 (KEY_RIGHTCTRL) -> atset1:57373 */
|
||||
"Convert": 0x79,
|
||||
|
||||
/* html:Convert (Convert) -> linux:92 (KEY_HENKAN) -> atset1:121 */
|
||||
"Copy": 0xe078,
|
||||
|
||||
/* html:Copy (Copy) -> linux:133 (KEY_COPY) -> atset1:57464 */
|
||||
"Cut": 0xe03c,
|
||||
|
||||
/* html:Cut (Cut) -> linux:137 (KEY_CUT) -> atset1:57404 */
|
||||
"Delete": 0xe053,
|
||||
|
||||
/* html:Delete (Delete) -> linux:111 (KEY_DELETE) -> atset1:57427 */
|
||||
"Digit0": 0xb,
|
||||
|
||||
/* html:Digit0 (Digit0) -> linux:11 (KEY_0) -> atset1:11 */
|
||||
"Digit1": 0x2,
|
||||
|
||||
/* html:Digit1 (Digit1) -> linux:2 (KEY_1) -> atset1:2 */
|
||||
"Digit2": 0x3,
|
||||
|
||||
/* html:Digit2 (Digit2) -> linux:3 (KEY_2) -> atset1:3 */
|
||||
"Digit3": 0x4,
|
||||
|
||||
/* html:Digit3 (Digit3) -> linux:4 (KEY_3) -> atset1:4 */
|
||||
"Digit4": 0x5,
|
||||
|
||||
/* html:Digit4 (Digit4) -> linux:5 (KEY_4) -> atset1:5 */
|
||||
"Digit5": 0x6,
|
||||
|
||||
/* html:Digit5 (Digit5) -> linux:6 (KEY_5) -> atset1:6 */
|
||||
"Digit6": 0x7,
|
||||
|
||||
/* html:Digit6 (Digit6) -> linux:7 (KEY_6) -> atset1:7 */
|
||||
"Digit7": 0x8,
|
||||
|
||||
/* html:Digit7 (Digit7) -> linux:8 (KEY_7) -> atset1:8 */
|
||||
"Digit8": 0x9,
|
||||
|
||||
/* html:Digit8 (Digit8) -> linux:9 (KEY_8) -> atset1:9 */
|
||||
"Digit9": 0xa,
|
||||
|
||||
/* html:Digit9 (Digit9) -> linux:10 (KEY_9) -> atset1:10 */
|
||||
"Eject": 0xe07d,
|
||||
|
||||
/* html:Eject (Eject) -> linux:162 (KEY_EJECTCLOSECD) -> atset1:57469 */
|
||||
"End": 0xe04f,
|
||||
|
||||
/* html:End (End) -> linux:107 (KEY_END) -> atset1:57423 */
|
||||
"Enter": 0x1c,
|
||||
|
||||
/* html:Enter (Enter) -> linux:28 (KEY_ENTER) -> atset1:28 */
|
||||
"Equal": 0xd,
|
||||
|
||||
/* html:Equal (Equal) -> linux:13 (KEY_EQUAL) -> atset1:13 */
|
||||
"Escape": 0x1,
|
||||
|
||||
/* html:Escape (Escape) -> linux:1 (KEY_ESC) -> atset1:1 */
|
||||
"F1": 0x3b,
|
||||
|
||||
/* html:F1 (F1) -> linux:59 (KEY_F1) -> atset1:59 */
|
||||
"F10": 0x44,
|
||||
|
||||
/* html:F10 (F10) -> linux:68 (KEY_F10) -> atset1:68 */
|
||||
"F11": 0x57,
|
||||
|
||||
/* html:F11 (F11) -> linux:87 (KEY_F11) -> atset1:87 */
|
||||
"F12": 0x58,
|
||||
|
||||
/* html:F12 (F12) -> linux:88 (KEY_F12) -> atset1:88 */
|
||||
"F13": 0x5d,
|
||||
|
||||
/* html:F13 (F13) -> linux:183 (KEY_F13) -> atset1:93 */
|
||||
"F14": 0x5e,
|
||||
|
||||
/* html:F14 (F14) -> linux:184 (KEY_F14) -> atset1:94 */
|
||||
"F15": 0x5f,
|
||||
|
||||
/* html:F15 (F15) -> linux:185 (KEY_F15) -> atset1:95 */
|
||||
"F16": 0x55,
|
||||
|
||||
/* html:F16 (F16) -> linux:186 (KEY_F16) -> atset1:85 */
|
||||
"F17": 0xe003,
|
||||
|
||||
/* html:F17 (F17) -> linux:187 (KEY_F17) -> atset1:57347 */
|
||||
"F18": 0xe077,
|
||||
|
||||
/* html:F18 (F18) -> linux:188 (KEY_F18) -> atset1:57463 */
|
||||
"F19": 0xe004,
|
||||
|
||||
/* html:F19 (F19) -> linux:189 (KEY_F19) -> atset1:57348 */
|
||||
"F2": 0x3c,
|
||||
|
||||
/* html:F2 (F2) -> linux:60 (KEY_F2) -> atset1:60 */
|
||||
"F20": 0x5a,
|
||||
|
||||
/* html:F20 (F20) -> linux:190 (KEY_F20) -> atset1:90 */
|
||||
"F21": 0x74,
|
||||
|
||||
/* html:F21 (F21) -> linux:191 (KEY_F21) -> atset1:116 */
|
||||
"F22": 0xe079,
|
||||
|
||||
/* html:F22 (F22) -> linux:192 (KEY_F22) -> atset1:57465 */
|
||||
"F23": 0x6d,
|
||||
|
||||
/* html:F23 (F23) -> linux:193 (KEY_F23) -> atset1:109 */
|
||||
"F24": 0x6f,
|
||||
|
||||
/* html:F24 (F24) -> linux:194 (KEY_F24) -> atset1:111 */
|
||||
"F3": 0x3d,
|
||||
|
||||
/* html:F3 (F3) -> linux:61 (KEY_F3) -> atset1:61 */
|
||||
"F4": 0x3e,
|
||||
|
||||
/* html:F4 (F4) -> linux:62 (KEY_F4) -> atset1:62 */
|
||||
"F5": 0x3f,
|
||||
|
||||
/* html:F5 (F5) -> linux:63 (KEY_F5) -> atset1:63 */
|
||||
"F6": 0x40,
|
||||
|
||||
/* html:F6 (F6) -> linux:64 (KEY_F6) -> atset1:64 */
|
||||
"F7": 0x41,
|
||||
|
||||
/* html:F7 (F7) -> linux:65 (KEY_F7) -> atset1:65 */
|
||||
"F8": 0x42,
|
||||
|
||||
/* html:F8 (F8) -> linux:66 (KEY_F8) -> atset1:66 */
|
||||
"F9": 0x43,
|
||||
|
||||
/* html:F9 (F9) -> linux:67 (KEY_F9) -> atset1:67 */
|
||||
"Find": 0xe041,
|
||||
|
||||
/* html:Find (Find) -> linux:136 (KEY_FIND) -> atset1:57409 */
|
||||
"Help": 0xe075,
|
||||
|
||||
/* html:Help (Help) -> linux:138 (KEY_HELP) -> atset1:57461 */
|
||||
"Hiragana": 0x77,
|
||||
|
||||
/* html:Hiragana (Lang4) -> linux:91 (KEY_HIRAGANA) -> atset1:119 */
|
||||
"Home": 0xe047,
|
||||
|
||||
/* html:Home (Home) -> linux:102 (KEY_HOME) -> atset1:57415 */
|
||||
"Insert": 0xe052,
|
||||
|
||||
/* html:Insert (Insert) -> linux:110 (KEY_INSERT) -> atset1:57426 */
|
||||
"IntlBackslash": 0x56,
|
||||
|
||||
/* html:IntlBackslash (IntlBackslash) -> linux:86 (KEY_102ND) -> atset1:86 */
|
||||
"IntlRo": 0x73,
|
||||
|
||||
/* html:IntlRo (IntlRo) -> linux:89 (KEY_RO) -> atset1:115 */
|
||||
"IntlYen": 0x7d,
|
||||
|
||||
/* html:IntlYen (IntlYen) -> linux:124 (KEY_YEN) -> atset1:125 */
|
||||
"KanaMode": 0x70,
|
||||
|
||||
/* html:KanaMode (KanaMode) -> linux:93 (KEY_KATAKANAHIRAGANA) -> atset1:112 */
|
||||
"Katakana": 0x78,
|
||||
|
||||
/* html:Katakana (Lang3) -> linux:90 (KEY_KATAKANA) -> atset1:120 */
|
||||
"KeyA": 0x1e,
|
||||
|
||||
/* html:KeyA (KeyA) -> linux:30 (KEY_A) -> atset1:30 */
|
||||
"KeyB": 0x30,
|
||||
|
||||
/* html:KeyB (KeyB) -> linux:48 (KEY_B) -> atset1:48 */
|
||||
"KeyC": 0x2e,
|
||||
|
||||
/* html:KeyC (KeyC) -> linux:46 (KEY_C) -> atset1:46 */
|
||||
"KeyD": 0x20,
|
||||
|
||||
/* html:KeyD (KeyD) -> linux:32 (KEY_D) -> atset1:32 */
|
||||
"KeyE": 0x12,
|
||||
|
||||
/* html:KeyE (KeyE) -> linux:18 (KEY_E) -> atset1:18 */
|
||||
"KeyF": 0x21,
|
||||
|
||||
/* html:KeyF (KeyF) -> linux:33 (KEY_F) -> atset1:33 */
|
||||
"KeyG": 0x22,
|
||||
|
||||
/* html:KeyG (KeyG) -> linux:34 (KEY_G) -> atset1:34 */
|
||||
"KeyH": 0x23,
|
||||
|
||||
/* html:KeyH (KeyH) -> linux:35 (KEY_H) -> atset1:35 */
|
||||
"KeyI": 0x17,
|
||||
|
||||
/* html:KeyI (KeyI) -> linux:23 (KEY_I) -> atset1:23 */
|
||||
"KeyJ": 0x24,
|
||||
|
||||
/* html:KeyJ (KeyJ) -> linux:36 (KEY_J) -> atset1:36 */
|
||||
"KeyK": 0x25,
|
||||
|
||||
/* html:KeyK (KeyK) -> linux:37 (KEY_K) -> atset1:37 */
|
||||
"KeyL": 0x26,
|
||||
|
||||
/* html:KeyL (KeyL) -> linux:38 (KEY_L) -> atset1:38 */
|
||||
"KeyM": 0x32,
|
||||
|
||||
/* html:KeyM (KeyM) -> linux:50 (KEY_M) -> atset1:50 */
|
||||
"KeyN": 0x31,
|
||||
|
||||
/* html:KeyN (KeyN) -> linux:49 (KEY_N) -> atset1:49 */
|
||||
"KeyO": 0x18,
|
||||
|
||||
/* html:KeyO (KeyO) -> linux:24 (KEY_O) -> atset1:24 */
|
||||
"KeyP": 0x19,
|
||||
|
||||
/* html:KeyP (KeyP) -> linux:25 (KEY_P) -> atset1:25 */
|
||||
"KeyQ": 0x10,
|
||||
|
||||
/* html:KeyQ (KeyQ) -> linux:16 (KEY_Q) -> atset1:16 */
|
||||
"KeyR": 0x13,
|
||||
|
||||
/* html:KeyR (KeyR) -> linux:19 (KEY_R) -> atset1:19 */
|
||||
"KeyS": 0x1f,
|
||||
|
||||
/* html:KeyS (KeyS) -> linux:31 (KEY_S) -> atset1:31 */
|
||||
"KeyT": 0x14,
|
||||
|
||||
/* html:KeyT (KeyT) -> linux:20 (KEY_T) -> atset1:20 */
|
||||
"KeyU": 0x16,
|
||||
|
||||
/* html:KeyU (KeyU) -> linux:22 (KEY_U) -> atset1:22 */
|
||||
"KeyV": 0x2f,
|
||||
|
||||
/* html:KeyV (KeyV) -> linux:47 (KEY_V) -> atset1:47 */
|
||||
"KeyW": 0x11,
|
||||
|
||||
/* html:KeyW (KeyW) -> linux:17 (KEY_W) -> atset1:17 */
|
||||
"KeyX": 0x2d,
|
||||
|
||||
/* html:KeyX (KeyX) -> linux:45 (KEY_X) -> atset1:45 */
|
||||
"KeyY": 0x15,
|
||||
|
||||
/* html:KeyY (KeyY) -> linux:21 (KEY_Y) -> atset1:21 */
|
||||
"KeyZ": 0x2c,
|
||||
|
||||
/* html:KeyZ (KeyZ) -> linux:44 (KEY_Z) -> atset1:44 */
|
||||
"Lang1": 0x72,
|
||||
|
||||
/* html:Lang1 (Lang1) -> linux:122 (KEY_HANGEUL) -> atset1:114 */
|
||||
"Lang2": 0x71,
|
||||
|
||||
/* html:Lang2 (Lang2) -> linux:123 (KEY_HANJA) -> atset1:113 */
|
||||
"Lang3": 0x78,
|
||||
|
||||
/* html:Lang3 (Lang3) -> linux:90 (KEY_KATAKANA) -> atset1:120 */
|
||||
"Lang4": 0x77,
|
||||
|
||||
/* html:Lang4 (Lang4) -> linux:91 (KEY_HIRAGANA) -> atset1:119 */
|
||||
"Lang5": 0x76,
|
||||
|
||||
/* html:Lang5 (Lang5) -> linux:85 (KEY_ZENKAKUHANKAKU) -> atset1:118 */
|
||||
"LaunchApp1": 0xe06b,
|
||||
|
||||
/* html:LaunchApp1 (LaunchApp1) -> linux:157 (KEY_COMPUTER) -> atset1:57451 */
|
||||
"LaunchApp2": 0xe021,
|
||||
|
||||
/* html:LaunchApp2 (LaunchApp2) -> linux:140 (KEY_CALC) -> atset1:57377 */
|
||||
"LaunchMail": 0xe06c,
|
||||
|
||||
/* html:LaunchMail (LaunchMail) -> linux:155 (KEY_MAIL) -> atset1:57452 */
|
||||
"MediaPlayPause": 0xe022,
|
||||
|
||||
/* html:MediaPlayPause (MediaPlayPause) -> linux:164 (KEY_PLAYPAUSE) -> atset1:57378 */
|
||||
"MediaSelect": 0xe06d,
|
||||
|
||||
/* html:MediaSelect (MediaSelect) -> linux:226 (KEY_MEDIA) -> atset1:57453 */
|
||||
"MediaStop": 0xe024,
|
||||
|
||||
/* html:MediaStop (MediaStop) -> linux:166 (KEY_STOPCD) -> atset1:57380 */
|
||||
"MediaTrackNext": 0xe019,
|
||||
|
||||
/* html:MediaTrackNext (MediaTrackNext) -> linux:163 (KEY_NEXTSONG) -> atset1:57369 */
|
||||
"MediaTrackPrevious": 0xe010,
|
||||
|
||||
/* html:MediaTrackPrevious (MediaTrackPrevious) -> linux:165 (KEY_PREVIOUSSONG) -> atset1:57360 */
|
||||
"MetaLeft": 0xe05b,
|
||||
|
||||
/* html:MetaLeft (MetaLeft) -> linux:125 (KEY_LEFTMETA) -> atset1:57435 */
|
||||
"MetaRight": 0xe05c,
|
||||
|
||||
/* html:MetaRight (MetaRight) -> linux:126 (KEY_RIGHTMETA) -> atset1:57436 */
|
||||
"Minus": 0xc,
|
||||
|
||||
/* html:Minus (Minus) -> linux:12 (KEY_MINUS) -> atset1:12 */
|
||||
"NonConvert": 0x7b,
|
||||
|
||||
/* html:NonConvert (NonConvert) -> linux:94 (KEY_MUHENKAN) -> atset1:123 */
|
||||
"NumLock": 0x45,
|
||||
|
||||
/* html:NumLock (NumLock) -> linux:69 (KEY_NUMLOCK) -> atset1:69 */
|
||||
"Numpad0": 0x52,
|
||||
|
||||
/* html:Numpad0 (Numpad0) -> linux:82 (KEY_KP0) -> atset1:82 */
|
||||
"Numpad1": 0x4f,
|
||||
|
||||
/* html:Numpad1 (Numpad1) -> linux:79 (KEY_KP1) -> atset1:79 */
|
||||
"Numpad2": 0x50,
|
||||
|
||||
/* html:Numpad2 (Numpad2) -> linux:80 (KEY_KP2) -> atset1:80 */
|
||||
"Numpad3": 0x51,
|
||||
|
||||
/* html:Numpad3 (Numpad3) -> linux:81 (KEY_KP3) -> atset1:81 */
|
||||
"Numpad4": 0x4b,
|
||||
|
||||
/* html:Numpad4 (Numpad4) -> linux:75 (KEY_KP4) -> atset1:75 */
|
||||
"Numpad5": 0x4c,
|
||||
|
||||
/* html:Numpad5 (Numpad5) -> linux:76 (KEY_KP5) -> atset1:76 */
|
||||
"Numpad6": 0x4d,
|
||||
|
||||
/* html:Numpad6 (Numpad6) -> linux:77 (KEY_KP6) -> atset1:77 */
|
||||
"Numpad7": 0x47,
|
||||
|
||||
/* html:Numpad7 (Numpad7) -> linux:71 (KEY_KP7) -> atset1:71 */
|
||||
"Numpad8": 0x48,
|
||||
|
||||
/* html:Numpad8 (Numpad8) -> linux:72 (KEY_KP8) -> atset1:72 */
|
||||
"Numpad9": 0x49,
|
||||
|
||||
/* html:Numpad9 (Numpad9) -> linux:73 (KEY_KP9) -> atset1:73 */
|
||||
"NumpadAdd": 0x4e,
|
||||
|
||||
/* html:NumpadAdd (NumpadAdd) -> linux:78 (KEY_KPPLUS) -> atset1:78 */
|
||||
"NumpadComma": 0x7e,
|
||||
|
||||
/* html:NumpadComma (NumpadComma) -> linux:121 (KEY_KPCOMMA) -> atset1:126 */
|
||||
"NumpadDecimal": 0x53,
|
||||
|
||||
/* html:NumpadDecimal (NumpadDecimal) -> linux:83 (KEY_KPDOT) -> atset1:83 */
|
||||
"NumpadDivide": 0xe035,
|
||||
|
||||
/* html:NumpadDivide (NumpadDivide) -> linux:98 (KEY_KPSLASH) -> atset1:57397 */
|
||||
"NumpadEnter": 0xe01c,
|
||||
|
||||
/* html:NumpadEnter (NumpadEnter) -> linux:96 (KEY_KPENTER) -> atset1:57372 */
|
||||
"NumpadEqual": 0x59,
|
||||
|
||||
/* html:NumpadEqual (NumpadEqual) -> linux:117 (KEY_KPEQUAL) -> atset1:89 */
|
||||
"NumpadMultiply": 0x37,
|
||||
|
||||
/* html:NumpadMultiply (NumpadMultiply) -> linux:55 (KEY_KPASTERISK) -> atset1:55 */
|
||||
"NumpadParenLeft": 0xe076,
|
||||
|
||||
/* html:NumpadParenLeft (NumpadParenLeft) -> linux:179 (KEY_KPLEFTPAREN) -> atset1:57462 */
|
||||
"NumpadParenRight": 0xe07b,
|
||||
|
||||
/* html:NumpadParenRight (NumpadParenRight) -> linux:180 (KEY_KPRIGHTPAREN) -> atset1:57467 */
|
||||
"NumpadSubtract": 0x4a,
|
||||
|
||||
/* html:NumpadSubtract (NumpadSubtract) -> linux:74 (KEY_KPMINUS) -> atset1:74 */
|
||||
"Open": 0x64,
|
||||
|
||||
/* html:Open (Open) -> linux:134 (KEY_OPEN) -> atset1:100 */
|
||||
"PageDown": 0xe051,
|
||||
|
||||
/* html:PageDown (PageDown) -> linux:109 (KEY_PAGEDOWN) -> atset1:57425 */
|
||||
"PageUp": 0xe049,
|
||||
|
||||
/* html:PageUp (PageUp) -> linux:104 (KEY_PAGEUP) -> atset1:57417 */
|
||||
"Paste": 0x65,
|
||||
|
||||
/* html:Paste (Paste) -> linux:135 (KEY_PASTE) -> atset1:101 */
|
||||
"Pause": 0xe046,
|
||||
|
||||
/* html:Pause (Pause) -> linux:119 (KEY_PAUSE) -> atset1:57414 */
|
||||
"Period": 0x34,
|
||||
|
||||
/* html:Period (Period) -> linux:52 (KEY_DOT) -> atset1:52 */
|
||||
"Power": 0xe05e,
|
||||
|
||||
/* html:Power (Power) -> linux:116 (KEY_POWER) -> atset1:57438 */
|
||||
"PrintScreen": 0x54,
|
||||
|
||||
/* html:PrintScreen (PrintScreen) -> linux:99 (KEY_SYSRQ) -> atset1:84 */
|
||||
"Props": 0xe006,
|
||||
|
||||
/* html:Props (Props) -> linux:130 (KEY_PROPS) -> atset1:57350 */
|
||||
"Quote": 0x28,
|
||||
|
||||
/* html:Quote (Quote) -> linux:40 (KEY_APOSTROPHE) -> atset1:40 */
|
||||
"ScrollLock": 0x46,
|
||||
|
||||
/* html:ScrollLock (ScrollLock) -> linux:70 (KEY_SCROLLLOCK) -> atset1:70 */
|
||||
"Semicolon": 0x27,
|
||||
|
||||
/* html:Semicolon (Semicolon) -> linux:39 (KEY_SEMICOLON) -> atset1:39 */
|
||||
"ShiftLeft": 0x2a,
|
||||
|
||||
/* html:ShiftLeft (ShiftLeft) -> linux:42 (KEY_LEFTSHIFT) -> atset1:42 */
|
||||
"ShiftRight": 0x36,
|
||||
|
||||
/* html:ShiftRight (ShiftRight) -> linux:54 (KEY_RIGHTSHIFT) -> atset1:54 */
|
||||
"Slash": 0x35,
|
||||
|
||||
/* html:Slash (Slash) -> linux:53 (KEY_SLASH) -> atset1:53 */
|
||||
"Sleep": 0xe05f,
|
||||
|
||||
/* html:Sleep (Sleep) -> linux:142 (KEY_SLEEP) -> atset1:57439 */
|
||||
"Space": 0x39,
|
||||
|
||||
/* html:Space (Space) -> linux:57 (KEY_SPACE) -> atset1:57 */
|
||||
"Suspend": 0xe025,
|
||||
|
||||
/* html:Suspend (Suspend) -> linux:205 (KEY_SUSPEND) -> atset1:57381 */
|
||||
"Tab": 0xf,
|
||||
|
||||
/* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */
|
||||
"Undo": 0xe007,
|
||||
|
||||
/* html:Undo (Undo) -> linux:131 (KEY_UNDO) -> atset1:57351 */
|
||||
"WakeUp": 0xe063
|
||||
/* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */
|
||||
|
||||
};
|
||||
exports["default"] = _default;
|
||||
1259
public/novnc/lib/ra2.js
Normal file
1259
public/novnc/lib/ra2.js
Normal file
File diff suppressed because one or more lines are too long
3806
public/novnc/lib/rfb.js
Normal file
3806
public/novnc/lib/rfb.js
Normal file
File diff suppressed because one or more lines are too long
113
public/novnc/lib/util/browser.js
Normal file
113
public/novnc/lib/util/browser.js
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.hasScrollbarGutter = exports.dragThreshold = void 0;
|
||||
exports.isFirefox = isFirefox;
|
||||
exports.isIOS = isIOS;
|
||||
exports.isMac = isMac;
|
||||
exports.isSafari = isSafari;
|
||||
exports.isTouchDevice = void 0;
|
||||
exports.isWindows = isWindows;
|
||||
exports.supportsCursorURIs = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("./logging.js"));
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*
|
||||
* Browser feature support detection
|
||||
*/
|
||||
// Touch detection
|
||||
var isTouchDevice = 'ontouchstart' in document.documentElement || // requried for Chrome debugger
|
||||
document.ontouchstart !== undefined || // required for MS Surface
|
||||
navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
||||
exports.isTouchDevice = isTouchDevice;
|
||||
window.addEventListener('touchstart', function onFirstTouch() {
|
||||
exports.isTouchDevice = isTouchDevice = true;
|
||||
window.removeEventListener('touchstart', onFirstTouch, false);
|
||||
}, false); // The goal is to find a certain physical width, the devicePixelRatio
|
||||
// brings us a bit closer but is not optimal.
|
||||
|
||||
var dragThreshold = 10 * (window.devicePixelRatio || 1);
|
||||
exports.dragThreshold = dragThreshold;
|
||||
var _supportsCursorURIs = false;
|
||||
|
||||
try {
|
||||
var target = document.createElement('canvas');
|
||||
target.style.cursor = 'url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default';
|
||||
|
||||
if (target.style.cursor.indexOf("url") === 0) {
|
||||
Log.Info("Data URI scheme cursor supported");
|
||||
_supportsCursorURIs = true;
|
||||
} else {
|
||||
Log.Warn("Data URI scheme cursor not supported");
|
||||
}
|
||||
} catch (exc) {
|
||||
Log.Error("Data URI scheme cursor test exception: " + exc);
|
||||
}
|
||||
|
||||
var supportsCursorURIs = _supportsCursorURIs;
|
||||
exports.supportsCursorURIs = supportsCursorURIs;
|
||||
var _hasScrollbarGutter = true;
|
||||
|
||||
try {
|
||||
// Create invisible container
|
||||
var container = document.createElement('div');
|
||||
container.style.visibility = 'hidden';
|
||||
container.style.overflow = 'scroll'; // forcing scrollbars
|
||||
|
||||
document.body.appendChild(container); // Create a div and place it in the container
|
||||
|
||||
var child = document.createElement('div');
|
||||
container.appendChild(child); // Calculate the difference between the container's full width
|
||||
// and the child's width - the difference is the scrollbars
|
||||
|
||||
var scrollbarWidth = container.offsetWidth - child.offsetWidth; // Clean up
|
||||
|
||||
container.parentNode.removeChild(container);
|
||||
_hasScrollbarGutter = scrollbarWidth != 0;
|
||||
} catch (exc) {
|
||||
Log.Error("Scrollbar test exception: " + exc);
|
||||
}
|
||||
|
||||
var hasScrollbarGutter = _hasScrollbarGutter;
|
||||
/*
|
||||
* The functions for detection of platforms and browsers below are exported
|
||||
* but the use of these should be minimized as much as possible.
|
||||
*
|
||||
* It's better to use feature detection than platform detection.
|
||||
*/
|
||||
|
||||
exports.hasScrollbarGutter = hasScrollbarGutter;
|
||||
|
||||
function isMac() {
|
||||
return navigator && !!/mac/i.exec(navigator.platform);
|
||||
}
|
||||
|
||||
function isWindows() {
|
||||
return navigator && !!/win/i.exec(navigator.platform);
|
||||
}
|
||||
|
||||
function isIOS() {
|
||||
return navigator && (!!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform));
|
||||
}
|
||||
|
||||
function isSafari() {
|
||||
return navigator && navigator.userAgent.indexOf('Safari') !== -1 && navigator.userAgent.indexOf('Chrome') === -1;
|
||||
}
|
||||
|
||||
function isFirefox() {
|
||||
return navigator && !!/firefox/i.exec(navigator.userAgent);
|
||||
}
|
||||
302
public/novnc/lib/util/cursor.js
Normal file
302
public/novnc/lib/util/cursor.js
Normal file
@@ -0,0 +1,302 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _browser = require("./browser.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
var useFallback = !_browser.supportsCursorURIs || _browser.isTouchDevice;
|
||||
|
||||
var Cursor = /*#__PURE__*/function () {
|
||||
function Cursor() {
|
||||
_classCallCheck(this, Cursor);
|
||||
|
||||
this._target = null;
|
||||
this._canvas = document.createElement('canvas');
|
||||
|
||||
if (useFallback) {
|
||||
this._canvas.style.position = 'fixed';
|
||||
this._canvas.style.zIndex = '65535';
|
||||
this._canvas.style.pointerEvents = 'none'; // Can't use "display" because of Firefox bug #1445997
|
||||
|
||||
this._canvas.style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
this._position = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
this._hotSpot = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
this._eventHandlers = {
|
||||
'mouseover': this._handleMouseOver.bind(this),
|
||||
'mouseleave': this._handleMouseLeave.bind(this),
|
||||
'mousemove': this._handleMouseMove.bind(this),
|
||||
'mouseup': this._handleMouseUp.bind(this)
|
||||
};
|
||||
}
|
||||
|
||||
_createClass(Cursor, [{
|
||||
key: "attach",
|
||||
value: function attach(target) {
|
||||
if (this._target) {
|
||||
this.detach();
|
||||
}
|
||||
|
||||
this._target = target;
|
||||
|
||||
if (useFallback) {
|
||||
document.body.appendChild(this._canvas);
|
||||
var options = {
|
||||
capture: true,
|
||||
passive: true
|
||||
};
|
||||
|
||||
this._target.addEventListener('mouseover', this._eventHandlers.mouseover, options);
|
||||
|
||||
this._target.addEventListener('mouseleave', this._eventHandlers.mouseleave, options);
|
||||
|
||||
this._target.addEventListener('mousemove', this._eventHandlers.mousemove, options);
|
||||
|
||||
this._target.addEventListener('mouseup', this._eventHandlers.mouseup, options);
|
||||
}
|
||||
|
||||
this.clear();
|
||||
}
|
||||
}, {
|
||||
key: "detach",
|
||||
value: function detach() {
|
||||
if (!this._target) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (useFallback) {
|
||||
var options = {
|
||||
capture: true,
|
||||
passive: true
|
||||
};
|
||||
|
||||
this._target.removeEventListener('mouseover', this._eventHandlers.mouseover, options);
|
||||
|
||||
this._target.removeEventListener('mouseleave', this._eventHandlers.mouseleave, options);
|
||||
|
||||
this._target.removeEventListener('mousemove', this._eventHandlers.mousemove, options);
|
||||
|
||||
this._target.removeEventListener('mouseup', this._eventHandlers.mouseup, options);
|
||||
|
||||
document.body.removeChild(this._canvas);
|
||||
}
|
||||
|
||||
this._target = null;
|
||||
}
|
||||
}, {
|
||||
key: "change",
|
||||
value: function change(rgba, hotx, hoty, w, h) {
|
||||
if (w === 0 || h === 0) {
|
||||
this.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
this._position.x = this._position.x + this._hotSpot.x - hotx;
|
||||
this._position.y = this._position.y + this._hotSpot.y - hoty;
|
||||
this._hotSpot.x = hotx;
|
||||
this._hotSpot.y = hoty;
|
||||
|
||||
var ctx = this._canvas.getContext('2d');
|
||||
|
||||
this._canvas.width = w;
|
||||
this._canvas.height = h;
|
||||
var img = new ImageData(new Uint8ClampedArray(rgba), w, h);
|
||||
ctx.clearRect(0, 0, w, h);
|
||||
ctx.putImageData(img, 0, 0);
|
||||
|
||||
if (useFallback) {
|
||||
this._updatePosition();
|
||||
} else {
|
||||
var url = this._canvas.toDataURL();
|
||||
|
||||
this._target.style.cursor = 'url(' + url + ')' + hotx + ' ' + hoty + ', default';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clear",
|
||||
value: function clear() {
|
||||
this._target.style.cursor = 'none';
|
||||
this._canvas.width = 0;
|
||||
this._canvas.height = 0;
|
||||
this._position.x = this._position.x + this._hotSpot.x;
|
||||
this._position.y = this._position.y + this._hotSpot.y;
|
||||
this._hotSpot.x = 0;
|
||||
this._hotSpot.y = 0;
|
||||
} // Mouse events might be emulated, this allows
|
||||
// moving the cursor in such cases
|
||||
|
||||
}, {
|
||||
key: "move",
|
||||
value: function move(clientX, clientY) {
|
||||
if (!useFallback) {
|
||||
return;
|
||||
} // clientX/clientY are relative the _visual viewport_,
|
||||
// but our position is relative the _layout viewport_,
|
||||
// so try to compensate when we can
|
||||
|
||||
|
||||
if (window.visualViewport) {
|
||||
this._position.x = clientX + window.visualViewport.offsetLeft;
|
||||
this._position.y = clientY + window.visualViewport.offsetTop;
|
||||
} else {
|
||||
this._position.x = clientX;
|
||||
this._position.y = clientY;
|
||||
}
|
||||
|
||||
this._updatePosition();
|
||||
|
||||
var target = document.elementFromPoint(clientX, clientY);
|
||||
|
||||
this._updateVisibility(target);
|
||||
}
|
||||
}, {
|
||||
key: "_handleMouseOver",
|
||||
value: function _handleMouseOver(event) {
|
||||
// This event could be because we're entering the target, or
|
||||
// moving around amongst its sub elements. Let the move handler
|
||||
// sort things out.
|
||||
this._handleMouseMove(event);
|
||||
}
|
||||
}, {
|
||||
key: "_handleMouseLeave",
|
||||
value: function _handleMouseLeave(event) {
|
||||
// Check if we should show the cursor on the element we are leaving to
|
||||
this._updateVisibility(event.relatedTarget);
|
||||
}
|
||||
}, {
|
||||
key: "_handleMouseMove",
|
||||
value: function _handleMouseMove(event) {
|
||||
this._updateVisibility(event.target);
|
||||
|
||||
this._position.x = event.clientX - this._hotSpot.x;
|
||||
this._position.y = event.clientY - this._hotSpot.y;
|
||||
|
||||
this._updatePosition();
|
||||
}
|
||||
}, {
|
||||
key: "_handleMouseUp",
|
||||
value: function _handleMouseUp(event) {
|
||||
var _this = this;
|
||||
|
||||
// We might get this event because of a drag operation that
|
||||
// moved outside of the target. Check what's under the cursor
|
||||
// now and adjust visibility based on that.
|
||||
var target = document.elementFromPoint(event.clientX, event.clientY);
|
||||
|
||||
this._updateVisibility(target); // Captures end with a mouseup but we can't know the event order of
|
||||
// mouseup vs releaseCapture.
|
||||
//
|
||||
// In the cases when releaseCapture comes first, the code above is
|
||||
// enough.
|
||||
//
|
||||
// In the cases when the mouseup comes first, we need wait for the
|
||||
// browser to flush all events and then check again if the cursor
|
||||
// should be visible.
|
||||
|
||||
|
||||
if (this._captureIsActive()) {
|
||||
window.setTimeout(function () {
|
||||
// We might have detached at this point
|
||||
if (!_this._target) {
|
||||
return;
|
||||
} // Refresh the target from elementFromPoint since queued events
|
||||
// might have altered the DOM
|
||||
|
||||
|
||||
target = document.elementFromPoint(event.clientX, event.clientY);
|
||||
|
||||
_this._updateVisibility(target);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_showCursor",
|
||||
value: function _showCursor() {
|
||||
if (this._canvas.style.visibility === 'hidden') {
|
||||
this._canvas.style.visibility = '';
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_hideCursor",
|
||||
value: function _hideCursor() {
|
||||
if (this._canvas.style.visibility !== 'hidden') {
|
||||
this._canvas.style.visibility = 'hidden';
|
||||
}
|
||||
} // Should we currently display the cursor?
|
||||
// (i.e. are we over the target, or a child of the target without a
|
||||
// different cursor set)
|
||||
|
||||
}, {
|
||||
key: "_shouldShowCursor",
|
||||
value: function _shouldShowCursor(target) {
|
||||
if (!target) {
|
||||
return false;
|
||||
} // Easy case
|
||||
|
||||
|
||||
if (target === this._target) {
|
||||
return true;
|
||||
} // Other part of the DOM?
|
||||
|
||||
|
||||
if (!this._target.contains(target)) {
|
||||
return false;
|
||||
} // Has the child its own cursor?
|
||||
// FIXME: How can we tell that a sub element has an
|
||||
// explicit "cursor: none;"?
|
||||
|
||||
|
||||
if (window.getComputedStyle(target).cursor !== 'none') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_updateVisibility",
|
||||
value: function _updateVisibility(target) {
|
||||
// When the cursor target has capture we want to show the cursor.
|
||||
// So, if a capture is active - look at the captured element instead.
|
||||
if (this._captureIsActive()) {
|
||||
target = document.captureElement;
|
||||
}
|
||||
|
||||
if (this._shouldShowCursor(target)) {
|
||||
this._showCursor();
|
||||
} else {
|
||||
this._hideCursor();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_updatePosition",
|
||||
value: function _updatePosition() {
|
||||
this._canvas.style.left = this._position.x + "px";
|
||||
this._canvas.style.top = this._position.y + "px";
|
||||
}
|
||||
}, {
|
||||
key: "_captureIsActive",
|
||||
value: function _captureIsActive() {
|
||||
return document.captureElement && document.documentElement.contains(document.captureElement);
|
||||
}
|
||||
}]);
|
||||
|
||||
return Cursor;
|
||||
}();
|
||||
|
||||
exports["default"] = Cursor;
|
||||
43
public/novnc/lib/util/element.js
Normal file
43
public/novnc/lib/util/element.js
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.clientToElement = clientToElement;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2020 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* HTML element utility functions
|
||||
*/
|
||||
function clientToElement(x, y, elem) {
|
||||
var bounds = elem.getBoundingClientRect();
|
||||
var pos = {
|
||||
x: 0,
|
||||
y: 0
|
||||
}; // Clip to target bounds
|
||||
|
||||
if (x < bounds.left) {
|
||||
pos.x = 0;
|
||||
} else if (x >= bounds.right) {
|
||||
pos.x = bounds.width - 1;
|
||||
} else {
|
||||
pos.x = x - bounds.left;
|
||||
}
|
||||
|
||||
if (y < bounds.top) {
|
||||
pos.y = 0;
|
||||
} else if (y >= bounds.bottom) {
|
||||
pos.y = bounds.height - 1;
|
||||
} else {
|
||||
pos.y = y - bounds.top;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
140
public/novnc/lib/util/events.js
Normal file
140
public/novnc/lib/util/events.js
Normal file
@@ -0,0 +1,140 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getPointerEvent = getPointerEvent;
|
||||
exports.releaseCapture = releaseCapture;
|
||||
exports.setCapture = setCapture;
|
||||
exports.stopEvent = stopEvent;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2018 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Cross-browser event and position routines
|
||||
*/
|
||||
function getPointerEvent(e) {
|
||||
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
|
||||
}
|
||||
|
||||
function stopEvent(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
} // Emulate Element.setCapture() when not supported
|
||||
|
||||
|
||||
var _captureRecursion = false;
|
||||
var _elementForUnflushedEvents = null;
|
||||
document.captureElement = null;
|
||||
|
||||
function _captureProxy(e) {
|
||||
// Recursion protection as we'll see our own event
|
||||
if (_captureRecursion) return; // Clone the event as we cannot dispatch an already dispatched event
|
||||
|
||||
var newEv = new e.constructor(e.type, e);
|
||||
_captureRecursion = true;
|
||||
|
||||
if (document.captureElement) {
|
||||
document.captureElement.dispatchEvent(newEv);
|
||||
} else {
|
||||
_elementForUnflushedEvents.dispatchEvent(newEv);
|
||||
}
|
||||
|
||||
_captureRecursion = false; // Avoid double events
|
||||
|
||||
e.stopPropagation(); // Respect the wishes of the redirected event handlers
|
||||
|
||||
if (newEv.defaultPrevented) {
|
||||
e.preventDefault();
|
||||
} // Implicitly release the capture on button release
|
||||
|
||||
|
||||
if (e.type === "mouseup") {
|
||||
releaseCapture();
|
||||
}
|
||||
} // Follow cursor style of target element
|
||||
|
||||
|
||||
function _capturedElemChanged() {
|
||||
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
|
||||
proxyElem.style.cursor = window.getComputedStyle(document.captureElement).cursor;
|
||||
}
|
||||
|
||||
var _captureObserver = new MutationObserver(_capturedElemChanged);
|
||||
|
||||
function setCapture(target) {
|
||||
if (target.setCapture) {
|
||||
target.setCapture();
|
||||
document.captureElement = target;
|
||||
} else {
|
||||
// Release any existing capture in case this method is
|
||||
// called multiple times without coordination
|
||||
releaseCapture();
|
||||
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
|
||||
|
||||
if (proxyElem === null) {
|
||||
proxyElem = document.createElement("div");
|
||||
proxyElem.id = "noVNC_mouse_capture_elem";
|
||||
proxyElem.style.position = "fixed";
|
||||
proxyElem.style.top = "0px";
|
||||
proxyElem.style.left = "0px";
|
||||
proxyElem.style.width = "100%";
|
||||
proxyElem.style.height = "100%";
|
||||
proxyElem.style.zIndex = 10000;
|
||||
proxyElem.style.display = "none";
|
||||
document.body.appendChild(proxyElem); // This is to make sure callers don't get confused by having
|
||||
// our blocking element as the target
|
||||
|
||||
proxyElem.addEventListener('contextmenu', _captureProxy);
|
||||
proxyElem.addEventListener('mousemove', _captureProxy);
|
||||
proxyElem.addEventListener('mouseup', _captureProxy);
|
||||
}
|
||||
|
||||
document.captureElement = target; // Track cursor and get initial cursor
|
||||
|
||||
_captureObserver.observe(target, {
|
||||
attributes: true
|
||||
});
|
||||
|
||||
_capturedElemChanged();
|
||||
|
||||
proxyElem.style.display = ""; // We listen to events on window in order to keep tracking if it
|
||||
// happens to leave the viewport
|
||||
|
||||
window.addEventListener('mousemove', _captureProxy);
|
||||
window.addEventListener('mouseup', _captureProxy);
|
||||
}
|
||||
}
|
||||
|
||||
function releaseCapture() {
|
||||
if (document.releaseCapture) {
|
||||
document.releaseCapture();
|
||||
document.captureElement = null;
|
||||
} else {
|
||||
if (!document.captureElement) {
|
||||
return;
|
||||
} // There might be events already queued. The event proxy needs
|
||||
// access to the captured element for these queued events.
|
||||
// E.g. contextmenu (right-click) in Microsoft Edge
|
||||
//
|
||||
// Before removing the capturedElem pointer we save it to a
|
||||
// temporary variable that the unflushed events can use.
|
||||
|
||||
|
||||
_elementForUnflushedEvents = document.captureElement;
|
||||
document.captureElement = null;
|
||||
|
||||
_captureObserver.disconnect();
|
||||
|
||||
var proxyElem = document.getElementById("noVNC_mouse_capture_elem");
|
||||
proxyElem.style.display = "none";
|
||||
window.removeEventListener('mousemove', _captureProxy);
|
||||
window.removeEventListener('mouseup', _captureProxy);
|
||||
}
|
||||
}
|
||||
64
public/novnc/lib/util/eventtarget.js
Normal file
64
public/novnc/lib/util/eventtarget.js
Normal file
@@ -0,0 +1,64 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
var EventTargetMixin = /*#__PURE__*/function () {
|
||||
function EventTargetMixin() {
|
||||
_classCallCheck(this, EventTargetMixin);
|
||||
|
||||
this._listeners = new Map();
|
||||
}
|
||||
|
||||
_createClass(EventTargetMixin, [{
|
||||
key: "addEventListener",
|
||||
value: function addEventListener(type, callback) {
|
||||
if (!this._listeners.has(type)) {
|
||||
this._listeners.set(type, new Set());
|
||||
}
|
||||
|
||||
this._listeners.get(type).add(callback);
|
||||
}
|
||||
}, {
|
||||
key: "removeEventListener",
|
||||
value: function removeEventListener(type, callback) {
|
||||
if (this._listeners.has(type)) {
|
||||
this._listeners.get(type)["delete"](callback);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "dispatchEvent",
|
||||
value: function dispatchEvent(event) {
|
||||
var _this = this;
|
||||
|
||||
if (!this._listeners.has(event.type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
this._listeners.get(event.type).forEach(function (callback) {
|
||||
return callback.call(_this, event);
|
||||
});
|
||||
|
||||
return !event.defaultPrevented;
|
||||
}
|
||||
}]);
|
||||
|
||||
return EventTargetMixin;
|
||||
}();
|
||||
|
||||
exports["default"] = EventTargetMixin;
|
||||
22
public/novnc/lib/util/int.js
Normal file
22
public/novnc/lib/util/int.js
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.toSigned32bit = toSigned32bit;
|
||||
exports.toUnsigned32bit = toUnsigned32bit;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2020 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
function toUnsigned32bit(toConvert) {
|
||||
return toConvert >>> 0;
|
||||
}
|
||||
|
||||
function toSigned32bit(toConvert) {
|
||||
return toConvert | 0;
|
||||
}
|
||||
79
public/novnc/lib/util/logging.js
Normal file
79
public/novnc/lib/util/logging.js
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.Warn = exports.Info = exports.Error = exports.Debug = void 0;
|
||||
exports.getLogging = getLogging;
|
||||
exports.initLogging = initLogging;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Logging/debug routines
|
||||
*/
|
||||
var _logLevel = 'warn';
|
||||
|
||||
var Debug = function Debug() {};
|
||||
|
||||
exports.Debug = Debug;
|
||||
|
||||
var Info = function Info() {};
|
||||
|
||||
exports.Info = Info;
|
||||
|
||||
var Warn = function Warn() {};
|
||||
|
||||
exports.Warn = Warn;
|
||||
|
||||
var Error = function Error() {};
|
||||
|
||||
exports.Error = Error;
|
||||
|
||||
function initLogging(level) {
|
||||
if (typeof level === 'undefined') {
|
||||
level = _logLevel;
|
||||
} else {
|
||||
_logLevel = level;
|
||||
}
|
||||
|
||||
exports.Debug = Debug = exports.Info = Info = exports.Warn = Warn = exports.Error = Error = function Error() {};
|
||||
|
||||
if (typeof window.console !== "undefined") {
|
||||
/* eslint-disable no-console, no-fallthrough */
|
||||
switch (level) {
|
||||
case 'debug':
|
||||
exports.Debug = Debug = console.debug.bind(window.console);
|
||||
|
||||
case 'info':
|
||||
exports.Info = Info = console.info.bind(window.console);
|
||||
|
||||
case 'warn':
|
||||
exports.Warn = Warn = console.warn.bind(window.console);
|
||||
|
||||
case 'error':
|
||||
exports.Error = Error = console.error.bind(window.console);
|
||||
|
||||
case 'none':
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new window.Error("invalid logging type '" + level + "'");
|
||||
}
|
||||
/* eslint-enable no-console, no-fallthrough */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getLogging() {
|
||||
return _logLevel;
|
||||
}
|
||||
|
||||
// Initialize logging level
|
||||
initLogging();
|
||||
103
public/novnc/lib/util/md5.js
Normal file
103
public/novnc/lib/util/md5.js
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MD5 = MD5;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2021 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Performs MD5 hashing on a string of binary characters, returns an array of bytes
|
||||
*/
|
||||
function MD5(d) {
|
||||
var r = M(V(Y(X(d), 8 * d.length)));
|
||||
return r;
|
||||
}
|
||||
|
||||
function M(d) {
|
||||
var f = new Uint8Array(d.length);
|
||||
|
||||
for (var i = 0; i < d.length; i++) {
|
||||
f[i] = d.charCodeAt(i);
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
function X(d) {
|
||||
var r = Array(d.length >> 2);
|
||||
|
||||
for (var m = 0; m < r.length; m++) {
|
||||
r[m] = 0;
|
||||
}
|
||||
|
||||
for (var _m = 0; _m < 8 * d.length; _m += 8) {
|
||||
r[_m >> 5] |= (255 & d.charCodeAt(_m / 8)) << _m % 32;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
function V(d) {
|
||||
var r = "";
|
||||
|
||||
for (var m = 0; m < 32 * d.length; m += 8) {
|
||||
r += String.fromCharCode(d[m >> 5] >>> m % 32 & 255);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
function Y(d, g) {
|
||||
d[g >> 5] |= 128 << g % 32, d[14 + (g + 64 >>> 9 << 4)] = g;
|
||||
var m = 1732584193,
|
||||
f = -271733879,
|
||||
r = -1732584194,
|
||||
i = 271733878;
|
||||
|
||||
for (var n = 0; n < d.length; n += 16) {
|
||||
var h = m,
|
||||
t = f,
|
||||
_g = r,
|
||||
e = i;
|
||||
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);
|
||||
}
|
||||
|
||||
return Array(m, f, r, i);
|
||||
}
|
||||
|
||||
function cmn(d, g, m, f, r, i) {
|
||||
return add(rol(add(add(g, d), add(f, i)), r), m);
|
||||
}
|
||||
|
||||
function ff(d, g, m, f, r, i, n) {
|
||||
return cmn(g & m | ~g & f, d, g, r, i, n);
|
||||
}
|
||||
|
||||
function gg(d, g, m, f, r, i, n) {
|
||||
return cmn(g & f | m & ~f, d, g, r, i, n);
|
||||
}
|
||||
|
||||
function hh(d, g, m, f, r, i, n) {
|
||||
return cmn(g ^ m ^ f, d, g, r, i, n);
|
||||
}
|
||||
|
||||
function ii(d, g, m, f, r, i, n) {
|
||||
return cmn(m ^ (g | ~f), d, g, r, i, n);
|
||||
}
|
||||
|
||||
function add(d, g) {
|
||||
var m = (65535 & d) + (65535 & g);
|
||||
return (d >> 16) + (g >> 16) + (m >> 16) << 16 | 65535 & m;
|
||||
}
|
||||
|
||||
function rol(d, g) {
|
||||
return d << g | d >>> 32 - g;
|
||||
}
|
||||
38
public/novnc/lib/util/strings.js
Normal file
38
public/novnc/lib/util/strings.js
Normal file
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.decodeUTF8 = decodeUTF8;
|
||||
exports.encodeUTF8 = encodeUTF8;
|
||||
|
||||
/*
|
||||
* noVNC: HTML5 VNC client
|
||||
* Copyright (C) 2019 The noVNC Authors
|
||||
* Licensed under MPL 2.0 (see LICENSE.txt)
|
||||
*
|
||||
* See README.md for usage and integration instructions.
|
||||
*/
|
||||
// Decode from UTF-8
|
||||
function decodeUTF8(utf8string) {
|
||||
var allowLatin1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
||||
|
||||
try {
|
||||
return decodeURIComponent(escape(utf8string));
|
||||
} catch (e) {
|
||||
if (e instanceof URIError) {
|
||||
if (allowLatin1) {
|
||||
// If we allow Latin1 we can ignore any decoding fails
|
||||
// and in these cases return the original string
|
||||
return utf8string;
|
||||
}
|
||||
}
|
||||
|
||||
throw e;
|
||||
}
|
||||
} // Encode to UTF-8
|
||||
|
||||
|
||||
function encodeUTF8(DOMString) {
|
||||
return unescape(encodeURIComponent(DOMString));
|
||||
}
|
||||
435
public/novnc/lib/websock.js
Normal file
435
public/novnc/lib/websock.js
Normal file
@@ -0,0 +1,435 @@
|
||||
"use strict";
|
||||
|
||||
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); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var Log = _interopRequireWildcard(require("./util/logging.js"));
|
||||
|
||||
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); }
|
||||
|
||||
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; }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
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); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
|
||||
// this has performance issues in some versions Chromium, and
|
||||
// doesn't gain a tremendous amount of performance increase in Firefox
|
||||
// at the moment. It may be valuable to turn it on in the future.
|
||||
var MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
|
||||
// Constants pulled from RTCDataChannelState enum
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/RTCDataChannel/readyState#RTCDataChannelState_enum
|
||||
|
||||
var DataChannel = {
|
||||
CONNECTING: "connecting",
|
||||
OPEN: "open",
|
||||
CLOSING: "closing",
|
||||
CLOSED: "closed"
|
||||
};
|
||||
var ReadyStates = {
|
||||
CONNECTING: [WebSocket.CONNECTING, DataChannel.CONNECTING],
|
||||
OPEN: [WebSocket.OPEN, DataChannel.OPEN],
|
||||
CLOSING: [WebSocket.CLOSING, DataChannel.CLOSING],
|
||||
CLOSED: [WebSocket.CLOSED, DataChannel.CLOSED]
|
||||
}; // Properties a raw channel must have, WebSocket and RTCDataChannel are two examples
|
||||
|
||||
var rawChannelProps = ["send", "close", "binaryType", "onerror", "onmessage", "onopen", "protocol", "readyState"];
|
||||
|
||||
var Websock = /*#__PURE__*/function () {
|
||||
function Websock() {
|
||||
_classCallCheck(this, Websock);
|
||||
|
||||
this._websocket = null; // WebSocket or RTCDataChannel object
|
||||
|
||||
this._rQi = 0; // Receive queue index
|
||||
|
||||
this._rQlen = 0; // Next write position in the receive queue
|
||||
|
||||
this._rQbufferSize = 1024 * 1024 * 4; // Receive queue buffer size (4 MiB)
|
||||
// called in init: this._rQ = new Uint8Array(this._rQbufferSize);
|
||||
|
||||
this._rQ = null; // Receive queue
|
||||
|
||||
this._sQbufferSize = 1024 * 10; // 10 KiB
|
||||
// called in init: this._sQ = new Uint8Array(this._sQbufferSize);
|
||||
|
||||
this._sQlen = 0;
|
||||
this._sQ = null; // Send queue
|
||||
|
||||
this._eventHandlers = {
|
||||
message: function message() {},
|
||||
open: function open() {},
|
||||
close: function close() {},
|
||||
error: function error() {}
|
||||
};
|
||||
} // Getters and Setters
|
||||
|
||||
|
||||
_createClass(Websock, [{
|
||||
key: "readyState",
|
||||
get: function get() {
|
||||
var subState;
|
||||
|
||||
if (this._websocket === null) {
|
||||
return "unused";
|
||||
}
|
||||
|
||||
subState = this._websocket.readyState;
|
||||
|
||||
if (ReadyStates.CONNECTING.includes(subState)) {
|
||||
return "connecting";
|
||||
} else if (ReadyStates.OPEN.includes(subState)) {
|
||||
return "open";
|
||||
} else if (ReadyStates.CLOSING.includes(subState)) {
|
||||
return "closing";
|
||||
} else if (ReadyStates.CLOSED.includes(subState)) {
|
||||
return "closed";
|
||||
}
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
}, {
|
||||
key: "sQ",
|
||||
get: function get() {
|
||||
return this._sQ;
|
||||
}
|
||||
}, {
|
||||
key: "rQ",
|
||||
get: function get() {
|
||||
return this._rQ;
|
||||
}
|
||||
}, {
|
||||
key: "rQi",
|
||||
get: function get() {
|
||||
return this._rQi;
|
||||
},
|
||||
set: function set(val) {
|
||||
this._rQi = val;
|
||||
} // Receive Queue
|
||||
|
||||
}, {
|
||||
key: "rQlen",
|
||||
get: function get() {
|
||||
return this._rQlen - this._rQi;
|
||||
}
|
||||
}, {
|
||||
key: "rQpeek8",
|
||||
value: function rQpeek8() {
|
||||
return this._rQ[this._rQi];
|
||||
}
|
||||
}, {
|
||||
key: "rQskipBytes",
|
||||
value: function rQskipBytes(bytes) {
|
||||
this._rQi += bytes;
|
||||
}
|
||||
}, {
|
||||
key: "rQshift8",
|
||||
value: function rQshift8() {
|
||||
return this._rQshift(1);
|
||||
}
|
||||
}, {
|
||||
key: "rQshift16",
|
||||
value: function rQshift16() {
|
||||
return this._rQshift(2);
|
||||
}
|
||||
}, {
|
||||
key: "rQshift32",
|
||||
value: function rQshift32() {
|
||||
return this._rQshift(4);
|
||||
} // TODO(directxman12): test performance with these vs a DataView
|
||||
|
||||
}, {
|
||||
key: "_rQshift",
|
||||
value: function _rQshift(bytes) {
|
||||
var res = 0;
|
||||
|
||||
for (var _byte = bytes - 1; _byte >= 0; _byte--) {
|
||||
res += this._rQ[this._rQi++] << _byte * 8;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}, {
|
||||
key: "rQshiftStr",
|
||||
value: function rQshiftStr(len) {
|
||||
if (typeof len === 'undefined') {
|
||||
len = this.rQlen;
|
||||
}
|
||||
|
||||
var str = ""; // Handle large arrays in steps to avoid long strings on the stack
|
||||
|
||||
for (var i = 0; i < len; i += 4096) {
|
||||
var part = this.rQshiftBytes(Math.min(4096, len - i));
|
||||
str += String.fromCharCode.apply(null, part);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
}, {
|
||||
key: "rQshiftBytes",
|
||||
value: function rQshiftBytes(len) {
|
||||
if (typeof len === 'undefined') {
|
||||
len = this.rQlen;
|
||||
}
|
||||
|
||||
this._rQi += len;
|
||||
return new Uint8Array(this._rQ.buffer, this._rQi - len, len);
|
||||
}
|
||||
}, {
|
||||
key: "rQshiftTo",
|
||||
value: function rQshiftTo(target, len) {
|
||||
if (len === undefined) {
|
||||
len = this.rQlen;
|
||||
} // TODO: make this just use set with views when using a ArrayBuffer to store the rQ
|
||||
|
||||
|
||||
target.set(new Uint8Array(this._rQ.buffer, this._rQi, len));
|
||||
this._rQi += len;
|
||||
}
|
||||
}, {
|
||||
key: "rQslice",
|
||||
value: function rQslice(start) {
|
||||
var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.rQlen;
|
||||
return new Uint8Array(this._rQ.buffer, this._rQi + start, end - start);
|
||||
} // Check to see if we must wait for 'num' bytes (default to FBU.bytes)
|
||||
// to be available in the receive queue. Return true if we need to
|
||||
// wait (and possibly print a debug message), otherwise false.
|
||||
|
||||
}, {
|
||||
key: "rQwait",
|
||||
value: function rQwait(msg, num, goback) {
|
||||
if (this.rQlen < num) {
|
||||
if (goback) {
|
||||
if (this._rQi < goback) {
|
||||
throw new Error("rQwait cannot backup " + goback + " bytes");
|
||||
}
|
||||
|
||||
this._rQi -= goback;
|
||||
}
|
||||
|
||||
return true; // true means need more data
|
||||
}
|
||||
|
||||
return false;
|
||||
} // Send Queue
|
||||
|
||||
}, {
|
||||
key: "flush",
|
||||
value: function flush() {
|
||||
if (this._sQlen > 0 && this.readyState === 'open') {
|
||||
this._websocket.send(this._encodeMessage());
|
||||
|
||||
this._sQlen = 0;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "send",
|
||||
value: function send(arr) {
|
||||
this._sQ.set(arr, this._sQlen);
|
||||
|
||||
this._sQlen += arr.length;
|
||||
this.flush();
|
||||
}
|
||||
}, {
|
||||
key: "sendString",
|
||||
value: function sendString(str) {
|
||||
this.send(str.split('').map(function (chr) {
|
||||
return chr.charCodeAt(0);
|
||||
}));
|
||||
} // Event Handlers
|
||||
|
||||
}, {
|
||||
key: "off",
|
||||
value: function off(evt) {
|
||||
this._eventHandlers[evt] = function () {};
|
||||
}
|
||||
}, {
|
||||
key: "on",
|
||||
value: function on(evt, handler) {
|
||||
this._eventHandlers[evt] = handler;
|
||||
}
|
||||
}, {
|
||||
key: "_allocateBuffers",
|
||||
value: function _allocateBuffers() {
|
||||
this._rQ = new Uint8Array(this._rQbufferSize);
|
||||
this._sQ = new Uint8Array(this._sQbufferSize);
|
||||
}
|
||||
}, {
|
||||
key: "init",
|
||||
value: function init() {
|
||||
this._allocateBuffers();
|
||||
|
||||
this._rQi = 0;
|
||||
this._websocket = null;
|
||||
}
|
||||
}, {
|
||||
key: "open",
|
||||
value: function open(uri, protocols) {
|
||||
this.attach(new WebSocket(uri, protocols));
|
||||
}
|
||||
}, {
|
||||
key: "attach",
|
||||
value: function attach(rawChannel) {
|
||||
var _this = this;
|
||||
|
||||
this.init(); // Must get object and class methods to be compatible with the tests.
|
||||
|
||||
var channelProps = [].concat(_toConsumableArray(Object.keys(rawChannel)), _toConsumableArray(Object.getOwnPropertyNames(Object.getPrototypeOf(rawChannel))));
|
||||
|
||||
for (var i = 0; i < rawChannelProps.length; i++) {
|
||||
var prop = rawChannelProps[i];
|
||||
|
||||
if (channelProps.indexOf(prop) < 0) {
|
||||
throw new Error('Raw channel missing property: ' + prop);
|
||||
}
|
||||
}
|
||||
|
||||
this._websocket = rawChannel;
|
||||
this._websocket.binaryType = "arraybuffer";
|
||||
this._websocket.onmessage = this._recvMessage.bind(this);
|
||||
|
||||
this._websocket.onopen = function () {
|
||||
Log.Debug('>> WebSock.onopen');
|
||||
|
||||
if (_this._websocket.protocol) {
|
||||
Log.Info("Server choose sub-protocol: " + _this._websocket.protocol);
|
||||
}
|
||||
|
||||
_this._eventHandlers.open();
|
||||
|
||||
Log.Debug("<< WebSock.onopen");
|
||||
};
|
||||
|
||||
this._websocket.onclose = function (e) {
|
||||
Log.Debug(">> WebSock.onclose");
|
||||
|
||||
_this._eventHandlers.close(e);
|
||||
|
||||
Log.Debug("<< WebSock.onclose");
|
||||
};
|
||||
|
||||
this._websocket.onerror = function (e) {
|
||||
Log.Debug(">> WebSock.onerror: " + e);
|
||||
|
||||
_this._eventHandlers.error(e);
|
||||
|
||||
Log.Debug("<< WebSock.onerror: " + e);
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "close",
|
||||
value: function close() {
|
||||
if (this._websocket) {
|
||||
if (this.readyState === 'connecting' || this.readyState === 'open') {
|
||||
Log.Info("Closing WebSocket connection");
|
||||
|
||||
this._websocket.close();
|
||||
}
|
||||
|
||||
this._websocket.onmessage = function () {};
|
||||
}
|
||||
} // private methods
|
||||
|
||||
}, {
|
||||
key: "_encodeMessage",
|
||||
value: function _encodeMessage() {
|
||||
// Put in a binary arraybuffer
|
||||
// according to the spec, you can send ArrayBufferViews with the send method
|
||||
return new Uint8Array(this._sQ.buffer, 0, this._sQlen);
|
||||
} // We want to move all the unread data to the start of the queue,
|
||||
// e.g. compacting.
|
||||
// The function also expands the receive que if needed, and for
|
||||
// performance reasons we combine these two actions to avoid
|
||||
// unneccessary copying.
|
||||
|
||||
}, {
|
||||
key: "_expandCompactRQ",
|
||||
value: function _expandCompactRQ(minFit) {
|
||||
// if we're using less than 1/8th of the buffer even with the incoming bytes, compact in place
|
||||
// instead of resizing
|
||||
var requiredBufferSize = (this._rQlen - this._rQi + minFit) * 8;
|
||||
var resizeNeeded = this._rQbufferSize < requiredBufferSize;
|
||||
|
||||
if (resizeNeeded) {
|
||||
// Make sure we always *at least* double the buffer size, and have at least space for 8x
|
||||
// the current amount of data
|
||||
this._rQbufferSize = Math.max(this._rQbufferSize * 2, requiredBufferSize);
|
||||
} // we don't want to grow unboundedly
|
||||
|
||||
|
||||
if (this._rQbufferSize > MAX_RQ_GROW_SIZE) {
|
||||
this._rQbufferSize = MAX_RQ_GROW_SIZE;
|
||||
|
||||
if (this._rQbufferSize - this.rQlen < minFit) {
|
||||
throw new Error("Receive Queue buffer exceeded " + MAX_RQ_GROW_SIZE + " bytes, and the new message could not fit");
|
||||
}
|
||||
}
|
||||
|
||||
if (resizeNeeded) {
|
||||
var oldRQbuffer = this._rQ.buffer;
|
||||
this._rQ = new Uint8Array(this._rQbufferSize);
|
||||
|
||||
this._rQ.set(new Uint8Array(oldRQbuffer, this._rQi, this._rQlen - this._rQi));
|
||||
} else {
|
||||
this._rQ.copyWithin(0, this._rQi, this._rQlen);
|
||||
}
|
||||
|
||||
this._rQlen = this._rQlen - this._rQi;
|
||||
this._rQi = 0;
|
||||
} // push arraybuffer values onto the end of the receive que
|
||||
|
||||
}, {
|
||||
key: "_DecodeMessage",
|
||||
value: function _DecodeMessage(data) {
|
||||
var u8 = new Uint8Array(data);
|
||||
|
||||
if (u8.length > this._rQbufferSize - this._rQlen) {
|
||||
this._expandCompactRQ(u8.length);
|
||||
}
|
||||
|
||||
this._rQ.set(u8, this._rQlen);
|
||||
|
||||
this._rQlen += u8.length;
|
||||
}
|
||||
}, {
|
||||
key: "_recvMessage",
|
||||
value: function _recvMessage(e) {
|
||||
this._DecodeMessage(e.data);
|
||||
|
||||
if (this.rQlen > 0) {
|
||||
this._eventHandlers.message();
|
||||
|
||||
if (this._rQlen == this._rQi) {
|
||||
// All data has now been processed, this means we
|
||||
// can reset the receive queue.
|
||||
this._rQlen = 0;
|
||||
this._rQi = 0;
|
||||
}
|
||||
} else {
|
||||
Log.Debug("Ignoring empty message");
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return Websock;
|
||||
}();
|
||||
|
||||
exports["default"] = Websock;
|
||||
1
public/novnc/node_modules/.bin/JSONStream
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/JSONStream
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../JSONStream/bin.js
|
||||
1
public/novnc/node_modules/.bin/_mocha
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/_mocha
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mocha/bin/_mocha
|
||||
1
public/novnc/node_modules/.bin/acorn
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/acorn
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../acorn/bin/acorn
|
||||
1
public/novnc/node_modules/.bin/babel
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/babel
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/cli/bin/babel.js
|
||||
1
public/novnc/node_modules/.bin/babel-external-helpers
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/babel-external-helpers
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/cli/bin/babel-external-helpers.js
|
||||
1
public/novnc/node_modules/.bin/babylon
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/babylon
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../babylon/bin/babylon.js
|
||||
1
public/novnc/node_modules/.bin/browser-pack
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/browser-pack
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browser-pack/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/browserify
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/browserify
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browserify/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/browserslist
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/browserslist
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../browserslist/cli.js
|
||||
1
public/novnc/node_modules/.bin/browserslist-lint
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/browserslist-lint
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../update-browserslist-db/cli.js
|
||||
1
public/novnc/node_modules/.bin/deps-sort
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/deps-sort
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../deps-sort/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/detective
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/detective
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../detective/bin/detective.js
|
||||
1
public/novnc/node_modules/.bin/escodegen
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/escodegen
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../escodegen/bin/escodegen.js
|
||||
1
public/novnc/node_modules/.bin/esgenerate
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/esgenerate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../escodegen/bin/esgenerate.js
|
||||
1
public/novnc/node_modules/.bin/eslint
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/eslint
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../eslint/bin/eslint.js
|
||||
1
public/novnc/node_modules/.bin/esparse
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/esparse
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esparse.js
|
||||
1
public/novnc/node_modules/.bin/esvalidate
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/esvalidate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
1
public/novnc/node_modules/.bin/flat
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/flat
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../flat/cli.js
|
||||
1
public/novnc/node_modules/.bin/he
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/he
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../he/bin/he
|
||||
1
public/novnc/node_modules/.bin/insert-module-globals
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/insert-module-globals
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../insert-module-globals/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/is-docker
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/is-docker
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../is-docker/cli.js
|
||||
1
public/novnc/node_modules/.bin/js-yaml
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/js-yaml
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../js-yaml/bin/js-yaml.js
|
||||
1
public/novnc/node_modules/.bin/jsesc
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/jsesc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../jsesc/bin/jsesc
|
||||
1
public/novnc/node_modules/.bin/json5
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/json5
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../json5/lib/cli.js
|
||||
1
public/novnc/node_modules/.bin/karma
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/karma
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../karma/bin/karma
|
||||
1
public/novnc/node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/miller-rabin
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../miller-rabin/bin/miller-rabin
|
||||
1
public/novnc/node_modules/.bin/mime
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
1
public/novnc/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/mocha
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/mocha
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mocha/bin/mocha.js
|
||||
1
public/novnc/node_modules/.bin/module-deps
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/module-deps
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../module-deps/bin/cmd.js
|
||||
1
public/novnc/node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/nanoid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
public/novnc/node_modules/.bin/node-which
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/node-which
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../which/bin/node-which
|
||||
1
public/novnc/node_modules/.bin/parser
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/parser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@babel/parser/bin/babel-parser.js
|
||||
1
public/novnc/node_modules/.bin/po2json
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/po2json
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../po2json/bin/po2json
|
||||
1
public/novnc/node_modules/.bin/regjsparser
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/regjsparser
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../regjsparser/bin/parser
|
||||
1
public/novnc/node_modules/.bin/resolve
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/resolve
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../resolve/bin/resolve
|
||||
1
public/novnc/node_modules/.bin/rimraf
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/rimraf
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../rimraf/bin.js
|
||||
1
public/novnc/node_modules/.bin/semver
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
1
public/novnc/node_modules/.bin/sha.js
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/sha.js
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../sha.js/bin.js
|
||||
1
public/novnc/node_modules/.bin/umd
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/umd
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../umd/bin/cli.js
|
||||
1
public/novnc/node_modules/.bin/undeclared-identifiers
generated
vendored
Symbolic link
1
public/novnc/node_modules/.bin/undeclared-identifiers
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../undeclared-identifiers/bin.js
|
||||
7762
public/novnc/node_modules/.package-lock.json
generated
vendored
Normal file
7762
public/novnc/node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
202
public/novnc/node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
202
public/novnc/node_modules/@ampproject/remapping/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2019 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
218
public/novnc/node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
218
public/novnc/node_modules/@ampproject/remapping/README.md
generated
vendored
Normal file
@@ -0,0 +1,218 @@
|
||||
# @ampproject/remapping
|
||||
|
||||
> Remap sequential sourcemaps through transformations to point at the original source code
|
||||
|
||||
Remapping allows you to take the sourcemaps generated through transforming your code and "remap"
|
||||
them to the original source locations. Think "my minified code, transformed with babel and bundled
|
||||
with webpack", all pointing to the correct location in your original source code.
|
||||
|
||||
With remapping, none of your source code transformations need to be aware of the input's sourcemap,
|
||||
they only need to generate an output sourcemap. This greatly simplifies building custom
|
||||
transformations (think a find-and-replace).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install @ampproject/remapping
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```typescript
|
||||
function remapping(
|
||||
map: SourceMap | SourceMap[],
|
||||
loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined),
|
||||
options?: { excludeContent: boolean, decodedMappings: boolean }
|
||||
): SourceMap;
|
||||
|
||||
// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the
|
||||
// "source" location (where child sources are resolved relative to, or the location of original
|
||||
// source), and the ability to override the "content" of an original source for inclusion in the
|
||||
// output sourcemap.
|
||||
type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
}
|
||||
```
|
||||
|
||||
`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer
|
||||
in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents
|
||||
a transformed file (it has a sourcmap associated with it), then the `loader` should return that
|
||||
sourcemap. If not, the path will be treated as an original, untransformed source code.
|
||||
|
||||
```js
|
||||
// Babel transformed "helloworld.js" into "transformed.js"
|
||||
const transformedMap = JSON.stringify({
|
||||
file: 'transformed.js',
|
||||
// 1st column of 2nd line of output file translates into the 1st source
|
||||
// file, line 3, column 2
|
||||
mappings: ';CAEE',
|
||||
sources: ['helloworld.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
// Uglify minified "transformed.js" into "transformed.min.js"
|
||||
const minifiedTransformedMap = JSON.stringify({
|
||||
file: 'transformed.min.js',
|
||||
// 0th column of 1st line of output file translates into the 1st source
|
||||
// file, line 2, column 1.
|
||||
mappings: 'AACC',
|
||||
names: [],
|
||||
sources: ['transformed.js'],
|
||||
version: 3,
|
||||
});
|
||||
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
// The "transformed.js" file is an transformed file.
|
||||
if (file === 'transformed.js') {
|
||||
// The root importer is empty.
|
||||
console.assert(ctx.importer === '');
|
||||
// The depth in the sourcemap tree we're currently loading.
|
||||
// The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc.
|
||||
console.assert(ctx.depth === 1);
|
||||
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
// Loader will be called to load transformedMap's source file pointers as well.
|
||||
console.assert(file === 'helloworld.js');
|
||||
// `transformed.js`'s sourcemap points into `helloworld.js`.
|
||||
console.assert(ctx.importer === 'transformed.js');
|
||||
// This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`.
|
||||
console.assert(ctx.depth === 2);
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
In this example, `loader` will be called twice:
|
||||
|
||||
1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the
|
||||
associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can
|
||||
be traced through it into the source files it represents.
|
||||
2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so
|
||||
we return `null`.
|
||||
|
||||
The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If
|
||||
you were to read the `mappings`, it says "0th column of the first line output line points to the 1st
|
||||
column of the 2nd line of the file `helloworld.js`".
|
||||
|
||||
### Multiple transformations of a file
|
||||
|
||||
As a convenience, if you have multiple single-source transformations of a file, you may pass an
|
||||
array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this
|
||||
changes the `importer` and `depth` of each call to our loader. So our above example could have been
|
||||
written as:
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
[minifiedTransformedMap, transformedMap],
|
||||
() => null
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// file: 'transpiled.min.js',
|
||||
// mappings: 'AAEE',
|
||||
// sources: ['helloworld.js'],
|
||||
// version: 3,
|
||||
// };
|
||||
```
|
||||
|
||||
### Advanced control of the loading graph
|
||||
|
||||
#### `source`
|
||||
|
||||
The `source` property can overridden to any value to change the location of the current load. Eg,
|
||||
for an original source file, it allows us to change the location to the original source regardless
|
||||
of what the sourcemap source entry says. And for transformed files, it allows us to change the
|
||||
relative resolving location for child sources of the loaded sourcemap.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// We pretend the transformed.js file actually exists in the 'src/' directory. When the nested
|
||||
// source files are loaded, they will now be relative to `src/`.
|
||||
ctx.source = 'src/transformed.js';
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'src/helloworld.js');
|
||||
// We could futher change the source of this original file, eg, to be inside a nested directory
|
||||
// itself. This will be reflected in the remapped sourcemap.
|
||||
ctx.source = 'src/nested/transformed.js';
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sources: ['src/nested/helloworld.js'],
|
||||
// };
|
||||
```
|
||||
|
||||
|
||||
#### `content`
|
||||
|
||||
The `content` property can be overridden when we encounter an original source file. Eg, this allows
|
||||
you to manually provide the source content of the original file regardless of whether the
|
||||
`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove
|
||||
the source content.
|
||||
|
||||
```js
|
||||
const remapped = remapping(
|
||||
minifiedTransformedMap,
|
||||
(file, ctx) => {
|
||||
|
||||
if (file === 'transformed.js') {
|
||||
// transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap
|
||||
// would not include any `sourcesContent` values.
|
||||
return transformedMap;
|
||||
}
|
||||
|
||||
console.assert(file === 'helloworld.js');
|
||||
// We can read the file to provide the source content.
|
||||
ctx.content = fs.readFileSync(file, 'utf8');
|
||||
return null;
|
||||
}
|
||||
);
|
||||
|
||||
console.log(remapped);
|
||||
// {
|
||||
// …,
|
||||
// sourcesContent: [
|
||||
// 'console.log("Hello world!")',
|
||||
// ],
|
||||
// };
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
#### excludeContent
|
||||
|
||||
By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the
|
||||
`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce
|
||||
the size out the sourcemap.
|
||||
|
||||
#### decodedMappings
|
||||
|
||||
By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the
|
||||
`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of
|
||||
encoding into a VLQ string.
|
||||
204
public/novnc/node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
204
public/novnc/node_modules/@ampproject/remapping/dist/remapping.mjs
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
import { decodedMappings, traceSegment, TraceMap } from '@jridgewell/trace-mapping';
|
||||
import { GenMapping, addSegment, setSourceContent, decodedMap, encodedMap } from '@jridgewell/gen-mapping';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? decodedMap(map) : encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
export { remapping as default };
|
||||
//# sourceMappingURL=remapping.mjs.map
|
||||
1
public/novnc/node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
1
public/novnc/node_modules/@ampproject/remapping/dist/remapping.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
209
public/novnc/node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
209
public/novnc/node_modules/@ampproject/remapping/dist/remapping.umd.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@jridgewell/trace-mapping'), require('@jridgewell/gen-mapping')) :
|
||||
typeof define === 'function' && define.amd ? define(['@jridgewell/trace-mapping', '@jridgewell/gen-mapping'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.remapping = factory(global.traceMapping, global.genMapping));
|
||||
})(this, (function (traceMapping, genMapping) { 'use strict';
|
||||
|
||||
const SOURCELESS_MAPPING = {
|
||||
source: null,
|
||||
column: null,
|
||||
line: null,
|
||||
name: null,
|
||||
content: null,
|
||||
};
|
||||
const EMPTY_SOURCES = [];
|
||||
function Source(map, sources, source, content) {
|
||||
return {
|
||||
map,
|
||||
sources,
|
||||
source,
|
||||
content,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
function MapSource(map, sources) {
|
||||
return Source(map, sources, '', null);
|
||||
}
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
function OriginalSource(source, content) {
|
||||
return Source(null, EMPTY_SOURCES, source, content);
|
||||
}
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
function traceMappings(tree) {
|
||||
const gen = new genMapping.GenMapping({ file: tree.map.file });
|
||||
const { sources: rootSources, map } = tree;
|
||||
const rootNames = map.names;
|
||||
const rootMappings = traceMapping.decodedMappings(map);
|
||||
for (let i = 0; i < rootMappings.length; i++) {
|
||||
const segments = rootMappings[i];
|
||||
let lastSource = null;
|
||||
let lastSourceLine = null;
|
||||
let lastSourceColumn = null;
|
||||
for (let j = 0; j < segments.length; j++) {
|
||||
const segment = segments[j];
|
||||
const genCol = segment[0];
|
||||
let traced = SOURCELESS_MAPPING;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length !== 1) {
|
||||
const source = rootSources[segment[1]];
|
||||
traced = originalPositionFor(source, segment[2], segment[3], segment.length === 5 ? rootNames[segment[4]] : '');
|
||||
// If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a
|
||||
// respective segment into an original source.
|
||||
if (traced == null)
|
||||
continue;
|
||||
}
|
||||
// So we traced a segment down into its original source file. Now push a
|
||||
// new segment pointing to this location.
|
||||
const { column, line, name, content, source } = traced;
|
||||
if (line === lastSourceLine && column === lastSourceColumn && source === lastSource) {
|
||||
continue;
|
||||
}
|
||||
lastSourceLine = line;
|
||||
lastSourceColumn = column;
|
||||
lastSource = source;
|
||||
// Sigh, TypeScript can't figure out source/line/column are either all null, or all non-null...
|
||||
genMapping.addSegment(gen, i, genCol, source, line, column, name);
|
||||
if (content != null)
|
||||
genMapping.setSourceContent(gen, source, content);
|
||||
}
|
||||
}
|
||||
return gen;
|
||||
}
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
function originalPositionFor(source, line, column, name) {
|
||||
if (!source.map) {
|
||||
return { column, line, name, source: source.source, content: source.content };
|
||||
}
|
||||
const segment = traceMapping.traceSegment(source.map, line, column);
|
||||
// If we couldn't find a segment, then this doesn't exist in the sourcemap.
|
||||
if (segment == null)
|
||||
return null;
|
||||
// 1-length segments only move the current generated column, there's no source information
|
||||
// to gather from it.
|
||||
if (segment.length === 1)
|
||||
return SOURCELESS_MAPPING;
|
||||
return originalPositionFor(source.sources[segment[1]], segment[2], segment[3], segment.length === 5 ? source.map.names[segment[4]] : name);
|
||||
}
|
||||
|
||||
function asArray(value) {
|
||||
if (Array.isArray(value))
|
||||
return value;
|
||||
return [value];
|
||||
}
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
function buildSourceMapTree(input, loader) {
|
||||
const maps = asArray(input).map((m) => new traceMapping.TraceMap(m, ''));
|
||||
const map = maps.pop();
|
||||
for (let i = 0; i < maps.length; i++) {
|
||||
if (maps[i].sources.length > 1) {
|
||||
throw new Error(`Transformation map ${i} must have exactly one source file.\n` +
|
||||
'Did you specify these with the most recent transformation maps first?');
|
||||
}
|
||||
}
|
||||
let tree = build(map, loader, '', 0);
|
||||
for (let i = maps.length - 1; i >= 0; i--) {
|
||||
tree = MapSource(maps[i], [tree]);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
function build(map, loader, importer, importerDepth) {
|
||||
const { resolvedSources, sourcesContent } = map;
|
||||
const depth = importerDepth + 1;
|
||||
const children = resolvedSources.map((sourceFile, i) => {
|
||||
// The loading context gives the loader more information about why this file is being loaded
|
||||
// (eg, from which importer). It also allows the loader to override the location of the loaded
|
||||
// sourcemap/original source, or to override the content in the sourcesContent field if it's
|
||||
// an unmodified source file.
|
||||
const ctx = {
|
||||
importer,
|
||||
depth,
|
||||
source: sourceFile || '',
|
||||
content: undefined,
|
||||
};
|
||||
// Use the provided loader callback to retrieve the file's sourcemap.
|
||||
// TODO: We should eventually support async loading of sourcemap files.
|
||||
const sourceMap = loader(ctx.source, ctx);
|
||||
const { source, content } = ctx;
|
||||
// If there is a sourcemap, then we need to recurse into it to load its source files.
|
||||
if (sourceMap)
|
||||
return build(new traceMapping.TraceMap(sourceMap, source), loader, source, depth);
|
||||
// Else, it's an an unmodified source file.
|
||||
// The contents of this unmodified source file can be overridden via the loader context,
|
||||
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
|
||||
// the importing sourcemap's `sourcesContent` field.
|
||||
const sourceContent = content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
|
||||
return OriginalSource(source, sourceContent);
|
||||
});
|
||||
return MapSource(map, children);
|
||||
}
|
||||
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
class SourceMap {
|
||||
constructor(map, options) {
|
||||
const out = options.decodedMappings ? genMapping.decodedMap(map) : genMapping.encodedMap(map);
|
||||
this.version = out.version; // SourceMap spec says this should be first.
|
||||
this.file = out.file;
|
||||
this.mappings = out.mappings;
|
||||
this.names = out.names;
|
||||
this.sourceRoot = out.sourceRoot;
|
||||
this.sources = out.sources;
|
||||
if (!options.excludeContent) {
|
||||
this.sourcesContent = out.sourcesContent;
|
||||
}
|
||||
}
|
||||
toString() {
|
||||
return JSON.stringify(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
function remapping(input, loader, options) {
|
||||
const opts = typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false };
|
||||
const tree = buildSourceMapTree(input, loader);
|
||||
return new SourceMap(traceMappings(tree), opts);
|
||||
}
|
||||
|
||||
return remapping;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=remapping.umd.js.map
|
||||
1
public/novnc/node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
1
public/novnc/node_modules/@ampproject/remapping/dist/remapping.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
14
public/novnc/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
14
public/novnc/node_modules/@ampproject/remapping/dist/types/build-source-map-tree.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { MapSource as MapSourceType } from './source-map-tree';
|
||||
import type { SourceMapInput, SourceMapLoader } from './types';
|
||||
/**
|
||||
* Recursively builds a tree structure out of sourcemap files, with each node
|
||||
* being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of
|
||||
* `OriginalSource`s and `SourceMapTree`s.
|
||||
*
|
||||
* Every sourcemap is composed of a collection of source files and mappings
|
||||
* into locations of those source files. When we generate a `SourceMapTree` for
|
||||
* the sourcemap, we attempt to load each source file's own sourcemap. If it
|
||||
* does not have an associated sourcemap, it is considered an original,
|
||||
* unmodified source file.
|
||||
*/
|
||||
export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType;
|
||||
19
public/novnc/node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
19
public/novnc/node_modules/@ampproject/remapping/dist/types/remapping.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import SourceMap from './source-map';
|
||||
import type { SourceMapInput, SourceMapLoader, Options } from './types';
|
||||
export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types';
|
||||
/**
|
||||
* Traces through all the mappings in the root sourcemap, through the sources
|
||||
* (and their sourcemaps), all the way back to the original source location.
|
||||
*
|
||||
* `loader` will be called every time we encounter a source file. If it returns
|
||||
* a sourcemap, we will recurse into that sourcemap to continue the trace. If
|
||||
* it returns a falsey value, that source file is treated as an original,
|
||||
* unmodified source file.
|
||||
*
|
||||
* Pass `excludeContent` to exclude any self-containing source file content
|
||||
* from the output sourcemap.
|
||||
*
|
||||
* Pass `decodedMappings` to receive a SourceMap with decoded (instead of
|
||||
* VLQ encoded) mappings.
|
||||
*/
|
||||
export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap;
|
||||
48
public/novnc/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
48
public/novnc/node_modules/@ampproject/remapping/dist/types/source-map-tree.d.ts
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
import { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { TraceMap } from '@jridgewell/trace-mapping';
|
||||
export declare type SourceMapSegmentObject = {
|
||||
column: number;
|
||||
line: number;
|
||||
name: string;
|
||||
source: string;
|
||||
content: string | null;
|
||||
} | {
|
||||
column: null;
|
||||
line: null;
|
||||
name: null;
|
||||
source: null;
|
||||
content: null;
|
||||
};
|
||||
export declare type OriginalSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type MapSource = {
|
||||
map: TraceMap;
|
||||
sources: Sources[];
|
||||
source: string;
|
||||
content: string | null;
|
||||
};
|
||||
export declare type Sources = OriginalSource | MapSource;
|
||||
/**
|
||||
* MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes
|
||||
* (which may themselves be SourceMapTrees).
|
||||
*/
|
||||
export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource;
|
||||
/**
|
||||
* A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive
|
||||
* segment tracing ends at the `OriginalSource`.
|
||||
*/
|
||||
export declare function OriginalSource(source: string, content: string | null): OriginalSource;
|
||||
/**
|
||||
* traceMappings is only called on the root level SourceMapTree, and begins the process of
|
||||
* resolving each mapping in terms of the original source files.
|
||||
*/
|
||||
export declare function traceMappings(tree: MapSource): GenMapping;
|
||||
/**
|
||||
* originalPositionFor is only called on children SourceMapTrees. It recurses down into its own
|
||||
* child SourceMapTrees, until we find the original source map.
|
||||
*/
|
||||
export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null;
|
||||
17
public/novnc/node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
17
public/novnc/node_modules/@ampproject/remapping/dist/types/source-map.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { GenMapping } from '@jridgewell/gen-mapping';
|
||||
import type { DecodedSourceMap, EncodedSourceMap, Options } from './types';
|
||||
/**
|
||||
* A SourceMap v3 compatible sourcemap, which only includes fields that were
|
||||
* provided to it.
|
||||
*/
|
||||
export default class SourceMap {
|
||||
file?: string | null;
|
||||
mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings'];
|
||||
sourceRoot?: string;
|
||||
names: string[];
|
||||
sources: (string | null)[];
|
||||
sourcesContent?: (string | null)[];
|
||||
version: 3;
|
||||
constructor(map: GenMapping, options: Options);
|
||||
toString(): string;
|
||||
}
|
||||
14
public/novnc/node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
14
public/novnc/node_modules/@ampproject/remapping/dist/types/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { SourceMapInput } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping';
|
||||
export type { SourceMapInput };
|
||||
export declare type LoaderContext = {
|
||||
readonly importer: string;
|
||||
readonly depth: number;
|
||||
source: string;
|
||||
content: string | null | undefined;
|
||||
};
|
||||
export declare type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void;
|
||||
export declare type Options = {
|
||||
excludeContent?: boolean;
|
||||
decodedMappings?: boolean;
|
||||
};
|
||||
63
public/novnc/node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
63
public/novnc/node_modules/@ampproject/remapping/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"name": "@ampproject/remapping",
|
||||
"version": "2.2.0",
|
||||
"description": "Remap sequential sourcemaps through transformations to point at the original source code",
|
||||
"keywords": [
|
||||
"source",
|
||||
"map",
|
||||
"remap"
|
||||
],
|
||||
"main": "dist/remapping.umd.js",
|
||||
"module": "dist/remapping.mjs",
|
||||
"typings": "dist/types/remapping.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"author": "Justin Ridgewell <jridgewell@google.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ampproject/remapping.git"
|
||||
},
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "run-s -n build:*",
|
||||
"build:rollup": "rollup -c rollup.config.js",
|
||||
"build:ts": "tsc --project tsconfig.build.json",
|
||||
"lint": "run-s -n lint:*",
|
||||
"lint:prettier": "npm run test:lint:prettier -- --write",
|
||||
"lint:ts": "npm run test:lint:ts -- --fix",
|
||||
"prebuild": "rm -rf dist",
|
||||
"prepublishOnly": "npm run preversion",
|
||||
"preversion": "run-s test build",
|
||||
"test": "run-s -n test:lint test:only",
|
||||
"test:debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
||||
"test:lint": "run-s -n test:lint:*",
|
||||
"test:lint:prettier": "prettier --check '{src,test}/**/*.ts'",
|
||||
"test:lint:ts": "eslint '{src,test}/**/*.ts'",
|
||||
"test:only": "jest --coverage",
|
||||
"test:watch": "jest --coverage --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.2",
|
||||
"@types/jest": "27.4.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.20.0",
|
||||
"@typescript-eslint/parser": "5.20.0",
|
||||
"eslint": "8.14.0",
|
||||
"eslint-config-prettier": "8.5.0",
|
||||
"jest": "27.5.1",
|
||||
"jest-config": "27.5.1",
|
||||
"npm-run-all": "4.1.5",
|
||||
"prettier": "2.6.2",
|
||||
"rollup": "2.70.2",
|
||||
"ts-jest": "27.1.4",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.6.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.1.0",
|
||||
"@jridgewell/trace-mapping": "^0.3.9"
|
||||
}
|
||||
}
|
||||
22
public/novnc/node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
22
public/novnc/node_modules/@babel/cli/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
19
public/novnc/node_modules/@babel/cli/README.md
generated
vendored
Normal file
19
public/novnc/node_modules/@babel/cli/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/cli
|
||||
|
||||
> Babel command line.
|
||||
|
||||
See our website [@babel/cli](https://babeljs.io/docs/en/babel-cli) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20cli%22+is%3Aopen) associated with this package.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/cli
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/cli --dev
|
||||
```
|
||||
3
public/novnc/node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
3
public/novnc/node_modules/@babel/cli/bin/babel-external-helpers.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel-external-helpers");
|
||||
3
public/novnc/node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
3
public/novnc/node_modules/@babel/cli/bin/babel.js
generated
vendored
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
require("../lib/babel");
|
||||
1
public/novnc/node_modules/@babel/cli/index.js
generated
vendored
Normal file
1
public/novnc/node_modules/@babel/cli/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
throw new Error("Use the `@babel/core` package instead of `@babel/cli`.");
|
||||
43
public/novnc/node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
43
public/novnc/node_modules/@babel/cli/lib/babel-external-helpers.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
function _commander() {
|
||||
const data = require("commander");
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
_commander().option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
|
||||
|
||||
_commander().option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
|
||||
|
||||
_commander().usage("[options]");
|
||||
|
||||
_commander().parse(process.argv);
|
||||
|
||||
console.log((0, _core().buildExternalHelpers)(_commander().whitelist, _commander().outputType));
|
||||
285
public/novnc/node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
285
public/novnc/node_modules/@babel/cli/lib/babel/dir.js
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var util = require("./util");
|
||||
|
||||
var watcher = require("./watcher");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
const FILE_TYPE = Object.freeze({
|
||||
NON_COMPILABLE: "NON_COMPILABLE",
|
||||
COMPILED: "COMPILED",
|
||||
IGNORED: "IGNORED",
|
||||
ERR_COMPILATION: "ERR_COMPILATION"
|
||||
});
|
||||
|
||||
function outputFileSync(filePath, data) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(filePath), {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
_fs().writeFileSync(filePath, data);
|
||||
}
|
||||
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function write(_x2, _x3) {
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _write() {
|
||||
_write = _asyncToGenerator(function* (src, base) {
|
||||
let relative = _path().relative(base, src);
|
||||
|
||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||
return FILE_TYPE.NON_COMPILABLE;
|
||||
}
|
||||
|
||||
relative = util.withExtension(relative, cliOptions.keepFileExtension ? _path().extname(relative) : cliOptions.outFileExtension);
|
||||
const dest = getDest(relative, base);
|
||||
|
||||
try {
|
||||
const res = yield util.compile(src, Object.assign({}, babelOptions, {
|
||||
sourceFileName: _slash()(_path().relative(dest + "/..", src))
|
||||
}));
|
||||
if (!res) return FILE_TYPE.IGNORED;
|
||||
|
||||
if (res.map && babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
const mapLoc = dest + ".map";
|
||||
res.code = util.addSourceMappingUrl(res.code, mapLoc);
|
||||
res.map.file = _path().basename(relative);
|
||||
outputFileSync(mapLoc, JSON.stringify(res.map));
|
||||
}
|
||||
|
||||
outputFileSync(dest, res.code);
|
||||
util.chmod(src, dest);
|
||||
|
||||
if (cliOptions.verbose) {
|
||||
console.log(_path().relative(process.cwd(), src) + " -> " + dest);
|
||||
}
|
||||
|
||||
return FILE_TYPE.COMPILED;
|
||||
} catch (err) {
|
||||
if (cliOptions.watch) {
|
||||
console.error(err);
|
||||
return FILE_TYPE.ERR_COMPILATION;
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
return _write.apply(this, arguments);
|
||||
}
|
||||
|
||||
function getDest(filename, base) {
|
||||
if (cliOptions.relative) {
|
||||
return _path().join(base, cliOptions.outDir, filename);
|
||||
}
|
||||
|
||||
return _path().join(cliOptions.outDir, filename);
|
||||
}
|
||||
|
||||
function handleFile(_x4, _x5) {
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _handleFile() {
|
||||
_handleFile = _asyncToGenerator(function* (src, base) {
|
||||
const written = yield write(src, base);
|
||||
|
||||
if (cliOptions.copyFiles && written === FILE_TYPE.NON_COMPILABLE || cliOptions.copyIgnored && written === FILE_TYPE.IGNORED) {
|
||||
const filename = _path().relative(base, src);
|
||||
|
||||
const dest = getDest(filename, base);
|
||||
outputFileSync(dest, _fs().readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
}
|
||||
|
||||
return written === FILE_TYPE.COMPILED;
|
||||
});
|
||||
return _handleFile.apply(this, arguments);
|
||||
}
|
||||
|
||||
function handle(_x6) {
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _handle() {
|
||||
_handle = _asyncToGenerator(function* (filenameOrDir) {
|
||||
if (!_fs().existsSync(filenameOrDir)) return 0;
|
||||
|
||||
const stat = _fs().statSync(filenameOrDir);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filenameOrDir;
|
||||
let count = 0;
|
||||
const files = util.readdir(dirname, cliOptions.includeDotfiles);
|
||||
|
||||
for (const filename of files) {
|
||||
const src = _path().join(dirname, filename);
|
||||
|
||||
const written = yield handleFile(src, dirname);
|
||||
if (written) count += 1;
|
||||
}
|
||||
|
||||
return count;
|
||||
} else {
|
||||
const filename = filenameOrDir;
|
||||
const written = yield handleFile(filename, _path().dirname(filename));
|
||||
return written ? 1 : 0;
|
||||
}
|
||||
});
|
||||
return _handle.apply(this, arguments);
|
||||
}
|
||||
|
||||
let compiledFiles = 0;
|
||||
let startTime = null;
|
||||
const logSuccess = util.debounce(function () {
|
||||
if (startTime === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const diff = process.hrtime(startTime);
|
||||
console.log(`Successfully compiled ${compiledFiles} ${compiledFiles !== 1 ? "files" : "file"} with Babel (${diff[0] * 1e3 + Math.round(diff[1] / 1e6)}ms).`);
|
||||
compiledFiles = 0;
|
||||
startTime = null;
|
||||
}, 100);
|
||||
if (cliOptions.watch) watcher.enable({
|
||||
enableGlobbing: true
|
||||
});
|
||||
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
if (cliOptions.deleteDirOnStart) {
|
||||
util.deleteDir(cliOptions.outDir);
|
||||
}
|
||||
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(cliOptions.outDir, {
|
||||
recursive: true
|
||||
});
|
||||
startTime = process.hrtime();
|
||||
|
||||
for (const filename of cliOptions.filenames) {
|
||||
compiledFiles += yield handle(filename);
|
||||
}
|
||||
|
||||
if (!cliOptions.quiet) {
|
||||
logSuccess();
|
||||
logSuccess.flush();
|
||||
}
|
||||
}
|
||||
|
||||
if (cliOptions.watch) {
|
||||
let processing = 0;
|
||||
const {
|
||||
filenames
|
||||
} = cliOptions;
|
||||
let getBase;
|
||||
|
||||
if (filenames.length === 1) {
|
||||
const base = filenames[0];
|
||||
|
||||
const absoluteBase = _path().resolve(base);
|
||||
|
||||
getBase = filename => {
|
||||
return filename === absoluteBase ? _path().dirname(base) : base;
|
||||
};
|
||||
} else {
|
||||
const filenameToBaseMap = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
|
||||
return [absoluteFilename, _path().dirname(filename)];
|
||||
}));
|
||||
const absoluteFilenames = new Map(filenames.map(filename => {
|
||||
const absoluteFilename = _path().resolve(filename);
|
||||
|
||||
return [absoluteFilename, filename];
|
||||
}));
|
||||
|
||||
const {
|
||||
sep
|
||||
} = _path();
|
||||
|
||||
getBase = filename => {
|
||||
const base = filenameToBaseMap.get(filename);
|
||||
|
||||
if (base !== undefined) {
|
||||
return base;
|
||||
}
|
||||
|
||||
for (const [absoluteFilenameOrDir, relative] of absoluteFilenames) {
|
||||
if (filename.startsWith(absoluteFilenameOrDir + sep)) {
|
||||
filenameToBaseMap.set(filename, relative);
|
||||
return relative;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
filenames.forEach(filenameOrDir => {
|
||||
watcher.watch(filenameOrDir);
|
||||
});
|
||||
watcher.startWatcher();
|
||||
watcher.onFilesChange(_asyncToGenerator(function* (filenames) {
|
||||
processing++;
|
||||
if (startTime === null) startTime = process.hrtime();
|
||||
|
||||
try {
|
||||
const written = yield Promise.all(filenames.map(filename => handleFile(filename, getBase(filename))));
|
||||
compiledFiles += written.filter(Boolean).length;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
processing--;
|
||||
if (processing === 0 && !cliOptions.quiet) logSuccess();
|
||||
}));
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
273
public/novnc/node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
273
public/novnc/node_modules/@babel/cli/lib/babel/file.js
generated
vendored
Normal file
@@ -0,0 +1,273 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
function _convertSourceMap() {
|
||||
const data = require("convert-source-map");
|
||||
|
||||
_convertSourceMap = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _traceMapping() {
|
||||
const data = require("@jridgewell/trace-mapping");
|
||||
|
||||
_traceMapping = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _slash() {
|
||||
const data = require("slash");
|
||||
|
||||
_slash = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _path() {
|
||||
const data = require("path");
|
||||
|
||||
_path = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
var util = require("./util");
|
||||
|
||||
var watcher = require("./watcher");
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
||||
|
||||
function _default(_x) {
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _ref() {
|
||||
_ref = _asyncToGenerator(function* ({
|
||||
cliOptions,
|
||||
babelOptions
|
||||
}) {
|
||||
function buildResult(fileResults) {
|
||||
const mapSections = [];
|
||||
let code = "";
|
||||
let offset = 0;
|
||||
|
||||
for (const result of fileResults) {
|
||||
if (!result) continue;
|
||||
mapSections.push({
|
||||
offset: {
|
||||
line: offset,
|
||||
column: 0
|
||||
},
|
||||
map: result.map || emptyMap()
|
||||
});
|
||||
code += result.code + "\n";
|
||||
offset += countNewlines(result.code) + 1;
|
||||
}
|
||||
|
||||
const map = new (_traceMapping().AnyMap)({
|
||||
version: 3,
|
||||
file: cliOptions.sourceMapTarget || _path().basename(cliOptions.outFile || "") || "stdout",
|
||||
sections: mapSections
|
||||
});
|
||||
map.sourceRoot = babelOptions.sourceRoot;
|
||||
|
||||
if (babelOptions.sourceMaps === "inline" || !cliOptions.outFile && babelOptions.sourceMaps) {
|
||||
code += "\n" + _convertSourceMap().fromObject((0, _traceMapping().encodedMap)(map)).toComment();
|
||||
}
|
||||
|
||||
return {
|
||||
map: map,
|
||||
code: code
|
||||
};
|
||||
}
|
||||
|
||||
function countNewlines(code) {
|
||||
let count = 0;
|
||||
let index = -1;
|
||||
|
||||
while ((index = code.indexOf("\n", index + 1)) !== -1) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
function emptyMap() {
|
||||
return {
|
||||
version: 3,
|
||||
names: [],
|
||||
sources: [],
|
||||
mappings: []
|
||||
};
|
||||
}
|
||||
|
||||
function output(fileResults) {
|
||||
const result = buildResult(fileResults);
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
(((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "10.12") ? _fs().mkdirSync : require("make-dir").sync)(_path().dirname(cliOptions.outFile), {
|
||||
recursive: true
|
||||
});
|
||||
|
||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||
const mapLoc = cliOptions.outFile + ".map";
|
||||
result.code = util.addSourceMappingUrl(result.code, mapLoc);
|
||||
|
||||
_fs().writeFileSync(mapLoc, JSON.stringify((0, _traceMapping().encodedMap)(result.map)));
|
||||
}
|
||||
|
||||
_fs().writeFileSync(cliOptions.outFile, result.code);
|
||||
} else {
|
||||
process.stdout.write(result.code + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
let code = "";
|
||||
process.stdin.setEncoding("utf8");
|
||||
process.stdin.on("readable", function () {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
process.stdin.on("end", function () {
|
||||
resolve(code);
|
||||
});
|
||||
process.stdin.on("error", reject);
|
||||
});
|
||||
}
|
||||
|
||||
function stdin() {
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _stdin() {
|
||||
_stdin = _asyncToGenerator(function* () {
|
||||
const code = yield readStdin();
|
||||
const res = yield util.transformRepl(cliOptions.filename, code, Object.assign({}, babelOptions, {
|
||||
sourceFileName: "stdin"
|
||||
}));
|
||||
output([res]);
|
||||
});
|
||||
return _stdin.apply(this, arguments);
|
||||
}
|
||||
|
||||
function walk(_x2) {
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _walk() {
|
||||
_walk = _asyncToGenerator(function* (filenames) {
|
||||
const _filenames = [];
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) return;
|
||||
|
||||
const stat = _fs().statSync(filename);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filename;
|
||||
util.readdirForCompilable(filename, cliOptions.includeDotfiles, cliOptions.extensions).forEach(function (filename) {
|
||||
_filenames.push(_path().join(dirname, filename));
|
||||
});
|
||||
} else {
|
||||
_filenames.push(filename);
|
||||
}
|
||||
});
|
||||
const results = yield Promise.all(_filenames.map(_asyncToGenerator(function* (filename) {
|
||||
let sourceFilename = filename;
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
sourceFilename = _path().relative(_path().dirname(cliOptions.outFile), sourceFilename);
|
||||
}
|
||||
|
||||
sourceFilename = _slash()(sourceFilename);
|
||||
|
||||
try {
|
||||
return yield util.compile(filename, Object.assign({}, babelOptions, {
|
||||
sourceFileName: sourceFilename,
|
||||
sourceMaps: babelOptions.sourceMaps === "inline" ? true : babelOptions.sourceMaps
|
||||
}));
|
||||
} catch (err) {
|
||||
if (!cliOptions.watch) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.error(err);
|
||||
return null;
|
||||
}
|
||||
})));
|
||||
output(results);
|
||||
});
|
||||
return _walk.apply(this, arguments);
|
||||
}
|
||||
|
||||
function files(_x3) {
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
|
||||
function _files() {
|
||||
_files = _asyncToGenerator(function* (filenames) {
|
||||
if (cliOptions.watch) {
|
||||
watcher.enable({
|
||||
enableGlobbing: false
|
||||
});
|
||||
}
|
||||
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
yield walk(filenames);
|
||||
}
|
||||
|
||||
if (cliOptions.watch) {
|
||||
filenames.forEach(watcher.watch);
|
||||
watcher.startWatcher();
|
||||
watcher.onFilesChange((changes, event, cause) => {
|
||||
const actionableChange = changes.some(filename => util.isCompilableExtension(filename, cliOptions.extensions) || filenames.includes(filename));
|
||||
if (!actionableChange) return;
|
||||
|
||||
if (cliOptions.verbose) {
|
||||
console.log(`${event} ${cause}`);
|
||||
}
|
||||
|
||||
walk(filenames).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
return _files.apply(this, arguments);
|
||||
}
|
||||
|
||||
if (cliOptions.filenames.length) {
|
||||
yield files(cliOptions.filenames);
|
||||
} else {
|
||||
yield stdin();
|
||||
}
|
||||
});
|
||||
return _ref.apply(this, arguments);
|
||||
}
|
||||
20
public/novnc/node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
20
public/novnc/node_modules/@babel/cli/lib/babel/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
|
||||
var _options = require("./options");
|
||||
|
||||
var _dir = require("./dir");
|
||||
|
||||
var _file = require("./file");
|
||||
|
||||
const opts = (0, _options.default)(process.argv);
|
||||
|
||||
if (opts) {
|
||||
const fn = opts.cliOptions.outDir ? _dir.default : _file.default;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
process.exitCode = 2;
|
||||
}
|
||||
285
public/novnc/node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
285
public/novnc/node_modules/@babel/cli/lib/babel/options.js
generated
vendored
Normal file
@@ -0,0 +1,285 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = parseArgv;
|
||||
|
||||
function _fs() {
|
||||
const data = require("fs");
|
||||
|
||||
_fs = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _commander() {
|
||||
const data = require("commander");
|
||||
|
||||
_commander = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _glob() {
|
||||
const data = require("glob");
|
||||
|
||||
_glob = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
_commander().option("-f, --filename [filename]", "The filename to use when reading from stdin. This will be used in source-maps, errors etc.");
|
||||
|
||||
_commander().option("--presets [list]", "A comma-separated list of preset names.", collect);
|
||||
|
||||
_commander().option("--plugins [list]", "A comma-separated list of plugin names.", collect);
|
||||
|
||||
_commander().option("--config-file [path]", "Path to a .babelrc file to use.");
|
||||
|
||||
_commander().option("--env-name [name]", "The name of the 'env' to use when loading configs and plugins. " + "Defaults to the value of BABEL_ENV, or else NODE_ENV, or else 'development'.");
|
||||
|
||||
_commander().option("--root-mode [mode]", "The project-root resolution mode. " + "One of 'root' (the default), 'upward', or 'upward-optional'.");
|
||||
|
||||
_commander().option("--source-type [script|module]", "");
|
||||
|
||||
_commander().option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files.");
|
||||
|
||||
_commander().option("--ignore [list]", "List of glob paths to **not** compile.", collect);
|
||||
|
||||
_commander().option("--only [list]", "List of glob paths to **only** compile.", collect);
|
||||
|
||||
_commander().option("--no-highlight-code", "Enable or disable ANSI syntax highlighting of code frames. (on by default)");
|
||||
|
||||
_commander().option("--no-comments", "Write comments to generated output. (true by default)");
|
||||
|
||||
_commander().option("--retain-lines", "Retain line numbers. This will result in really ugly code.");
|
||||
|
||||
_commander().option("--compact [true|false|auto]", "Do not include superfluous whitespace characters and line terminators.", booleanify);
|
||||
|
||||
_commander().option("--minified", "Save as many bytes when printing. (false by default)");
|
||||
|
||||
_commander().option("--auxiliary-comment-before [string]", "Print a comment before any injected non-user code.");
|
||||
|
||||
_commander().option("--auxiliary-comment-after [string]", "Print a comment after any injected non-user code.");
|
||||
|
||||
_commander().option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
||||
|
||||
_commander().option("--source-map-target [string]", "Set `file` on returned source map.");
|
||||
|
||||
_commander().option("--source-file-name [string]", "Set `sources[0]` on returned source map.");
|
||||
|
||||
_commander().option("--source-root [filename]", "The root from which all sources are relative.");
|
||||
|
||||
{
|
||||
_commander().option("--module-root [filename]", "Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.");
|
||||
|
||||
_commander().option("-M, --module-ids", "Insert an explicit id for modules.");
|
||||
|
||||
_commander().option("--module-id [string]", "Specify a custom name for module ids.");
|
||||
}
|
||||
|
||||
_commander().option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been the input. [" + _core().DEFAULT_EXTENSIONS.join() + "]", collect);
|
||||
|
||||
_commander().option("--keep-file-extension", "Preserve the file extensions of the input files.");
|
||||
|
||||
_commander().option("-w, --watch", "Recompile files on changes.");
|
||||
|
||||
_commander().option("--skip-initial-build", "Do not compile files before watching.");
|
||||
|
||||
_commander().option("-o, --out-file [out]", "Compile all input files into a single file.");
|
||||
|
||||
_commander().option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory.");
|
||||
|
||||
_commander().option("--relative", "Compile into an output directory relative to input directory or file. Requires --out-dir [out]");
|
||||
|
||||
_commander().option("-D, --copy-files", "When compiling a directory copy over non-compilable files.");
|
||||
|
||||
_commander().option("--include-dotfiles", "Include dotfiles when compiling and copying non-compilable files.");
|
||||
|
||||
_commander().option("--no-copy-ignored", "Exclude ignored files when copying non-compilable files.");
|
||||
|
||||
_commander().option("--verbose", "Log everything. This option conflicts with --quiet");
|
||||
|
||||
_commander().option("--quiet", "Don't log anything. This option conflicts with --verbose");
|
||||
|
||||
_commander().option("--delete-dir-on-start", "Delete the out directory before compilation.");
|
||||
|
||||
_commander().option("--out-file-extension [string]", "Use a specific extension for the output files");
|
||||
|
||||
_commander().version("7.18.9" + " (@babel/core " + _core().version + ")");
|
||||
|
||||
_commander().usage("[options] <files ...>");
|
||||
|
||||
_commander().action(() => {});
|
||||
|
||||
function parseArgv(args) {
|
||||
_commander().parse(args);
|
||||
|
||||
const errors = [];
|
||||
|
||||
let filenames = _commander().args.reduce(function (globbed, input) {
|
||||
let files = _glob().sync(input);
|
||||
|
||||
if (!files.length) files = [input];
|
||||
globbed.push(...files);
|
||||
return globbed;
|
||||
}, []);
|
||||
|
||||
filenames = Array.from(new Set(filenames));
|
||||
filenames.forEach(function (filename) {
|
||||
if (!_fs().existsSync(filename)) {
|
||||
errors.push(filename + " does not exist");
|
||||
}
|
||||
});
|
||||
|
||||
if (_commander().outDir && !filenames.length) {
|
||||
errors.push("--out-dir requires filenames");
|
||||
}
|
||||
|
||||
if (_commander().outFile && _commander().outDir) {
|
||||
errors.push("--out-file and --out-dir cannot be used together");
|
||||
}
|
||||
|
||||
if (_commander().relative && !_commander().outDir) {
|
||||
errors.push("--relative requires --out-dir usage");
|
||||
}
|
||||
|
||||
if (_commander().watch) {
|
||||
if (!_commander().outFile && !_commander().outDir) {
|
||||
errors.push("--watch requires --out-file or --out-dir");
|
||||
}
|
||||
|
||||
if (!filenames.length) {
|
||||
errors.push("--watch requires filenames");
|
||||
}
|
||||
}
|
||||
|
||||
if (_commander().skipInitialBuild && !_commander().watch) {
|
||||
errors.push("--skip-initial-build requires --watch");
|
||||
}
|
||||
|
||||
if (_commander().deleteDirOnStart && !_commander().outDir) {
|
||||
errors.push("--delete-dir-on-start requires --out-dir");
|
||||
}
|
||||
|
||||
if (_commander().verbose && _commander().quiet) {
|
||||
errors.push("--verbose and --quiet cannot be used together");
|
||||
}
|
||||
|
||||
if (!_commander().outDir && filenames.length === 0 && typeof _commander().filename !== "string" && _commander().babelrc !== false) {
|
||||
errors.push("stdin compilation requires either -f/--filename [filename] or --no-babelrc");
|
||||
}
|
||||
|
||||
if (_commander().keepFileExtension && _commander().outFileExtension) {
|
||||
errors.push("--out-file-extension cannot be used with --keep-file-extension");
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error("babel:");
|
||||
errors.forEach(function (e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
const opts = _commander().opts();
|
||||
|
||||
const babelOptions = {
|
||||
presets: opts.presets,
|
||||
plugins: opts.plugins,
|
||||
rootMode: opts.rootMode,
|
||||
configFile: opts.configFile,
|
||||
envName: opts.envName,
|
||||
sourceType: opts.sourceType,
|
||||
ignore: opts.ignore,
|
||||
only: opts.only,
|
||||
retainLines: opts.retainLines,
|
||||
compact: opts.compact,
|
||||
minified: opts.minified,
|
||||
auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
|
||||
auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
|
||||
sourceMaps: opts.sourceMaps,
|
||||
sourceFileName: opts.sourceFileName,
|
||||
sourceRoot: opts.sourceRoot,
|
||||
babelrc: opts.babelrc === true ? undefined : opts.babelrc,
|
||||
highlightCode: opts.highlightCode === true ? undefined : opts.highlightCode,
|
||||
comments: opts.comments === true ? undefined : opts.comments
|
||||
};
|
||||
{
|
||||
Object.assign(babelOptions, {
|
||||
moduleRoot: opts.moduleRoot,
|
||||
moduleIds: opts.moduleIds,
|
||||
moduleId: opts.moduleId
|
||||
});
|
||||
}
|
||||
|
||||
for (const key of Object.keys(babelOptions)) {
|
||||
if (babelOptions[key] === undefined) {
|
||||
delete babelOptions[key];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
babelOptions,
|
||||
cliOptions: {
|
||||
filename: opts.filename,
|
||||
filenames,
|
||||
extensions: opts.extensions,
|
||||
keepFileExtension: opts.keepFileExtension,
|
||||
outFileExtension: opts.outFileExtension,
|
||||
watch: opts.watch,
|
||||
skipInitialBuild: opts.skipInitialBuild,
|
||||
outFile: opts.outFile,
|
||||
outDir: opts.outDir,
|
||||
relative: opts.relative,
|
||||
copyFiles: opts.copyFiles,
|
||||
copyIgnored: opts.copyFiles && opts.copyIgnored,
|
||||
includeDotfiles: opts.includeDotfiles,
|
||||
verbose: opts.verbose,
|
||||
quiet: opts.quiet,
|
||||
deleteDirOnStart: opts.deleteDirOnStart,
|
||||
sourceMapTarget: opts.sourceMapTarget
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function booleanify(val) {
|
||||
if (val === "true" || val == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (val === "false" || val == 0 || !val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
function collect(value, previousValue) {
|
||||
if (typeof value !== "string") return previousValue;
|
||||
const values = value.split(",");
|
||||
|
||||
if (previousValue) {
|
||||
previousValue.push(...values);
|
||||
return previousValue;
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user