@novnc/novnc
Advanced tools
Comparing version 1.0.0-testing.2 to 1.0.0
@@ -7,4 +7,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
/*jslint white: false */ | ||
/*global console */ | ||
import * as Log from './util/logging.js'; | ||
@@ -51,3 +50,2 @@ export default { | ||
/* Convert Base64 data to a string */ | ||
/* jshint -W013 */ | ||
toBinaryTable : [ | ||
@@ -63,3 +61,2 @@ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, | ||
], | ||
/* jshint +W013 */ | ||
@@ -88,3 +85,3 @@ decode: function (data, offset) { | ||
if (c === -1) { | ||
console.error("Illegal character code " + data.charCodeAt(i) + " at position " + i); | ||
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i); | ||
continue; | ||
@@ -91,0 +88,0 @@ } |
@@ -78,4 +78,2 @@ /* | ||
/* jslint white: false */ | ||
export default function DES(passwd) { | ||
@@ -85,3 +83,2 @@ "use strict"; | ||
// Tables, permutations, S-boxes, etc. | ||
// jshint -W013 | ||
var PC2 = [13,16,10,23, 0, 4, 2,27,14, 5,20, 9,22,18,11, 3, | ||
@@ -94,3 +91,2 @@ 25, 7,15, 6,26,19,12, 1,40,51,30,36,46,54,29,39, | ||
// jshint -W015 | ||
a=1<<16; b=1<<24; c=a|b; d=1<<2; e=1<<10; f=d|e; | ||
@@ -136,3 +132,2 @@ 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|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]; | ||
// jshint +W013,+W015 | ||
@@ -139,0 +134,0 @@ // Set the key. |
@@ -10,11 +10,6 @@ /* | ||
/*jslint browser: true, white: false */ | ||
/*global Util, Base64, changeCursor */ | ||
import { browserSupportsCursorURIs as cursorURIsSupported } from './util/browsers.js'; | ||
import { set_defaults, make_properties } from './util/properties.js'; | ||
import * as Log from './util/logging.js'; | ||
import Base64 from "./base64.js"; | ||
export default function Display(defaults) { | ||
export default function Display(target) { | ||
this._drawCtx = null; | ||
@@ -36,12 +31,7 @@ this._c_forceCanvas = false; | ||
set_defaults(this, defaults, { | ||
'scale': 1.0, | ||
'viewport': false, | ||
'render_mode': '', | ||
"onFlush": function () {}, | ||
}); | ||
Log.Debug(">> Display.constructor"); | ||
// The visible canvas | ||
this._target = target; | ||
if (!this._target) { | ||
@@ -77,19 +67,7 @@ throw new Error("Target must be set"); | ||
// Check canvas features | ||
if ('createImageData' in this._drawCtx) { | ||
this._render_mode = 'canvas rendering'; | ||
} else { | ||
if (!('createImageData' in this._drawCtx)) { | ||
throw new Error("Canvas does not support createImageData"); | ||
} | ||
if (this._prefer_js === null) { | ||
Log.Info("Prefering javascript operations"); | ||
this._prefer_js = true; | ||
} | ||
// Determine browser support for setting the cursor via data URI scheme | ||
if (this._cursor_uri || this._cursor_uri === null || | ||
this._cursor_uri === undefined) { | ||
this._cursor_uri = cursorURIsSupported(); | ||
} | ||
this._tile16x16 = this._drawCtx.createImageData(16, 16); | ||
Log.Debug("<< Display.constructor"); | ||
@@ -107,3 +85,35 @@ }; | ||
Display.prototype = { | ||
// Public methods | ||
// ===== PROPERTIES ===== | ||
_scale: 1.0, | ||
get scale() { return this._scale; }, | ||
set scale(scale) { | ||
this._rescale(scale); | ||
}, | ||
_clipViewport: false, | ||
get clipViewport() { return this._clipViewport; }, | ||
set clipViewport(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); | ||
}, | ||
get width() { | ||
return this._fb_width; | ||
}, | ||
get height() { | ||
return this._fb_height; | ||
}, | ||
logo: null, | ||
// ===== EVENT HANDLERS ===== | ||
onflush: function () {}, // A flush request has finished | ||
// ===== PUBLIC METHODS ===== | ||
viewportChangePos: function (deltaX, deltaY) { | ||
@@ -114,3 +124,3 @@ var vp = this._viewportLoc; | ||
if (!this._viewport) { | ||
if (!this._clipViewport) { | ||
deltaX = -vp.w; // clamped later of out of bounds | ||
@@ -154,3 +164,3 @@ deltaY = -vp.h; | ||
if (!this._viewport || | ||
if (!this._clipViewport || | ||
typeof(width) === "undefined" || | ||
@@ -316,3 +326,3 @@ typeof(height) === "undefined") { | ||
if (this._renderQ.length === 0) { | ||
this._onFlush(); | ||
this.onflush(); | ||
} else { | ||
@@ -392,16 +402,12 @@ this._flushing = true; | ||
if (this._prefer_js) { | ||
var red = color[2]; | ||
var green = color[1]; | ||
var blue = color[0]; | ||
var red = color[2]; | ||
var green = color[1]; | ||
var blue = color[0]; | ||
var data = this._tile.data; | ||
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; | ||
} | ||
} else { | ||
this.fillRect(x, y, width, height, color, true); | ||
var data = this._tile.data; | ||
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; | ||
} | ||
@@ -412,22 +418,18 @@ }, | ||
subTile: function (x, y, w, h, color) { | ||
if (this._prefer_js) { | ||
var red = color[2]; | ||
var green = color[1]; | ||
var blue = color[0]; | ||
var xend = x + w; | ||
var yend = y + h; | ||
var red = color[2]; | ||
var green = color[1]; | ||
var blue = color[0]; | ||
var xend = x + w; | ||
var yend = y + h; | ||
var data = this._tile.data; | ||
var width = this._tile.width; | ||
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; | ||
} | ||
var data = this._tile.data; | ||
var width = this._tile.width; | ||
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; | ||
} | ||
} else { | ||
this.fillRect(this._tile_x + x, this._tile_y + y, w, h, color, true); | ||
} | ||
@@ -438,8 +440,5 @@ }, | ||
finishTile: function () { | ||
if (this._prefer_js) { | ||
this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y); | ||
this._damage(this._tile_x, this._tile_y, | ||
this._tile.width, this._tile.height); | ||
} | ||
// else: No-op -- already done by setSubTile | ||
this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y); | ||
this._damage(this._tile_x, this._tile_y, | ||
this._tile.width, this._tile.height); | ||
}, | ||
@@ -513,7 +512,2 @@ | ||
changeCursor: function (pixels, mask, hotx, hoty, w, h) { | ||
if (this._cursor_uri === false) { | ||
Log.Warn("changeCursor called but no cursor data URI support"); | ||
return; | ||
} | ||
Display.changeCursor(this._target, pixels, mask, hotx, hoty, w, h); | ||
@@ -530,29 +524,4 @@ }, | ||
clippingDisplay: function () { | ||
autoscale: function (containerWidth, containerHeight) { | ||
var vp = this._viewportLoc; | ||
return this._fb_width > vp.w || this._fb_height > vp.h; | ||
}, | ||
// Overridden getters/setters | ||
set_scale: function (scale) { | ||
this._rescale(scale); | ||
}, | ||
set_viewport: function (viewport) { | ||
this._viewport = viewport; | ||
// May need to readjust the viewport dimensions | ||
var vp = this._viewportLoc; | ||
this.viewportChangeSize(vp.w, vp.h); | ||
this.viewportChangePos(0, 0); | ||
}, | ||
get_width: function () { | ||
return this._fb_width; | ||
}, | ||
get_height: function () { | ||
return this._fb_height; | ||
}, | ||
autoscale: function (containerWidth, containerHeight, downscaleOnly) { | ||
var vp = this._viewportLoc; | ||
var targetAspectRatio = containerWidth / containerHeight; | ||
@@ -568,10 +537,7 @@ var fbAspectRatio = vp.w / vp.h; | ||
if (scaleRatio > 1.0 && downscaleOnly) { | ||
scaleRatio = 1.0; | ||
} | ||
this._rescale(scaleRatio); | ||
}, | ||
// Private Methods | ||
// ===== PRIVATE METHODS ===== | ||
_rescale: function (factor) { | ||
@@ -701,3 +667,3 @@ this._scale = factor; | ||
this._flushing = false; | ||
this._onFlush(); | ||
this.onflush(); | ||
} | ||
@@ -707,19 +673,2 @@ }, | ||
make_properties(Display, [ | ||
['target', 'wo', 'dom'], // Canvas element for rendering | ||
['context', 'ro', 'raw'], // Canvas 2D context for rendering (read-only) | ||
['logo', 'rw', 'raw'], // Logo to display when cleared: {"width": w, "height": h, "type": mime-type, "data": data} | ||
['scale', 'rw', 'float'], // Display area scale factor 0.0 - 1.0 | ||
['viewport', 'rw', 'bool'], // Use viewport clipping | ||
['width', 'ro', 'int'], // Display area width | ||
['height', 'ro', 'int'], // Display area height | ||
['render_mode', 'ro', 'str'], // Canvas rendering mode (read-only) | ||
['prefer_js', 'rw', 'str'], // Prefer Javascript over canvas methods | ||
['cursor_uri', 'rw', 'raw'], // Can we render cursor using data URI | ||
['onFlush', 'rw', 'func'], // onFlush(): A flush request has finished | ||
]); | ||
// Class Methods | ||
@@ -726,0 +675,0 @@ Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) { |
@@ -8,10 +8,7 @@ /* | ||
/*jslint browser: true, white: false */ | ||
/*global window, Util */ | ||
import * as Log from '../util/logging.js'; | ||
import { stopEvent } from '../util/events.js'; | ||
import { set_defaults, make_properties } from '../util/properties.js'; | ||
import * as KeyboardUtil from "./util.js"; | ||
import KeyTable from "./keysym.js"; | ||
import * as browser from "../util/browser.js"; | ||
@@ -22,3 +19,5 @@ // | ||
export default function Keyboard(defaults) { | ||
export default function Keyboard(target) { | ||
this._target = target || null; | ||
this._keyDownList = {}; // List of depressed keys | ||
@@ -28,7 +27,2 @@ // (even if they are happy) | ||
set_defaults(this, defaults, { | ||
'target': document, | ||
'focused': true | ||
}); | ||
// keep these here so we can refer to them later | ||
@@ -43,30 +37,11 @@ this._eventHandlers = { | ||
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 isIE() { | ||
return navigator && !!(/trident/i).exec(navigator.userAgent); | ||
} | ||
function isEdge() { | ||
return navigator && !!(/edge/i).exec(navigator.userAgent); | ||
} | ||
Keyboard.prototype = { | ||
// private methods | ||
// ===== EVENT HANDLERS ===== | ||
onkeyevent: function () {}, // Handler for key press/release | ||
// ===== PRIVATE METHODS ===== | ||
_sendKeyEvent: function (keysym, code, down) { | ||
if (!this._onKeyEvent) { | ||
return; | ||
} | ||
Log.Debug("onKeyEvent " + (down ? "down" : "up") + | ||
Log.Debug("onkeyevent " + (down ? "down" : "up") + | ||
", keysym: " + keysym, ", code: " + code); | ||
@@ -79,3 +54,3 @@ | ||
var fakeAltGraph = false; | ||
if (down && isWindows()) { | ||
if (down && browser.isWindows()) { | ||
if ((code !== 'ControlLeft') && | ||
@@ -86,5 +61,5 @@ (code !== 'AltRight') && | ||
fakeAltGraph = true; | ||
this._onKeyEvent(this._keyDownList['AltRight'], | ||
this.onkeyevent(this._keyDownList['AltRight'], | ||
'AltRight', false); | ||
this._onKeyEvent(this._keyDownList['ControlLeft'], | ||
this.onkeyevent(this._keyDownList['ControlLeft'], | ||
'ControlLeft', false); | ||
@@ -94,8 +69,8 @@ } | ||
this._onKeyEvent(keysym, code, down); | ||
this.onkeyevent(keysym, code, down); | ||
if (fakeAltGraph) { | ||
this._onKeyEvent(this._keyDownList['ControlLeft'], | ||
this.onkeyevent(this._keyDownList['ControlLeft'], | ||
'ControlLeft', true); | ||
this._onKeyEvent(this._keyDownList['AltRight'], | ||
this.onkeyevent(this._keyDownList['AltRight'], | ||
'AltRight', true); | ||
@@ -141,4 +116,2 @@ } | ||
_handleKeyDown: function (e) { | ||
if (!this._focused) { return; } | ||
var code = this._getKeyCode(e); | ||
@@ -151,3 +124,3 @@ var keysym = KeyboardUtil.getKeysym(e); | ||
// special treat that platform here) | ||
if ((code === 'Unidentified') || isIOS()) { | ||
if ((code === 'Unidentified') || browser.isIOS()) { | ||
if (keysym) { | ||
@@ -169,3 +142,3 @@ // If it's a virtual keyboard then it should be | ||
// possibly others). | ||
if (isMac()) { | ||
if (browser.isMac()) { | ||
switch (keysym) { | ||
@@ -197,3 +170,3 @@ case KeyTable.XK_Super_L: | ||
// it was a quick press and release of the button. | ||
if (isMac() && (code === 'CapsLock')) { | ||
if (browser.isMac() && (code === 'CapsLock')) { | ||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true); | ||
@@ -209,3 +182,3 @@ this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false); | ||
// just check for the presence of that field) | ||
if (!keysym && (!e.key || isIE() || isEdge())) { | ||
if (!keysym && (!e.key || browser.isIE() || browser.isEdge())) { | ||
this._pendingKey = code; | ||
@@ -229,4 +202,2 @@ // However we might not get a keypress event if the key | ||
_handleKeyPress: function (e) { | ||
if (!this._focused) { return; } | ||
stopEvent(e); | ||
@@ -251,3 +222,3 @@ | ||
if (!keysym) { | ||
console.log('keypress with no keysym:', e); | ||
Log.Info('keypress with no keysym:', e); | ||
return; | ||
@@ -261,4 +232,2 @@ } | ||
_handleKeyPressTimeout: function (e) { | ||
if (!this._focused) { return; } | ||
// Did someone manage to sort out the key already? | ||
@@ -300,4 +269,2 @@ if (this._pendingKey === null) { | ||
_handleKeyUp: function (e) { | ||
if (!this._focused) { return; } | ||
stopEvent(e); | ||
@@ -308,3 +275,3 @@ | ||
// See comment in _handleKeyDown() | ||
if (isMac() && (code === 'CapsLock')) { | ||
if (browser.isMac() && (code === 'CapsLock')) { | ||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true); | ||
@@ -334,3 +301,3 @@ this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false); | ||
// Public methods | ||
// ===== PUBLIC METHODS ===== | ||
@@ -366,8 +333,1 @@ grab: function () { | ||
}; | ||
make_properties(Keyboard, [ | ||
['target', 'wo', 'dom'], // DOM element that captures keyboard input | ||
['focused', 'rw', 'bool'], // Capture and send key events | ||
['onKeyEvent', 'rw', 'func'] // Handler for key press/release | ||
]); |
@@ -8,9 +8,5 @@ /* | ||
/*jslint browser: true, white: false */ | ||
/*global window, Util */ | ||
import * as Log from '../util/logging.js'; | ||
import { isTouchDevice } from '../util/browsers.js'; | ||
import { isTouchDevice } from '../util/browser.js'; | ||
import { setCapture, stopEvent, getPointerEvent } from '../util/events.js'; | ||
import { set_defaults, make_properties } from '../util/properties.js'; | ||
@@ -21,3 +17,4 @@ var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step | ||
export default function Mouse(defaults) { | ||
export default function Mouse(target) { | ||
this._target = target || document; | ||
@@ -33,9 +30,2 @@ this._doubleClickTimer = null; | ||
// Configuration attributes | ||
set_defaults(this, defaults, { | ||
'target': document, | ||
'focused': true, | ||
'touchButton': 1 | ||
}); | ||
this._eventHandlers = { | ||
@@ -51,4 +41,13 @@ 'mousedown': this._handleMouseDown.bind(this), | ||
Mouse.prototype = { | ||
// private methods | ||
// ===== PROPERTIES ===== | ||
touchButton: 1, // Button mask (1, 2, 4) for touch devices (0 means ignore clicks) | ||
// ===== EVENT HANDLERS ===== | ||
onmousebutton: function () {}, // Handler for mouse button click/release | ||
onmousemove: function () {}, // Handler for mouse movement | ||
// ===== PRIVATE METHODS ===== | ||
_resetDoubleClickTimer: function () { | ||
@@ -59,4 +58,2 @@ this._doubleClickTimer = null; | ||
_handleMouseButton: function (e, down) { | ||
if (!this._focused) { return; } | ||
this._updateMousePosition(e); | ||
@@ -94,3 +91,3 @@ var pos = this._pos; | ||
} | ||
bmask = this._touchButton; | ||
bmask = this.touchButton; | ||
// If bmask is set | ||
@@ -107,7 +104,6 @@ } else if (e.which) { | ||
if (this._onMouseButton) { | ||
Log.Debug("onMouseButton " + (down ? "down" : "up") + | ||
", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask); | ||
this._onMouseButton(pos.x, pos.y, down, bmask); | ||
} | ||
Log.Debug("onmousebutton " + (down ? "down" : "up") + | ||
", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask); | ||
this.onmousebutton(pos.x, pos.y, down, bmask); | ||
stopEvent(e); | ||
@@ -135,7 +131,7 @@ }, | ||
if (this._accumulatedWheelDeltaX < 0) { | ||
this._onMouseButton(this._pos.x, this._pos.y, 1, 1 << 5); | ||
this._onMouseButton(this._pos.x, this._pos.y, 0, 1 << 5); | ||
this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 5); | ||
this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 5); | ||
} else if (this._accumulatedWheelDeltaX > 0) { | ||
this._onMouseButton(this._pos.x, this._pos.y, 1, 1 << 6); | ||
this._onMouseButton(this._pos.x, this._pos.y, 0, 1 << 6); | ||
this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 6); | ||
this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 6); | ||
} | ||
@@ -149,7 +145,7 @@ | ||
if (this._accumulatedWheelDeltaY < 0) { | ||
this._onMouseButton(this._pos.x, this._pos.y, 1, 1 << 3); | ||
this._onMouseButton(this._pos.x, this._pos.y, 0, 1 << 3); | ||
this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 3); | ||
this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 3); | ||
} else if (this._accumulatedWheelDeltaY > 0) { | ||
this._onMouseButton(this._pos.x, this._pos.y, 1, 1 << 4); | ||
this._onMouseButton(this._pos.x, this._pos.y, 0, 1 << 4); | ||
this.onmousebutton(this._pos.x, this._pos.y, 1, 1 << 4); | ||
this.onmousebutton(this._pos.x, this._pos.y, 0, 1 << 4); | ||
} | ||
@@ -168,4 +164,2 @@ | ||
_handleMouseWheel: function (e) { | ||
if (!this._focused || !this._onMouseButton) { return; } | ||
this._resetWheelStepTimers(); | ||
@@ -214,8 +208,4 @@ | ||
_handleMouseMove: function (e) { | ||
if (! this._focused) { return; } | ||
this._updateMousePosition(e); | ||
if (this._onMouseMove) { | ||
this._onMouseMove(this._pos.x, this._pos.y); | ||
} | ||
this.onmousemove(this._pos.x, this._pos.y); | ||
stopEvent(e); | ||
@@ -225,4 +215,2 @@ }, | ||
_handleMouseDisable: function (e) { | ||
if (!this._focused) { return; } | ||
/* | ||
@@ -262,3 +250,4 @@ * Stop propagation if inside canvas area | ||
// Public methods | ||
// ===== PUBLIC METHODS ===== | ||
grab: function () { | ||
@@ -305,10 +294,1 @@ var c = this._target; | ||
}; | ||
make_properties(Mouse, [ | ||
['target', 'ro', 'dom'], // DOM element that captures mouse input | ||
['focused', 'rw', 'bool'], // Capture and send mouse clicks/movement | ||
['onMouseButton', 'rw', 'func'], // Handler for mouse button click/release | ||
['onMouseMove', 'rw', 'func'], // Handler for mouse movement | ||
['touchButton', 'rw', 'int'] // Button mask (1, 2, 4) for touch devices (0 means ignore clicks) | ||
]); |
@@ -6,13 +6,4 @@ import KeyTable from "./keysym.js"; | ||
import DOMKeyTable from "./domkeytable.js"; | ||
import * as browser from "../util/browser.js"; | ||
function isMac() { | ||
return navigator && !!(/mac/i).exec(navigator.platform); | ||
} | ||
function isIE() { | ||
return navigator && !!(/trident/i).exec(navigator.userAgent); | ||
} | ||
function isEdge() { | ||
return navigator && !!(/edge/i).exec(navigator.userAgent); | ||
} | ||
// Get 'KeyboardEvent.code', handling legacy browsers | ||
@@ -41,3 +32,3 @@ export function getKeycode(evt){ | ||
// macOS has messed up this code for some reason | ||
if (isMac() && (code === 'ContextMenu')) { | ||
if (browser.isMac() && (code === 'ContextMenu')) { | ||
code = 'MetaRight'; | ||
@@ -119,3 +110,3 @@ } | ||
// trust them for printable characters | ||
if ((evt.key.length !== 1) || (!isIE() && !isEdge())) { | ||
if ((evt.key.length !== 1) || (!browser.isIE() && !browser.isEdge())) { | ||
return evt.key; | ||
@@ -122,0 +113,0 @@ } |
@@ -13,4 +13,2 @@ /* | ||
import * as Log from './logging.js'; | ||
export function getPointerEvent (e) { | ||
@@ -17,0 +15,0 @@ return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e; |
@@ -29,3 +29,2 @@ /* | ||
if (typeof window.console !== "undefined") { | ||
/* jshint -W086 */ | ||
switch (level) { | ||
@@ -45,3 +44,2 @@ case 'debug': | ||
} | ||
/* jshint +W086 */ | ||
} | ||
@@ -48,0 +46,0 @@ }; |
@@ -17,5 +17,2 @@ /* | ||
/*jslint browser: true, bitwise: true */ | ||
/*global Util*/ | ||
export default function Websock() { | ||
@@ -172,6 +169,2 @@ "use strict"; | ||
flush: function () { | ||
if (this._websocket.bufferedAmount !== 0) { | ||
Log.Debug("bufferedAmount: " + this._websocket.bufferedAmount); | ||
} | ||
if (this._sQlen > 0 && this._websocket.readyState === WebSocket.OPEN) { | ||
@@ -311,44 +304,16 @@ this._websocket.send(this._encode_message()); | ||
_recv_message: function (e) { | ||
try { | ||
this._decode_message(e.data); | ||
if (this.rQlen() > 0) { | ||
this._eventHandlers.message(); | ||
// Compact the receive queue | ||
if (this._rQlen == this._rQi) { | ||
this._rQlen = 0; | ||
this._rQi = 0; | ||
} else if (this._rQlen > this._rQmax) { | ||
this._expand_compact_rQ(); | ||
} | ||
} else { | ||
Log.Debug("Ignoring empty message"); | ||
this._decode_message(e.data); | ||
if (this.rQlen() > 0) { | ||
this._eventHandlers.message(); | ||
// Compact the receive queue | ||
if (this._rQlen == this._rQi) { | ||
this._rQlen = 0; | ||
this._rQi = 0; | ||
} else if (this._rQlen > this._rQmax) { | ||
this._expand_compact_rQ(); | ||
} | ||
} catch (exc) { | ||
var exception_str = ""; | ||
if (exc.name) { | ||
exception_str += "\n name: " + exc.name + "\n"; | ||
exception_str += " message: " + exc.message + "\n"; | ||
} | ||
if (typeof exc.description !== 'undefined') { | ||
exception_str += " description: " + exc.description + "\n"; | ||
} | ||
if (typeof exc.stack !== 'undefined') { | ||
exception_str += exc.stack; | ||
} | ||
if (exception_str.length > 0) { | ||
Log.Error("recv_message, caught exception: " + exception_str); | ||
} else { | ||
Log.Error("recv_message, caught exception: " + exc); | ||
} | ||
if (typeof exc.name !== 'undefined') { | ||
this._eventHandlers.error(exc.name + ": " + exc.message); | ||
} else { | ||
this._eventHandlers.error(exc); | ||
} | ||
} else { | ||
Log.Debug("Ignoring empty message"); | ||
} | ||
} | ||
}; |
@@ -44,4 +44,6 @@ noVNC is Copyright (C) 2011 Joel Martin <github@martintribe.org> | ||
vendor/browser-es-module-loader: MIT | ||
vendor/browser-es-module-loader/src/ : MIT | ||
vendor/browser-es-module-loader/dist/ : Various BSD style licenses | ||
vendor/promise.js : MIT | ||
@@ -56,9 +58,5 @@ | ||
docs/LICENSE.MPL-2.0 | ||
docs/LICENSE.LGPL-3 and | ||
docs/LICENSE.GPL-3 | ||
docs/LICENSE.OFL-1.1 | ||
docs/LICENSE.BSD-3-Clause (New BSD) | ||
docs/LICENSE.BSD-2-Clause (Simplified BSD / FreeBSD) | ||
docs/LICENSE.zlib | ||
docs/LICENSE.Apache-2.0 | ||
vendor/pako/LICENSE (MIT) | ||
@@ -69,8 +67,4 @@ | ||
http://www.mozilla.org/MPL/2.0/ | ||
http://www.gnu.org/licenses/lgpl.html and | ||
http://www.gnu.org/licenses/gpl.html | ||
http://scripts.sil.org/OFL | ||
http://en.wikipedia.org/wiki/BSD_licenses | ||
http://www.gzip.org/zlib/zlib_license.html | ||
http://www.apache.org/licenses/LICENSE-2.0.html | ||
https://opensource.org/licenses/MIT |
{ | ||
"name": "@novnc/novnc", | ||
"version": "1.0.0-testing.2", | ||
"version": "1.0.0", | ||
"description": "An HTML5 VNC client", | ||
@@ -5,0 +5,0 @@ "directories": { |
116
README.md
@@ -1,2 +0,2 @@ | ||
## noVNC: HTML5 VNC Client | ||
## noVNC: HTML VNC Client Library and Application | ||
@@ -7,7 +7,7 @@ [![Build Status](https://travis-ci.org/novnc/noVNC.svg?branch=master)](https://travis-ci.org/novnc/noVNC) | ||
noVNC is a HTML5 VNC client that runs well in any modern browser including | ||
mobile browsers (iOS and Android). | ||
noVNC is both a HTML VNC client JavaScript library and an application built on | ||
top of that library. noVNC runs well in any modern browser including mobile | ||
browsers (iOS and Android). | ||
Many companies, projects and products have integrated noVNC including | ||
[Ganeti Web Manager](http://code.osuosl.org/projects/ganeti-webmgr), | ||
[OpenStack](http://www.openstack.org), | ||
@@ -20,16 +20,34 @@ [OpenNebula](http://opennebula.org/), | ||
### Table of Contents | ||
- [News/help/contact](#newshelpcontact) | ||
- [Features](#features) | ||
- [Screenshots](#screenshots) | ||
- [Browser Requirements](#browser-requirements) | ||
- [Server Requirements](#server-requirements) | ||
- [Quick Start](#quick-start) | ||
- [Integration and Deployment](#integration-and-deployment) | ||
- [Authors/Contributors](#authorscontributors) | ||
### News/help/contact | ||
The project website is found at [novnc.com](http://novnc.com). | ||
Notable commits, announcements and news are posted to | ||
<a href="http://www.twitter.com/noVNC">@noVNC</a>. | ||
[@noVNC](http://www.twitter.com/noVNC). | ||
If you are a noVNC developer/integrator/user (or want to be) please join the | ||
<a href="https://groups.google.com/forum/?fromgroups#!forum/novnc"> | ||
noVNC discussion group</a>. | ||
[noVNC discussion group](https://groups.google.com/forum/?fromgroups#!forum/novnc). | ||
Bugs and feature requests can be submitted via | ||
[github issues](https://github.com/novnc/noVNC/issues). | ||
[github issues](https://github.com/novnc/noVNC/issues). If you have questions | ||
about using noVNC then please first use the | ||
[discussion group](https://groups.google.com/forum/?fromgroups#!forum/novnc). | ||
We also have a [wiki](https://github.com/novnc/noVNC/wiki/) with lots of | ||
helpful information. | ||
If you are looking for a place to start contributing to noVNC, a good place to | ||
start would be the issues that are marked as | ||
["patchwelcome"](https://github.com/novnc/noVNC/issues?labels=patchwelcome). | ||
Please check our | ||
[contribution guide](https://github.com/novnc/noVNC/wiki/Contributing) though. | ||
@@ -44,3 +62,3 @@ If you want to show appreciation for noVNC you could donate to a great non- | ||
[Nothing But Nets](http://www.nothingbutnets.net/), etc. | ||
Please tweet <a href="http://www.twitter.com/noVNC">@noVNC</a> if you do. | ||
Please tweet [@noVNC](http://www.twitter.com/noVNC) if you do. | ||
@@ -52,10 +70,7 @@ | ||
* Supported VNC encodings: raw, copyrect, rre, hextile, tight, tightPNG | ||
* WebSocket SSL/TLS encryption (i.e. "wss://") support | ||
* 24-bit true color and 8 bit colour mapped | ||
* Supports desktop resize notification/pseudo-encoding | ||
* Local or remote cursor | ||
* Supports scaling, clipping and resizing the desktop | ||
* Local cursor rendering | ||
* Clipboard copy/paste | ||
* Clipping or scolling modes for large remote screens | ||
* Easy site integration and theming (3 example themes included) | ||
* Licensed under the [MPL 2.0](http://www.mozilla.org/MPL/2.0/) | ||
* Licensed mainly under the [MPL 2.0](http://www.mozilla.org/MPL/2.0/), see | ||
[the license document](LICENSE.txt) for details | ||
@@ -70,3 +85,3 @@ ### Screenshots | ||
See more screenshots | ||
<a href="http://novnc.com/screenshots.html">here</a>. | ||
[here](http://novnc.com/screenshots.html). | ||
@@ -76,21 +91,19 @@ | ||
* Chrome 8, Firefox 4, Safari 6, Opera 12, IE 11, Edge 12, etc. | ||
noVNC uses many modern web technologies so a formal requirement list is | ||
not available. However these are the minimum versions we are currently | ||
aware of: | ||
* HTML5 Canvas, WebSockets and Typed Arrays | ||
* Chrome 49, Firefox 44, Safari 10, Opera 36, IE 11, Edge 12 | ||
* Fast Javascript Engine: this is not strictly a requirement, but without a | ||
fast Javascript engine, noVNC might be painfully slow. | ||
* See the more detailed | ||
[browser compatibility wiki page](https://github.com/novnc/noVNC/wiki/Browser-support). | ||
### Server Requirements | ||
Unless you are using a VNC server with support for WebSockets connections (such | ||
as [x11vnc/libvncserver](http://libvncserver.sourceforge.net/), | ||
[QEMU](http://www.qemu.org/), or | ||
[MobileVNC](http://www.smartlab.at/mobilevnc/)), you need to use a | ||
WebSockets to TCP socket proxy. There is a python proxy included | ||
('websockify'). | ||
noVNC follows the standard VNC protocol, but unlike other VNC clients it does | ||
require WebSockets support. Many servers include support (e.g. | ||
[x11vnc/libvncserver](http://libvncserver.sourceforge.net/), | ||
[QEMU](http://www.qemu.org/), and | ||
[MobileVNC](http://www.smartlab.at/mobilevnc/)), but for the others you need to | ||
use a WebSockets to TCP socket proxy. noVNC has a sister project | ||
[websockify](https://github.com/novnc/websockify) that provides a simple such | ||
proxy. | ||
@@ -100,5 +113,5 @@ | ||
* Use the launch script to start a mini-webserver and the WebSockets proxy | ||
(websockify). The `--vnc` option is used to specify the location of a running | ||
VNC server: | ||
* Use the launch script to automatically download and start websockify, which | ||
includes a mini-webserver and the WebSockets proxy. The `--vnc` option is | ||
used to specify the location of a running VNC server: | ||
@@ -108,31 +121,15 @@ `./utils/launch.sh --vnc localhost:5901` | ||
* Point your browser to the cut-and-paste URL that is output by the launch | ||
script. Enter a password if the VNC server has one configured. Hit the | ||
Connect button and enjoy! | ||
script. Hit the Connect button, enter a password if the VNC server has one | ||
configured, and enjoy! | ||
### Other Pages | ||
### Integration and Deployment | ||
* [Modules/API](https://github.com/novnc/noVNC/wiki/Modules-API) - The library | ||
modules and their Javascript API. | ||
Please see our other documents for how to integrate noVNC in your own software, | ||
or deploying the noVNC application in production environments: | ||
* [Integration](https://github.com/novnc/noVNC/wiki/Integration) - Get noVNC | ||
to work in existing projects. | ||
* [Embedding](docs/EMBEDDING.md) - For the noVNC application | ||
* [Library](docs/LIBRARY.md) - For the noVNC JavaScript library | ||
* [Troubleshooting](https://github.com/novnc/noVNC/wiki/Troubleshooting) - How | ||
to troubleshoot problems. | ||
* [Encrypted Connections](https://github.com/novnc/websockify/wiki/Encrypted-Connections) - | ||
Setup websockify so that you can use encrypted connections from noVNC. | ||
* [Advanced Usage](https://github.com/novnc/noVNC/wiki/Advanced-usage) - | ||
Generating an SSL certificate, starting a VNC server, advanced websockify | ||
usage, etc. | ||
* [Testing](https://github.com/novnc/noVNC/wiki/Testing) - Run and write | ||
tests. | ||
* [Translations](https://github.com/novnc/noVNC/wiki/Translations) - Add and | ||
modify localization for JavaScript and HTML. | ||
### Authors/Contributors | ||
@@ -153,3 +150,2 @@ | ||
* Included libraries: | ||
* as3crypto : Henri Torgemane (code.google.com/p/as3crypto) | ||
* base64 : Martijn Pieters (Digital Creations 2), Samuel Sieb (sieb.net) | ||
@@ -159,2 +155,4 @@ * DES : Dave Zimmerman (Widget Workshop), Jef Poskanzer (ACME Labs) | ||
* [Contribution guide](https://github.com/novnc/noVNC/wiki/Contributing) | ||
Do you want to be on this list? Check out our | ||
[contribution guide](https://github.com/novnc/noVNC/wiki/Contributing) and | ||
start hacking! |
@@ -283,3 +283,3 @@ import * as utils from "../utils/common.js"; | ||
do { | ||
/*jshint noempty:false*/ | ||
// Do nothing | ||
} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && | ||
@@ -896,3 +896,3 @@ _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && | ||
do { | ||
/*jshint noempty:false*/ | ||
// Do nothing | ||
} while (prev === _win[++scan] && prev === _win[++scan] && | ||
@@ -899,0 +899,0 @@ prev === _win[++scan] && prev === _win[++scan] && |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
0
500054
48
11027
149