1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

novnc ES6 compatibility is not working. I reverse it. Spice/VNC sending ctrl+alt+fn functionality restored.

This commit is contained in:
catborise 2018-08-27 15:30:50 +03:00
parent f73271e677
commit 76e6388ec5
53 changed files with 19018 additions and 17438 deletions

View file

@ -66,30 +66,30 @@
<div class="collapse navbar-collapse"> <div class="collapse navbar-collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Send key(s) <span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">{% trans "Send key(s)" %} <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu"> <ul class="dropdown-menu" role="menu">
<li onclick='sendCtrlAltDel();'><a href='#'>Ctrl+Alt+Del</a></li> <li id="ctrlaltdel"><a href='#'>Ctrl+Alt+Del</a></li>
<li class="divider"></li> <li class="divider"></li>
<li onclick='sendCtrlAltFN(0);'><a href='#'>Ctrl+Alt+F1</a></li> <li id="ctrlaltf1"><a href='#'>Ctrl+Alt+F1</a></li>
<li onclick='sendCtrlAltFN(1);'><a href='#'>Ctrl+Alt+F2</a></li> <li id="ctrlaltf2"><a href='#'>Ctrl+Alt+F2</a></li>
<li onclick='sendCtrlAltFN(2);'><a href='#'>Ctrl+Alt+F3</a></li> <li id="ctrlaltf3"><a href='#'>Ctrl+Alt+F3</a></li>
<li onclick='sendCtrlAltFN(3);'><a href='#'>Ctrl+Alt+F4</a></li> <li id="ctrlaltf4"><a href='#'>Ctrl+Alt+F4</a></li>
<li onclick='sendCtrlAltFN(4);'><a href='#'>Ctrl+Alt+F5</a></li> <li id="ctrlaltf5"><a href='#'>Ctrl+Alt+F5</a></li>
<li onclick='sendCtrlAltFN(5);'><a href='#'>Ctrl+Alt+F6</a></li> <li id="ctrlaltf6"><a href='#'>Ctrl+Alt+F6</a></li>
<li onclick='sendCtrlAltFN(6);'><a href='#'>Ctrl+Alt+F7</a></li> <li id="ctrlaltf7"><a href='#'>Ctrl+Alt+F7</a></li>
<li onclick='sendCtrlAltFN(7);'><a href='#'>Ctrl+Alt+F8</a></li> <li id="ctrlaltf8"><a href='#'>Ctrl+Alt+F8</a></li>
<li onclick='sendCtrlAltFN(8);'><a href='#'>Ctrl+Alt+F9</a></li> <li id="ctrlaltf9"><a href='#'>Ctrl+Alt+F9</a></li>
<li onclick='sendCtrlAltFN(9);'><a href='#'>Ctrl+Alt+F10</a></li> <li id="ctrlaltf10"><a href='#'>Ctrl+Alt+F10</a></li>
<li onclick='sendCtrlAltFN(10);'><a href='#'>Ctrl+Alt+F11</a></li> <li id="ctrlaltf11"><a href='#'>Ctrl+Alt+F11</a></li>
<li onclick='sendCtrlAltFN(11);'><a href='#'>Ctrl+Alt+F12</a></li> <li id="ctrlaltf12"><a href='#'>Ctrl+Alt+F12</a></li>
</ul> </ul>
</li> </li>
<li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li> <li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li>
{% block navbarmenu %}{% endblock %} {% block navbarmenu %}{% endblock %}
</ul> </ul>
</div> </div>
</div> </div>
</nav> /nav>
<div id='main_container' class="container"> <div id='main_container' class="container">
{% block content %}{% endblock %} {% block content %}{% endblock %}
</div> </div>

View file

@ -188,31 +188,7 @@
resize_helper(sc); resize_helper(sc);
} }
function sendCtrlAltFN(f) { function fullscreen() {
if (sc && sc.inputs && sc.inputs.state === "ready"){
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
if (keys_code[f]==undefined) {
return;
}
var key = new SpiceMsgcKeyDown();
var msg = new SpiceMiniData();
update_modifier(true, KEY_LCtrl, sc);
update_modifier(true, KEY_Alt, sc);
key.code = keys_code[f];
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
sc.inputs.send_msg(msg);
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
sc.inputs.send_msg(msg);
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
}
}
function fullscreen() {
var screen=document.getElementById('spice-screen?'); var screen=document.getElementById('spice-screen?');
if(screen.requestFullscreen) { if(screen.requestFullscreen) {
screen.requestFullscreen(); screen.requestFullscreen();
@ -236,7 +212,19 @@
}); });
*/ */
document.getElementById("fullscreen_button").addEventListener('click', fullscreen); document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
connect(); connect();
</script> </script>
{% endblock %} {% endblock %}

View file

@ -210,30 +210,6 @@
} }
} }
function sendCtrlAltFN(f) {
if (sc && sc.inputs && sc.inputs.state === "ready"){
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
if (keys_code[f]==undefined) {
return;
}
var key = new SpiceMsgcKeyDown();
var msg = new SpiceMiniData();
update_modifier(true, KEY_LCtrl, sc);
update_modifier(true, KEY_Alt, sc);
key.code = keys_code[f];
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
sc.inputs.send_msg(msg);
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
sc.inputs.send_msg(msg);
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
}
}
function fullscreen() { function fullscreen() {
var screen=document.getElementById('spice-screen'); var screen=document.getElementById('spice-screen');
if(screen.requestFullscreen) { if(screen.requestFullscreen) {
@ -259,6 +235,19 @@
}); });
*/ */
document.getElementById("fullscreen_button").addEventListener('click', fullscreen); document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
connect(); connect();
</script> </script>
{% endblock %} {% endblock %}

View file

@ -16,7 +16,7 @@
or the fragment: or the fragment:
http://example.com/#host=HOST&port=PORT&encrypt=1 http://example.com/#host=HOST&port=PORT&encrypt=1
--> -->
<title xmlns="http://www.w3.org/1999/html">WebVirtCloud - noVNC</title> <title>WebVirtCloud - noVNC</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
@ -65,12 +65,26 @@
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script> <script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
<!-- begin scripts --> <!-- begin scripts -->
<script src="{% static "js/novnc/app.js" %}"></script> <!-- promise polyfills promises for IE11 -->
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
<!-- ES2015/ES6 modules polyfill -->
<script type="module">
window._noVNC_has_module_support = true;
</script>
<script>
window.addEventListener("load", function() {
if (window._noVNC_has_module_support) return;
var loader = document.createElement("script");
loader.src = "{% static "js/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js" %}";
document.head.appendChild(loader);
});
</script>
<!-- actual script modules -->
<script type="module" crossorigin="anonymous" src="{% static "js/novnc/app/ui.js" %}"></script>
<!-- end scripts --> <!-- end scripts -->
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="noVNC_fallback_error" class="noVNC_center"> <div id="noVNC_fallback_error" class="noVNC_center">
<div> <div>
<div>noVNC encountered an error:</div> <div>noVNC encountered an error:</div>
@ -217,7 +231,7 @@
<li> <li>
<label><input id="noVNC_setting_encrypt" type="checkbox" /> Encrypt</label> <label><input id="noVNC_setting_encrypt" type="checkbox" /> Encrypt</label>
</li> </li>
<li> <li>
<label for="noVNC_setting_host">Host:</label> <label for="noVNC_setting_host">Host:</label>
<input id="noVNC_setting_host" value="{{ ws_host }}"/> <input id="noVNC_setting_host" value="{{ ws_host }}"/>
</li> </li>
@ -274,9 +288,7 @@
<div id="noVNC_connect_dlg"> <div id="noVNC_connect_dlg">
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div> <div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
<div id="noVNC_connect_button"> <div id="noVNC_connect_button">
<div> <div><img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect</div>
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
</div>
</div> </div>
</div> </div>
</div> </div>
@ -320,4 +332,4 @@
<source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg"> <source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg">
<source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg"> <source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg">
</audio> </audio>
{% endblock %} {% endblock %}

View file

@ -63,9 +63,7 @@
<!-- promise polyfills promises for IE11 --> <!-- promise polyfills promises for IE11 -->
<script src="{% static "js/novnc/vendor/promise.js" %}"></script> <script src="{% static "js/novnc/vendor/promise.js" %}"></script>
<!-- ES2015/ES6 modules polyfill --> <!-- ES2015/ES6 modules polyfill -->
<script type="module"> <script type="module"> window._noVNC_has_module_support = false;</script>
window._noVNC_has_module_support = true;
</script>
<script> <script>
window.addEventListener("load", function() { window.addEventListener("load", function() {
if (window._noVNC_has_module_support) return; if (window._noVNC_has_module_support) return;
@ -76,6 +74,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="noVNC_status_bar"> <div id="noVNC_status_bar">
@ -92,9 +91,7 @@
</div> </div>
<div id='vnc_container'></div> <div id='vnc_container'></div>
{% endblock %}
{% block foot %}
<!-- actual script modules --> <!-- actual script modules -->
<script type="module" crossorigin="anonymous"> <script type="module" crossorigin="anonymous">
// Load supporting scripts // Load supporting scripts
@ -125,17 +122,38 @@
rfb.sendCredentials({ password: document.getElementById('password_input').value }); rfb.sendCredentials({ password: document.getElementById('password_input').value });
return false; return false;
} }
function sendCtrlAltFN(f) {
var keys_code=[0xFFBE,0xFFBF,0xFFC0,0xFFC1,0xFFC2,0xFFC3,0xFFC4,0xFFC5,0xFFC6,0xFFC7,0xFFC8,0xFFC9]; function fullscreen() {
if (keys_code[f]==undefined) { if (document.fullscreenElement || // alternative standard method
return; document.mozFullScreenElement || // currently working methods
document.webkitFullscreenElement ||
document.msFullscreenElement) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
} else {
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
} else if (document.body.msRequestFullscreen) {
document.body.msRequestFullscreen();
}
} }
rfb.sendKey(0xFFE3, 'down'); return false;
rfb.sendKey(0xFFE9, 'down'); }
rfb.sendKey(keys_code[f], 'down');
rfb.sendKey(keys_code[f], 'up'); function sendCtrlAltFN(f) {
rfb.sendKey(0xFFE9, 'up'); rfb.sendCtrlAltFN(f);
rfb.sendKey(0xFFE3, 'up'); return false;
} }
function sendCtrlAltDel() { function sendCtrlAltDel() {
rfb.sendCtrlAltDel(); rfb.sendCtrlAltDel();
@ -199,6 +217,21 @@
document.getElementById('machineShutdownButton').onclick = machineShutdown; document.getElementById('machineShutdownButton').onclick = machineShutdown;
document.getElementById('machineRebootButton').onclick = machineReboot; document.getElementById('machineRebootButton').onclick = machineReboot;
document.getElementById('machineResetButton').onclick = machineReset; document.getElementById('machineResetButton').onclick = machineReset;
document.getElementById('fullscreen_button').onclick = fullscreen;
document.getElementById('ctrlaltdel').addEventListener('click', sendCtrlAltDel);
document.getElementById('ctrlaltf1').addEventListener('click', function(){sendCtrlAltFN(0);});
document.getElementById('ctrlaltf2').addEventListener('click', function(){sendCtrlAltFN(1);});
document.getElementById('ctrlaltf3').addEventListener('click', function(){sendCtrlAltFN(2);});
document.getElementById('ctrlaltf4').addEventListener('click', function(){sendCtrlAltFN(3);});
document.getElementById('ctrlaltf5').addEventListener('click', function(){sendCtrlAltFN(4);});
document.getElementById('ctrlaltf6').addEventListener('click', function(){sendCtrlAltFN(5);});
document.getElementById('ctrlaltf7').addEventListener('click', function(){sendCtrlAltFN(6);});
document.getElementById('ctrlaltf8').addEventListener('click', function(){sendCtrlAltFN(7);});
document.getElementById('ctrlaltf9').addEventListener('click', function(){sendCtrlAltFN(8);});
document.getElementById('ctrlaltf10').addEventListener('click', function(){sendCtrlAltFN(9);});
document.getElementById('ctrlaltf11').addEventListener('click', function(){sendCtrlAltFN(10);});
document.getElementById('ctrlaltf12').addEventListener('click', function(){sendCtrlAltFN(11);});
WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn')); WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
document.title = WebUtil.getConfigVar('title', 'noVNC'); document.title = WebUtil.getConfigVar('title', 'noVNC');
@ -275,4 +308,6 @@
rfb.resizeSession = WebUtil.getConfigVar('resize', false); rfb.resizeSession = WebUtil.getConfigVar('resize', false);
})(); })();
</script> </script>
{% endblock %}
{% endblock %}

View file

@ -111,7 +111,7 @@
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC/Spice Console" %}">
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </button>
{% endifequal %} {% endifequal %}

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,3 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Localizer = Localizer;
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -16,7 +10,7 @@ exports.Localizer = Localizer;
* Localization Utilities * Localization Utilities
*/ */
function Localizer() { export function Localizer() {
// Currently configured language // Currently configured language
this.language = 'en'; this.language = 'en';
@ -41,40 +35,45 @@ Localizer.prototype = {
userLanguages = [navigator.language || navigator.userLanguage]; userLanguages = [navigator.language || navigator.userLanguage];
} }
for (var i = 0; i < userLanguages.length; i++) { for (var i = 0;i < userLanguages.length;i++) {
var userLang = userLanguages[i]; var userLang = userLanguages[i];
userLang = userLang.toLowerCase(); userLang = userLang.toLowerCase();
userLang = userLang.replace("_", "-"); userLang = userLang.replace("_", "-");
userLang = userLang.split("-"); userLang = userLang.split("-");
// Built-in default? // Built-in default?
if (userLang[0] === 'en' && (userLang[1] === undefined || userLang[1] === 'us')) { if ((userLang[0] === 'en') &&
((userLang[1] === undefined) || (userLang[1] === 'us'))) {
return; return;
} }
// First pass: perfect match // First pass: perfect match
for (var j = 0; j < supportedLanguages.length; j++) { for (var j = 0;j < supportedLanguages.length;j++) {
var supLang = supportedLanguages[j]; var supLang = supportedLanguages[j];
supLang = supLang.toLowerCase(); supLang = supLang.toLowerCase();
supLang = supLang.replace("_", "-"); supLang = supLang.replace("_", "-");
supLang = supLang.split("-"); supLang = supLang.split("-");
if (userLang[0] !== supLang[0]) continue; if (userLang[0] !== supLang[0])
if (userLang[1] !== supLang[1]) continue; continue;
if (userLang[1] !== supLang[1])
continue;
this.language = supportedLanguages[j]; this.language = supportedLanguages[j];
return; return;
} }
// Second pass: fallback // Second pass: fallback
for (var j = 0; j < supportedLanguages.length; j++) { for (var j = 0;j < supportedLanguages.length;j++) {
supLang = supportedLanguages[j]; supLang = supportedLanguages[j];
supLang = supLang.toLowerCase(); supLang = supLang.toLowerCase();
supLang = supLang.replace("_", "-"); supLang = supLang.replace("_", "-");
supLang = supLang.split("-"); supLang = supLang.split("-");
if (userLang[0] !== supLang[0]) continue; if (userLang[0] !== supLang[0])
if (supLang[1] !== undefined) continue; continue;
if (supLang[1] !== undefined)
continue;
this.language = supportedLanguages[j]; this.language = supportedLanguages[j];
return; return;
@ -121,31 +120,39 @@ Localizer.prototype = {
} }
if (enabled) { if (enabled) {
if (elem.hasAttribute("abbr") && elem.tagName === "TH") { if (elem.hasAttribute("abbr") &&
elem.tagName === "TH") {
translateAttribute(elem, "abbr"); translateAttribute(elem, "abbr");
} }
if (elem.hasAttribute("alt") && isAnyOf(elem.tagName, ["AREA", "IMG", "INPUT"])) { if (elem.hasAttribute("alt") &&
isAnyOf(elem.tagName, ["AREA", "IMG", "INPUT"])) {
translateAttribute(elem, "alt"); translateAttribute(elem, "alt");
} }
if (elem.hasAttribute("download") && isAnyOf(elem.tagName, ["A", "AREA"])) { if (elem.hasAttribute("download") &&
isAnyOf(elem.tagName, ["A", "AREA"])) {
translateAttribute(elem, "download"); translateAttribute(elem, "download");
} }
if (elem.hasAttribute("label") && isAnyOf(elem.tagName, ["MENUITEM", "MENU", "OPTGROUP", "OPTION", "TRACK"])) { if (elem.hasAttribute("label") &&
isAnyOf(elem.tagName, ["MENUITEM", "MENU", "OPTGROUP",
"OPTION", "TRACK"])) {
translateAttribute(elem, "label"); translateAttribute(elem, "label");
} }
// FIXME: Should update "lang" // FIXME: Should update "lang"
if (elem.hasAttribute("placeholder") && isAnyOf(elem.tagName, ["INPUT", "TEXTAREA"])) { if (elem.hasAttribute("placeholder") &&
isAnyOf(elem.tagName, ["INPUT", "TEXTAREA"])) {
translateAttribute(elem, "placeholder"); translateAttribute(elem, "placeholder");
} }
if (elem.hasAttribute("title")) { if (elem.hasAttribute("title")) {
translateAttribute(elem, "title"); translateAttribute(elem, "title");
} }
if (elem.hasAttribute("value") && elem.tagName === "INPUT" && isAnyOf(elem.getAttribute("type"), ["reset", "button", "submit"])) { if (elem.hasAttribute("value") &&
elem.tagName === "INPUT" &&
isAnyOf(elem.getAttribute("type"), ["reset", "button", "submit"])) {
translateAttribute(elem, "value"); translateAttribute(elem, "value");
} }
} }
for (var i = 0; i < elem.childNodes.length; i++) { for (var i = 0;i < elem.childNodes.length;i++) {
var node = elem.childNodes[i]; var node = elem.childNodes[i];
if (node.nodeType === node.ELEMENT_NODE) { if (node.nodeType === node.ELEMENT_NODE) {
process(node, enabled); process(node, enabled);
@ -156,8 +163,8 @@ Localizer.prototype = {
} }
process(document.body, true); process(document.body, true);
} },
}; };
var l10n = exports.l10n = new Localizer(); export var l10n = new Localizer();
exports.default = l10n.get.bind(l10n); export default l10n.get.bind(l10n);

File diff suppressed because it is too large Load diff

View file

@ -1,54 +1,31 @@
"use strict"; /*
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 NTT corp.
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* See README.md for usage and integration instructions.
*/
Object.defineProperty(exports, "__esModule", { import { init_logging as main_init_logging } from '../core/util/logging.js';
value: true
});
exports.init_logging = init_logging;
exports.getQueryVar = getQueryVar;
exports.getHashVar = getHashVar;
exports.getConfigVar = getConfigVar;
exports.createCookie = createCookie;
exports.readCookie = readCookie;
exports.eraseCookie = eraseCookie;
exports.initSettings = initSettings;
exports.writeSetting = writeSetting;
exports.readSetting = readSetting;
exports.eraseSetting = eraseSetting;
exports.injectParamIfMissing = injectParamIfMissing;
exports.fetchJSON = fetchJSON;
var _logging = require("../core/util/logging.js");
// init log level reading the logging HTTP param // init log level reading the logging HTTP param
function init_logging(level) { export function init_logging (level) {
"use strict"; "use strict";
if (typeof level !== "undefined") { if (typeof level !== "undefined") {
(0, _logging.init_logging)(level); main_init_logging(level);
} else { } else {
var param = document.location.href.match(/logging=([A-Za-z0-9\._\-]*)/); var param = document.location.href.match(/logging=([A-Za-z0-9\._\-]*)/);
(0, _logging.init_logging)(param || undefined); main_init_logging(param || undefined);
} }
} /* };
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 NTT corp.
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* See README.md for usage and integration instructions.
*/
;
// Read a query string variable // Read a query string variable
function getQueryVar(name, defVal) { export function getQueryVar (name, defVal) {
"use strict"; "use strict";
var re = new RegExp('.*[?&]' + name + '=([^&#]*)'), var re = new RegExp('.*[?&]' + name + '=([^&#]*)'),
match = document.location.href.match(re); match = document.location.href.match(re);
if (typeof defVal === 'undefined') { if (typeof defVal === 'undefined') { defVal = null; }
defVal = null;
}
if (match) { if (match) {
return decodeURIComponent(match[1]); return decodeURIComponent(match[1]);
} else { } else {
@ -57,14 +34,11 @@ function getQueryVar(name, defVal) {
}; };
// Read a hash fragment variable // Read a hash fragment variable
function getHashVar(name, defVal) { export function getHashVar (name, defVal) {
"use strict"; "use strict";
var re = new RegExp('.*[&#]' + name + '=([^&]*)'), var re = new RegExp('.*[&#]' + name + '=([^&]*)'),
match = document.location.hash.match(re); match = document.location.hash.match(re);
if (typeof defVal === 'undefined') { if (typeof defVal === 'undefined') { defVal = null; }
defVal = null;
}
if (match) { if (match) {
return decodeURIComponent(match[1]); return decodeURIComponent(match[1]);
} else { } else {
@ -74,9 +48,8 @@ function getHashVar(name, defVal) {
// Read a variable from the fragment or the query string // Read a variable from the fragment or the query string
// Fragment takes precedence // Fragment takes precedence
function getConfigVar(name, defVal) { export function getConfigVar (name, defVal) {
"use strict"; "use strict";
var val = getHashVar(name); var val = getHashVar(name);
if (val === null) { if (val === null) {
val = getQueryVar(name, defVal); val = getQueryVar(name, defVal);
@ -89,13 +62,12 @@ function getConfigVar(name, defVal) {
*/ */
// No days means only for this browser session // No days means only for this browser session
function createCookie(name, value, days) { export function createCookie (name, value, days) {
"use strict"; "use strict";
var date, expires; var date, expires;
if (days) { if (days) {
date = new Date(); date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toGMTString(); expires = "; expires=" + date.toGMTString();
} else { } else {
expires = ""; expires = "";
@ -110,27 +82,21 @@ function createCookie(name, value, days) {
document.cookie = name + "=" + value + expires + "; path=/" + secure; document.cookie = name + "=" + value + expires + "; path=/" + secure;
}; };
function readCookie(name, defaultValue) { export function readCookie (name, defaultValue) {
"use strict"; "use strict";
var nameEQ = name + "=", var nameEQ = name + "=",
ca = document.cookie.split(';'); ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i += 1) { for (var i = 0; i < ca.length; i += 1) {
var c = ca[i]; var c = ca[i];
while (c.charAt(0) === ' ') { while (c.charAt(0) === ' ') { c = c.substring(1, c.length); }
c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length, c.length); }
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length, c.length);
}
} }
return typeof defaultValue !== 'undefined' ? defaultValue : null; return (typeof defaultValue !== 'undefined') ? defaultValue : null;
}; };
function eraseCookie(name) { export function eraseCookie (name) {
"use strict"; "use strict";
createCookie(name, "", -1); createCookie(name, "", -1);
}; };
@ -140,9 +106,8 @@ function eraseCookie(name) {
var settings = {}; var settings = {};
function initSettings(callback /*, ...callbackArgs */) { export function initSettings (callback /*, ...callbackArgs */) {
"use strict"; "use strict";
var callbackArgs = Array.prototype.slice.call(arguments, 1); var callbackArgs = Array.prototype.slice.call(arguments, 1);
if (window.chrome && window.chrome.storage) { if (window.chrome && window.chrome.storage) {
window.chrome.storage.sync.get(function (cfg) { window.chrome.storage.sync.get(function (cfg) {
@ -160,9 +125,8 @@ function initSettings(callback /*, ...callbackArgs */) {
}; };
// No days means only for this browser session // No days means only for this browser session
function writeSetting(name, value) { export function writeSetting (name, value) {
"use strict"; "use strict";
if (window.chrome && window.chrome.storage) { if (window.chrome && window.chrome.storage) {
if (settings[name] !== value) { if (settings[name] !== value) {
settings[name] = value; settings[name] = value;
@ -173,9 +137,8 @@ function writeSetting(name, value) {
} }
}; };
function readSetting(name, defaultValue) { export function readSetting (name, defaultValue) {
"use strict"; "use strict";
var value; var value;
if (window.chrome && window.chrome.storage) { if (window.chrome && window.chrome.storage) {
value = settings[name]; value = settings[name];
@ -192,9 +155,8 @@ function readSetting(name, defaultValue) {
} }
}; };
function eraseSetting(name) { export function eraseSetting (name) {
"use strict"; "use strict";
if (window.chrome && window.chrome.storage) { if (window.chrome && window.chrome.storage) {
window.chrome.storage.sync.remove(name); window.chrome.storage.sync.remove(name);
delete settings[name]; delete settings[name];
@ -203,7 +165,7 @@ function eraseSetting(name) {
} }
}; };
function injectParamIfMissing(path, param, value) { export function injectParamIfMissing (path, param, value) {
// force pretend that we're dealing with a relative path // force pretend that we're dealing with a relative path
// (assume that we wanted an extra if we pass one in) // (assume that we wanted an extra if we pass one in)
path = "/" + path; path = "/" + path;
@ -219,9 +181,7 @@ function injectParamIfMissing(path, param, value) {
query = []; query = [];
} }
if (!query.some(function (v) { if (!query.some(function (v) { return v.startsWith(param_eq); })) {
return v.startsWith(param_eq);
})) {
query.push(param_eq + encodeURIComponent(value)); query.push(param_eq + encodeURIComponent(value));
elem.search = "?" + query.join("&"); elem.search = "?" + query.join("&");
} }
@ -239,7 +199,7 @@ function injectParamIfMissing(path, param, value) {
// IE11 support or polyfill promises and fetch in IE11. // IE11 support or polyfill promises and fetch in IE11.
// resolve will receive an object on success, while reject // resolve will receive an object on success, while reject
// will receive either an event or an error on failure. // will receive either an event or an error on failure.
function fetchJSON(path, resolve, reject) { export function fetchJSON(path, resolve, reject) {
// NB: IE11 doesn't support JSON as a responseType // NB: IE11 doesn't support JSON as a responseType
var req = new XMLHttpRequest(); var req = new XMLHttpRequest();
req.open('GET', path); req.open('GET', path);
@ -267,4 +227,4 @@ function fetchJSON(path, resolve, reject) {
}; };
req.send(); req.send();
} }

View file

@ -1,30 +1,25 @@
'use strict'; /* 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/. */
Object.defineProperty(exports, "__esModule", { // From: http://hg.mozilla.org/mozilla-central/raw-file/ec10630b1a54/js/src/devtools/jint/sunspider/string-base64.js
value: true
});
var _logging = require('./util/logging.js'); import * as Log from './util/logging.js';
var Log = _interopRequireWildcard(_logging); export default {
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
exports.default = {
/* Convert data (an array of integers) to a Base64 string. */ /* Convert data (an array of integers) to a Base64 string. */
toBase64Table: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''), toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
base64Pad: '=', base64Pad : '=',
encode: function (data) { encode: function (data) {
"use strict"; "use strict";
var result = ''; var result = '';
var toBase64Table = this.toBase64Table; var toBase64Table = this.toBase64Table;
var length = data.length; var length = data.length;
var lengthpad = length % 3; var lengthpad = (length % 3);
// Convert every three bytes to 4 ascii characters. // Convert every three bytes to 4 ascii characters.
for (var i = 0; i < length - 2; i += 3) { for (var i = 0; i < (length - 2); i += 3) {
result += toBase64Table[data[i] >> 2]; result += toBase64Table[data[i] >> 2];
result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)]; result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)]; result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
@ -51,12 +46,20 @@ exports.default = {
}, },
/* Convert Base64 data to a string */ /* Convert Base64 data to a string */
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], 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
],
decode: function (data, offset) { decode: function (data, offset) {
"use strict"; "use strict";
offset = typeof(offset) !== 'undefined' ? offset : 0;
offset = typeof offset !== 'undefined' ? offset : 0;
var toBinaryTable = this.toBinaryTable; var toBinaryTable = this.toBinaryTable;
var base64Pad = this.base64Pad; var base64Pad = this.base64Pad;
var result, result_length; var result, result_length;
@ -64,18 +67,16 @@ exports.default = {
var leftdata = 0; // bits decoded, but yet to be appended var leftdata = 0; // bits decoded, but yet to be appended
var data_length = data.indexOf('=') - offset; var data_length = data.indexOf('=') - offset;
if (data_length < 0) { if (data_length < 0) { data_length = data.length - offset; }
data_length = data.length - offset;
}
/* Every four characters is 3 resulting numbers */ /* Every four characters is 3 resulting numbers */
result_length = (data_length >> 2) * 3 + Math.floor(data_length % 4 / 1.5); result_length = (data_length >> 2) * 3 + Math.floor((data_length % 4) / 1.5);
result = new Array(result_length); result = new Array(result_length);
// Convert one by one. // Convert one by one.
for (var idx = 0, i = offset; i < data.length; i++) { for (var idx = 0, i = offset; i < data.length; i++) {
var c = toBinaryTable[data.charCodeAt(i) & 0x7f]; var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
var padding = data.charAt(i) === base64Pad; var padding = (data.charAt(i) === base64Pad);
// Skip illegal characters and whitespace // Skip illegal characters and whitespace
if (c === -1) { if (c === -1) {
Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i); Log.Error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
@ -83,7 +84,7 @@ exports.default = {
} }
// Collect data into leftdata, update bitcount // Collect data into leftdata, update bitcount
leftdata = leftdata << 6 | c; leftdata = (leftdata << 6) | c;
leftbits += 6; leftbits += 6;
// If we have 8 or more bits, append 8 bits to the result // If we have 8 or more bits, append 8 bits to the result
@ -91,7 +92,7 @@ exports.default = {
leftbits -= 8; leftbits -= 8;
// Append if not padding. // Append if not padding.
if (!padding) { if (!padding) {
result[idx++] = leftdata >> leftbits & 0xff; result[idx++] = (leftdata >> leftbits) & 0xff;
} }
leftdata &= (1 << leftbits) - 1; leftdata &= (1 << leftbits) - 1;
} }
@ -107,8 +108,3 @@ exports.default = {
return result; return result;
} }
}; /* End of Base64 namespace */ }; /* End of Base64 namespace */
/* 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

View file

@ -1,9 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = DES;
/* /*
* Ported from Flashlight VNC ActionScript implementation: * Ported from Flashlight VNC ActionScript implementation:
* http://www.wizhelp.com/flashlight-vnc/ * http://www.wizhelp.com/flashlight-vnc/
@ -81,67 +75,67 @@ exports.default = DES;
* fine Java utilities: http://www.acme.com/java/ * fine Java utilities: http://www.acme.com/java/
*/ */
function DES(passwd) { export default function DES(passwd) {
"use strict"; "use strict";
// Tables, permutations, S-boxes, etc. // Tables, permutations, S-boxes, etc.
var PC2 = [13,16,10,23, 0, 4, 2,27,14, 5,20, 9,22,18,11, 3,
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], 25, 7,15, 6,26,19,12, 1,40,51,30,36,46,54,29,39,
totrot = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], 50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31 ],
z = 0x0, totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28],
a, z = 0x0, a,b,c,d,e,f, SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8,
b,
c,
d,
e,
f,
SP1,
SP2,
SP3,
SP4,
SP5,
SP6,
SP7,
SP8,
keys = []; keys = [];
a = 1 << 16;b = 1 << 24;c = a | b;d = 1 << 2;e = 1 << 10;f = d | e; a=1<<16; b=1<<24; c=a|b; d=1<<2; e=1<<10; f=d|e;
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]; 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,
a = 1 << 20;b = 1 << 31;c = a | b;d = 1 << 5;e = 1 << 15;f = d | e; 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,
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|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,
a = 1 << 17;b = 1 << 27;c = a | b;d = 1 << 3;e = 1 << 9;f = d | e; 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];
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<<20; b=1<<31; c=a|b; d=1<<5; e=1<<15; f=d|e;
a = 1 << 13;b = 1 << 23;c = a | b;d = 1 << 0;e = 1 << 7;f = d | e; 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,
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|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,
a = 1 << 25;b = 1 << 30;c = a | b;d = 1 << 8;e = 1 << 19;f = d | e; 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,
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]; 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 << 22;b = 1 << 29;c = a | b;d = 1 << 4;e = 1 << 14;f = d | e; a=1<<17; b=1<<27; c=a|b; d=1<<3; e=1<<9; f=d|e;
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]; 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,
a = 1 << 21;b = 1 << 26;c = a | b;d = 1 << 1;e = 1 << 11;f = d | e; 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,
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]; 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,
a = 1 << 18;b = 1 << 28;c = a | b;d = 1 << 6;e = 1 << 12;f = d | e; 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];
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]; a=1<<13; b=1<<23; c=a|b; d=1<<0; e=1<<7; f=d|e;
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;
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;
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;
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;
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];
// Set the key. // Set the key.
function setKeys(keyBlock) { function setKeys(keyBlock) {
var i, var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [],
j, raw0, raw1, rawi, KnLi;
l,
m,
n,
o,
pc1m = [],
pcr = [],
kn = [],
raw0,
raw1,
rawi,
KnLi;
for (j = 0, l = 56; j < 56; ++j, l -= 8) { for (j = 0, l = 56; j < 56; ++j, l -= 8) {
l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1 l += l < -5 ? 65 : l < -3 ? 31 : l < -1 ? 63 : l === 27 ? 35 : 0; // PC1
m = l & 0x7; m = l & 0x7;
pc1m[j] = (keyBlock[l >>> 3] & 1 << m) !== 0 ? 1 : 0; pc1m[j] = ((keyBlock[l >>> 3] & (1<<m)) !== 0) ? 1: 0;
} }
for (i = 0; i < 16; ++i) { for (i = 0; i < 16; ++i) {
@ -160,10 +154,10 @@ function DES(passwd) {
} }
for (j = 0; j < 24; ++j) { for (j = 0; j < 24; ++j) {
if (pcr[PC2[j]] !== 0) { if (pcr[PC2[j]] !== 0) {
kn[m] |= 1 << 23 - j; kn[m] |= 1 << (23 - j);
} }
if (pcr[PC2[j + 24]] !== 0) { if (pcr[PC2[j + 24]] !== 0) {
kn[n] |= 1 << 23 - j; kn[n] |= 1 << (23 - j);
} }
} }
} }
@ -180,95 +174,88 @@ function DES(passwd) {
keys[KnLi] = (raw0 & 0x0003f000) << 12; keys[KnLi] = (raw0 & 0x0003f000) << 12;
keys[KnLi] |= (raw0 & 0x0000003f) << 16; keys[KnLi] |= (raw0 & 0x0000003f) << 16;
keys[KnLi] |= (raw1 & 0x0003f000) >>> 4; keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
keys[KnLi] |= raw1 & 0x0000003f; keys[KnLi] |= (raw1 & 0x0000003f);
++KnLi; ++KnLi;
} }
} }
// Encrypt 8 bytes of text // Encrypt 8 bytes of text
function enc8(text) { function enc8(text) {
var i = 0, var i = 0, b = text.slice(), fval, keysi = 0,
b = text.slice(), l, r, x; // left, right, accumulator
fval,
keysi = 0,
l,
r,
x; // left, right, accumulator
// Squash 8 bytes to 2 ints // Squash 8 bytes to 2 ints
l = b[i++] << 24 | b[i++] << 16 | b[i++] << 8 | b[i++]; l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
r = 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; x = ((l >>> 4) ^ r) & 0x0f0f0f0f;
r ^= x; r ^= x;
l ^= x << 4; l ^= (x << 4);
x = (l >>> 16 ^ r) & 0x0000ffff; x = ((l >>> 16) ^ r) & 0x0000ffff;
r ^= x; r ^= x;
l ^= x << 16; l ^= (x << 16);
x = (r >>> 2 ^ l) & 0x33333333; x = ((r >>> 2) ^ l) & 0x33333333;
l ^= x; l ^= x;
r ^= x << 2; r ^= (x << 2);
x = (r >>> 8 ^ l) & 0x00ff00ff; x = ((r >>> 8) ^ l) & 0x00ff00ff;
l ^= x; l ^= x;
r ^= x << 8; r ^= (x << 8);
r = r << 1 | r >>> 31 & 1; r = (r << 1) | ((r >>> 31) & 1);
x = (l ^ r) & 0xaaaaaaaa; x = (l ^ r) & 0xaaaaaaaa;
l ^= x; l ^= x;
r ^= x; r ^= x;
l = l << 1 | l >>> 31 & 1; l = (l << 1) | ((l >>> 31) & 1);
for (i = 0; i < 8; ++i) { for (i = 0; i < 8; ++i) {
x = r << 28 | r >>> 4; x = (r << 28) | (r >>> 4);
x ^= keys[keysi++]; x ^= keys[keysi++];
fval = SP7[x & 0x3f]; fval = SP7[x & 0x3f];
fval |= SP5[x >>> 8 & 0x3f]; fval |= SP5[(x >>> 8) & 0x3f];
fval |= SP3[x >>> 16 & 0x3f]; fval |= SP3[(x >>> 16) & 0x3f];
fval |= SP1[x >>> 24 & 0x3f]; fval |= SP1[(x >>> 24) & 0x3f];
x = r ^ keys[keysi++]; x = r ^ keys[keysi++];
fval |= SP8[x & 0x3f]; fval |= SP8[x & 0x3f];
fval |= SP6[x >>> 8 & 0x3f]; fval |= SP6[(x >>> 8) & 0x3f];
fval |= SP4[x >>> 16 & 0x3f]; fval |= SP4[(x >>> 16) & 0x3f];
fval |= SP2[x >>> 24 & 0x3f]; fval |= SP2[(x >>> 24) & 0x3f];
l ^= fval; l ^= fval;
x = l << 28 | l >>> 4; x = (l << 28) | (l >>> 4);
x ^= keys[keysi++]; x ^= keys[keysi++];
fval = SP7[x & 0x3f]; fval = SP7[x & 0x3f];
fval |= SP5[x >>> 8 & 0x3f]; fval |= SP5[(x >>> 8) & 0x3f];
fval |= SP3[x >>> 16 & 0x3f]; fval |= SP3[(x >>> 16) & 0x3f];
fval |= SP1[x >>> 24 & 0x3f]; fval |= SP1[(x >>> 24) & 0x3f];
x = l ^ keys[keysi++]; x = l ^ keys[keysi++];
fval |= SP8[x & 0x0000003f]; fval |= SP8[x & 0x0000003f];
fval |= SP6[x >>> 8 & 0x3f]; fval |= SP6[(x >>> 8) & 0x3f];
fval |= SP4[x >>> 16 & 0x3f]; fval |= SP4[(x >>> 16) & 0x3f];
fval |= SP2[x >>> 24 & 0x3f]; fval |= SP2[(x >>> 24) & 0x3f];
r ^= fval; r ^= fval;
} }
r = r << 31 | r >>> 1; r = (r << 31) | (r >>> 1);
x = (l ^ r) & 0xaaaaaaaa; x = (l ^ r) & 0xaaaaaaaa;
l ^= x; l ^= x;
r ^= x; r ^= x;
l = l << 31 | l >>> 1; l = (l << 31) | (l >>> 1);
x = (l >>> 8 ^ r) & 0x00ff00ff; x = ((l >>> 8) ^ r) & 0x00ff00ff;
r ^= x; r ^= x;
l ^= x << 8; l ^= (x << 8);
x = (l >>> 2 ^ r) & 0x33333333; x = ((l >>> 2) ^ r) & 0x33333333;
r ^= x; r ^= x;
l ^= x << 2; l ^= (x << 2);
x = (r >>> 16 ^ l) & 0x0000ffff; x = ((r >>> 16) ^ l) & 0x0000ffff;
l ^= x; l ^= x;
r ^= x << 16; r ^= (x << 16);
x = (r >>> 4 ^ l) & 0x0f0f0f0f; x = ((r >>> 4) ^ l) & 0x0f0f0f0f;
l ^= x; l ^= x;
r ^= x << 4; r ^= (x << 4);
// Spread ints to bytes // Spread ints to bytes
x = [r, l]; x = [r, l];
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
b[i] = (x[i >>> 2] >>> 8 * (3 - i % 4)) % 256; b[i] = (x[i>>>2] >>> (8 * (3 - (i % 4)))) % 256;
if (b[i] < 0) { if (b[i] < 0) { b[i] += 256; } // unsigned
b[i] += 256;
} // unsigned
} }
return b; return b;
} }
@ -278,6 +265,7 @@ function DES(passwd) {
return enc8(t.slice(0, 8)).concat(enc8(t.slice(8, 16))); return enc8(t.slice(0, 8)).concat(enc8(t.slice(8, 16)));
} }
setKeys(passwd); // Setup keys setKeys(passwd); // Setup keys
return { 'encrypt': encrypt }; // Public interface return {'encrypt': encrypt}; // Public interface
}; // function DES
}; // function DES

View file

@ -1,22 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Display;
var _logging = require("./util/logging.js");
var Log = _interopRequireWildcard(_logging);
var _base = require("./base64.js");
var _base2 = _interopRequireDefault(_base);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -26,11 +7,14 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj;
* See README.md for usage and integration instructions. * See README.md for usage and integration instructions.
*/ */
function Display(target) { import * as Log from './util/logging.js';
import Base64 from "./base64.js";
export default function Display(target) {
this._drawCtx = null; this._drawCtx = null;
this._c_forceCanvas = false; this._c_forceCanvas = false;
this._renderQ = []; // queue drawing actions for in-oder rendering this._renderQ = []; // queue drawing actions for in-oder rendering
this._flushing = false; this._flushing = false;
// the full frame buffer (logical canvas) size // the full frame buffer (logical canvas) size
@ -69,9 +53,9 @@ function Display(target) {
this._backbuffer = document.createElement('canvas'); this._backbuffer = document.createElement('canvas');
this._drawCtx = this._backbuffer.getContext('2d'); this._drawCtx = this._backbuffer.getContext('2d');
this._damageBounds = { left: 0, top: 0, this._damageBounds = { left:0, top:0,
right: this._backbuffer.width, right: this._backbuffer.width,
bottom: this._backbuffer.height }; bottom: this._backbuffer.height };
Log.Debug("User Agent: " + navigator.userAgent); Log.Debug("User Agent: " + navigator.userAgent);
@ -98,17 +82,13 @@ Display.prototype = {
// ===== PROPERTIES ===== // ===== PROPERTIES =====
_scale: 1.0, _scale: 1.0,
get scale() { get scale() { return this._scale; },
return this._scale;
},
set scale(scale) { set scale(scale) {
this._rescale(scale); this._rescale(scale);
}, },
_clipViewport: false, _clipViewport: false,
get clipViewport() { get clipViewport() { return this._clipViewport; },
return this._clipViewport;
},
set clipViewport(viewport) { set clipViewport(viewport) {
this._clipViewport = viewport; this._clipViewport = viewport;
// May need to readjust the viewport dimensions // May need to readjust the viewport dimensions
@ -128,7 +108,7 @@ Display.prototype = {
// ===== EVENT HANDLERS ===== // ===== EVENT HANDLERS =====
onflush: function () {}, // A flush request has finished onflush: function () {}, // A flush request has finished
// ===== PUBLIC METHODS ===== // ===== PUBLIC METHODS =====
@ -138,7 +118,7 @@ Display.prototype = {
deltaY = Math.floor(deltaY); deltaY = Math.floor(deltaY);
if (!this._clipViewport) { if (!this._clipViewport) {
deltaX = -vp.w; // clamped later of out of bounds deltaX = -vp.w; // clamped later of out of bounds
deltaY = -vp.h; deltaY = -vp.h;
} }
@ -158,7 +138,7 @@ Display.prototype = {
deltaY = -vp.y; deltaY = -vp.y;
} }
if (vy2 + deltaY >= this._fb_height) { if (vy2 + deltaY >= this._fb_height) {
deltaY -= vy2 + deltaY - this._fb_height + 1; deltaY -= (vy2 + deltaY - this._fb_height + 1);
} }
if (deltaX === 0 && deltaY === 0) { if (deltaX === 0 && deltaY === 0) {
@ -174,9 +154,11 @@ Display.prototype = {
this.flip(); this.flip();
}, },
viewportChangeSize: function (width, height) { viewportChangeSize: function(width, height) {
if (!this._clipViewport || typeof width === "undefined" || typeof height === "undefined") { if (!this._clipViewport ||
typeof(width) === "undefined" ||
typeof(height) === "undefined") {
Log.Debug("Setting viewport to full display region"); Log.Debug("Setting viewport to full display region");
width = this._fb_width; width = this._fb_width;
@ -253,24 +235,24 @@ Display.prototype = {
}, },
// Track what parts of the visible canvas that need updating // Track what parts of the visible canvas that need updating
_damage: function (x, y, w, h) { _damage: function(x, y, w, h) {
if (x < this._damageBounds.left) { if (x < this._damageBounds.left) {
this._damageBounds.left = x; this._damageBounds.left = x;
} }
if (y < this._damageBounds.top) { if (y < this._damageBounds.top) {
this._damageBounds.top = y; this._damageBounds.top = y;
} }
if (x + w > this._damageBounds.right) { if ((x + w) > this._damageBounds.right) {
this._damageBounds.right = x + w; this._damageBounds.right = x + w;
} }
if (y + h > this._damageBounds.bottom) { if ((y + h) > this._damageBounds.bottom) {
this._damageBounds.bottom = y + h; this._damageBounds.bottom = y + h;
} }
}, },
// Update the visible canvas with the contents of the // Update the visible canvas with the contents of the
// rendering canvas // rendering canvas
flip: function (from_queue) { flip: function(from_queue) {
if (this._renderQ.length !== 0 && !from_queue) { if (this._renderQ.length !== 0 && !from_queue) {
this._renderQ_push({ this._renderQ_push({
'type': 'flip' 'type': 'flip'
@ -297,18 +279,20 @@ Display.prototype = {
vy = 0; vy = 0;
} }
if (vx + w > this._viewportLoc.w) { if ((vx + w) > this._viewportLoc.w) {
w = this._viewportLoc.w - vx; w = this._viewportLoc.w - vx;
} }
if (vy + h > this._viewportLoc.h) { if ((vy + h) > this._viewportLoc.h) {
h = this._viewportLoc.h - vy; h = this._viewportLoc.h - vy;
} }
if (w > 0 && h > 0) { if ((w > 0) && (h > 0)) {
// FIXME: We may need to disable image smoothing here // FIXME: We may need to disable image smoothing here
// as well (see copyImage()), but we haven't // as well (see copyImage()), but we haven't
// noticed any problem yet. // noticed any problem yet.
this._targetCtx.drawImage(this._backbuffer, x, y, w, h, vx, vy, w, h); this._targetCtx.drawImage(this._backbuffer,
x, y, w, h,
vx, vy, w, h);
} }
this._damageBounds.left = this._damageBounds.top = 65535; this._damageBounds.left = this._damageBounds.top = 65535;
@ -327,11 +311,11 @@ Display.prototype = {
this.flip(); this.flip();
}, },
pending: function () { pending: function() {
return this._renderQ.length > 0; return this._renderQ.length > 0;
}, },
flush: function () { flush: function() {
if (this._renderQ.length === 0) { if (this._renderQ.length === 0) {
this.onflush(); this.onflush();
} else { } else {
@ -365,7 +349,7 @@ Display.prototype = {
'x': new_x, 'x': new_x,
'y': new_y, 'y': new_y,
'width': w, 'width': w,
'height': h 'height': h,
}); });
} else { } else {
// Due to this bug among others [1] we need to disable the image-smoothing to // Due to this bug among others [1] we need to disable the image-smoothing to
@ -380,14 +364,16 @@ Display.prototype = {
this._drawCtx.msImageSmoothingEnabled = false; this._drawCtx.msImageSmoothingEnabled = false;
this._drawCtx.imageSmoothingEnabled = false; this._drawCtx.imageSmoothingEnabled = false;
this._drawCtx.drawImage(this._backbuffer, old_x, old_y, w, h, new_x, new_y, w, h); this._drawCtx.drawImage(this._backbuffer,
old_x, old_y, w, h,
new_x, new_y, w, h);
this._damage(new_x, new_y, w, h); this._damage(new_x, new_y, w, h);
} }
}, },
imageRect: function (x, y, mime, arr) { imageRect: function(x, y, mime, arr) {
var img = new Image(); var img = new Image();
img.src = "data: " + mime + ";base64," + _base2.default.encode(arr); img.src = "data: " + mime + ";base64," + Base64.encode(arr);
this._renderQ_push({ this._renderQ_push({
'type': 'img', 'type': 'img',
'img': img, 'img': img,
@ -431,7 +417,7 @@ Display.prototype = {
var width = this._tile.width; var width = this._tile.width;
for (var j = y; j < yend; j++) { for (var j = y; j < yend; j++) {
for (var i = x; i < xend; i++) { for (var i = x; i < xend; i++) {
var p = (i + j * width) * 4; var p = (i + (j * width)) * 4;
data[p] = red; data[p] = red;
data[p + 1] = green; data[p + 1] = green;
data[p + 2] = blue; data[p + 2] = blue;
@ -443,7 +429,8 @@ Display.prototype = {
// draw the current tile to the screen // draw the current tile to the screen
finishTile: function () { finishTile: function () {
this._drawCtx.putImageData(this._tile, this._tile_x, this._tile_y); 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); this._damage(this._tile_x, this._tile_y,
this._tile.width, this._tile.height);
}, },
blitImage: function (x, y, width, height, arr, offset, from_queue) { blitImage: function (x, y, width, height, arr, offset, from_queue) {
@ -459,14 +446,14 @@ Display.prototype = {
'x': x, 'x': x,
'y': y, 'y': y,
'width': width, 'width': width,
'height': height 'height': height,
}); });
} else { } else {
this._bgrxImageData(x, y, width, height, arr, offset); this._bgrxImageData(x, y, width, height, arr, offset);
} }
}, },
blitRgbImage: function (x, y, width, height, arr, offset, from_queue) { blitRgbImage: function (x, y , width, height, arr, offset, from_queue) {
if (this._renderQ.length !== 0 && !from_queue) { if (this._renderQ.length !== 0 && !from_queue) {
// NB(directxman12): it's technically more performant here to use preallocated arrays, // 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, // but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
@ -479,7 +466,7 @@ Display.prototype = {
'x': x, 'x': x,
'y': y, 'y': y,
'width': width, 'width': width,
'height': height 'height': height,
}); });
} else { } else {
this._rgbImageData(x, y, width, height, arr, offset); this._rgbImageData(x, y, width, height, arr, offset);
@ -499,7 +486,7 @@ Display.prototype = {
'x': x, 'x': x,
'y': y, 'y': y,
'width': width, 'width': width,
'height': height 'height': height,
}); });
} else { } else {
this._rgbxImageData(x, y, width, height, arr, offset); this._rgbxImageData(x, y, width, height, arr, offset);
@ -551,7 +538,8 @@ Display.prototype = {
var width = Math.round(factor * vp.w) + 'px'; var width = Math.round(factor * vp.w) + 'px';
var height = Math.round(factor * vp.h) + 'px'; var height = Math.round(factor * vp.h) + 'px';
if (this._target.style.width !== width || this._target.style.height !== height) { if ((this._target.style.width !== width) ||
(this._target.style.height !== height)) {
this._target.style.width = width; this._target.style.width = width;
this._target.style.height = height; this._target.style.height = height;
} }
@ -569,10 +557,10 @@ Display.prototype = {
var img = this._drawCtx.createImageData(width, height); var img = this._drawCtx.createImageData(width, height);
var data = img.data; var data = img.data;
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 3) { for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 3) {
data[i] = arr[j]; data[i] = arr[j];
data[i + 1] = arr[j + 1]; data[i + 1] = arr[j + 1];
data[i + 2] = arr[j + 2]; data[i + 2] = arr[j + 2];
data[i + 3] = 255; // Alpha data[i + 3] = 255; // Alpha
} }
this._drawCtx.putImageData(img, x, y); this._drawCtx.putImageData(img, x, y);
this._damage(x, y, img.width, img.height); this._damage(x, y, img.width, img.height);
@ -582,10 +570,10 @@ Display.prototype = {
var img = this._drawCtx.createImageData(width, height); var img = this._drawCtx.createImageData(width, height);
var data = img.data; var data = img.data;
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 4) { for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 4) {
data[i] = arr[j + 2]; data[i] = arr[j + 2];
data[i + 1] = arr[j + 1]; data[i + 1] = arr[j + 1];
data[i + 2] = arr[j]; data[i + 2] = arr[j];
data[i + 3] = 255; // Alpha data[i + 3] = 255; // Alpha
} }
this._drawCtx.putImageData(img, x, y); this._drawCtx.putImageData(img, x, y);
this._damage(x, y, img.width, img.height); this._damage(x, y, img.width, img.height);
@ -613,7 +601,7 @@ Display.prototype = {
} }
}, },
_resume_renderQ: function () { _resume_renderQ: function() {
// "this" is the object that is ready, not the // "this" is the object that is ready, not the
// display object // display object
this.removeEventListener('load', this._noVNC_display._resume_renderQ); this.removeEventListener('load', this._noVNC_display._resume_renderQ);
@ -665,27 +653,27 @@ Display.prototype = {
this._flushing = false; this._flushing = false;
this.onflush(); this.onflush();
} }
} },
}; };
// Class Methods // Class Methods
Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) { Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) {
if (w === 0 || h === 0) { if ((w === 0) || (h === 0)) {
target.style.cursor = 'none'; target.style.cursor = 'none';
return; return;
} }
var cur = []; var cur = []
var y, x; var y, x;
for (y = 0; y < h; y++) { for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
var idx = y * Math.ceil(w / 8) + Math.floor(x / 8); var idx = y * Math.ceil(w / 8) + Math.floor(x / 8);
var alpha = mask[idx] << x % 8 & 0x80 ? 255 : 0; var alpha = (mask[idx] << (x % 8)) & 0x80 ? 255 : 0;
idx = (w * y + x) * 4; idx = ((w * y) + x) * 4;
cur.push(pixels[idx + 2]); // red cur.push(pixels[idx + 2]); // red
cur.push(pixels[idx + 1]); // green cur.push(pixels[idx + 1]); // green
cur.push(pixels[idx]); // blue cur.push(pixels[idx]); // blue
cur.push(alpha); // alpha cur.push(alpha); // alpha
} }
} }
@ -707,4 +695,4 @@ Display.changeCursor = function (target, pixels, mask, hotx, hoty, w, h) {
var url = canvas.toDataURL(); var url = canvas.toDataURL();
target.style.cursor = 'url(' + url + ')' + hotx + ' ' + hoty + ', default'; target.style.cursor = 'url(' + url + ')' + hotx + ' ' + hoty + ', default';
}; };

View file

@ -1,9 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.encodingName = encodingName;
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2017 Pierre Ossman for Cendio AB * Copyright (C) 2017 Pierre Ossman for Cendio AB
@ -12,7 +6,7 @@ exports.encodingName = encodingName;
* See README.md for usage and integration instructions. * See README.md for usage and integration instructions.
*/ */
var encodings = exports.encodings = { export var encodings = {
encodingRaw: 0, encodingRaw: 0,
encodingCopyRect: 1, encodingCopyRect: 1,
encodingRRE: 2, encodingRRE: 2,
@ -31,22 +25,16 @@ var encodings = exports.encodings = {
pseudoEncodingFence: -312, pseudoEncodingFence: -312,
pseudoEncodingContinuousUpdates: -313, pseudoEncodingContinuousUpdates: -313,
pseudoEncodingCompressLevel9: -247, pseudoEncodingCompressLevel9: -247,
pseudoEncodingCompressLevel0: -256 pseudoEncodingCompressLevel0: -256,
}; };
function encodingName(num) { export function encodingName(num) {
switch (num) { switch (num) {
case encodings.encodingRaw: case encodings.encodingRaw: return "Raw";
return "Raw"; case encodings.encodingCopyRect: return "CopyRect";
case encodings.encodingCopyRect: case encodings.encodingRRE: return "RRE";
return "CopyRect"; case encodings.encodingHextile: return "Hextile";
case encodings.encodingRRE: case encodings.encodingTight: return "Tight";
return "RRE"; default: return "[unknown encoding " + num + "]";
case encodings.encodingHextile:
return "Hextile";
case encodings.encodingTight:
return "Tight";
default:
return "[unknown encoding " + num + "]";
} }
} }

View file

@ -1,17 +1,5 @@
"use strict"; import { inflateInit, inflate, inflateReset } from "../vendor/pako/lib/zlib/inflate.js";
import ZStream from "../vendor/pako/lib/zlib/zstream.js";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Inflate;
var _inflate = require("../vendor/pako/lib/zlib/inflate.js");
var _zstream = require("../vendor/pako/lib/zlib/zstream.js");
var _zstream2 = _interopRequireDefault(_zstream);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Inflate.prototype = { Inflate.prototype = {
inflate: function (data, flush, expected) { inflate: function (data, flush, expected) {
@ -30,21 +18,21 @@ Inflate.prototype = {
this.strm.avail_out = this.chunkSize; this.strm.avail_out = this.chunkSize;
(0, _inflate.inflate)(this.strm, flush); inflate(this.strm, flush);
return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out); return new Uint8Array(this.strm.output.buffer, 0, this.strm.next_out);
}, },
reset: function () { reset: function () {
(0, _inflate.inflateReset)(this.strm); inflateReset(this.strm);
} }
}; };
function Inflate() { export default function Inflate() {
this.strm = new _zstream2.default(); this.strm = new ZStream();
this.chunkSize = 1024 * 10 * 10; this.chunkSize = 1024 * 10 * 10;
this.strm.output = new Uint8Array(this.chunkSize); this.strm.output = new Uint8Array(this.chunkSize);
this.windowBits = 5; this.windowBits = 5;
(0, _inflate.inflateInit)(this.strm, this.windowBits); inflateInit(this.strm, this.windowBits);
}; };

View file

@ -1,14 +1,10 @@
"use strict"; /*
* noVNC: HTML5 VNC client
* Copyright (C) 2017 Pierre Ossman for Cendio AB
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/
Object.defineProperty(exports, "__esModule", { import KeyTable from "./keysym.js";
value: true
});
var _keysym = require("./keysym.js");
var _keysym2 = _interopRequireDefault(_keysym);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* /*
* Mapping between HTML key values and VNC/X11 keysyms for "special" * Mapping between HTML key values and VNC/X11 keysyms for "special"
@ -17,26 +13,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
* See https://www.w3.org/TR/uievents-key/ for possible values. * See https://www.w3.org/TR/uievents-key/ for possible values.
*/ */
var DOMKeyTable = {}; /* var DOMKeyTable = {};
* noVNC: HTML5 VNC client
* Copyright (C) 2017 Pierre Ossman for Cendio AB
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/
function addStandard(key, standard) { function addStandard(key, standard)
{
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\""; if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
DOMKeyTable[key] = [standard, standard, standard, standard]; DOMKeyTable[key] = [standard, standard, standard, standard];
} }
function addLeftRight(key, left, right) { function addLeftRight(key, left, right)
{
if (left === undefined) throw "Undefined keysym for key \"" + key + "\""; if (left === undefined) throw "Undefined keysym for key \"" + key + "\"";
if (right === undefined) throw "Undefined keysym for key \"" + key + "\""; if (right === undefined) throw "Undefined keysym for key \"" + key + "\"";
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
DOMKeyTable[key] = [left, left, right, left]; DOMKeyTable[key] = [left, left, right, left];
} }
function addNumpad(key, standard, numpad) { function addNumpad(key, standard, numpad)
{
if (standard === undefined) throw "Undefined keysym for key \"" + key + "\""; if (standard === undefined) throw "Undefined keysym for key \"" + key + "\"";
if (numpad === undefined) throw "Undefined keysym for key \"" + key + "\""; if (numpad === undefined) throw "Undefined keysym for key \"" + key + "\"";
if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\"";
@ -45,177 +40,177 @@ function addNumpad(key, standard, numpad) {
// 2.2. Modifier Keys // 2.2. Modifier Keys
addLeftRight("Alt", _keysym2.default.XK_Alt_L, _keysym2.default.XK_Alt_R); addLeftRight("Alt", KeyTable.XK_Alt_L, KeyTable.XK_Alt_R);
addStandard("AltGraph", _keysym2.default.XK_ISO_Level3_Shift); addStandard("AltGraph", KeyTable.XK_ISO_Level3_Shift);
addStandard("CapsLock", _keysym2.default.XK_Caps_Lock); addStandard("CapsLock", KeyTable.XK_Caps_Lock);
addLeftRight("Control", _keysym2.default.XK_Control_L, _keysym2.default.XK_Control_R); addLeftRight("Control", KeyTable.XK_Control_L, KeyTable.XK_Control_R);
// - Fn // - Fn
// - FnLock // - FnLock
addLeftRight("Hyper", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R); addLeftRight("Hyper", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
addLeftRight("Meta", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R); addLeftRight("Meta", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
addStandard("NumLock", _keysym2.default.XK_Num_Lock); addStandard("NumLock", KeyTable.XK_Num_Lock);
addStandard("ScrollLock", _keysym2.default.XK_Scroll_Lock); addStandard("ScrollLock", KeyTable.XK_Scroll_Lock);
addLeftRight("Shift", _keysym2.default.XK_Shift_L, _keysym2.default.XK_Shift_R); addLeftRight("Shift", KeyTable.XK_Shift_L, KeyTable.XK_Shift_R);
addLeftRight("Super", _keysym2.default.XK_Super_L, _keysym2.default.XK_Super_R); addLeftRight("Super", KeyTable.XK_Super_L, KeyTable.XK_Super_R);
// - Symbol // - Symbol
// - SymbolLock // - SymbolLock
// 2.3. Whitespace Keys // 2.3. Whitespace Keys
addNumpad("Enter", _keysym2.default.XK_Return, _keysym2.default.XK_KP_Enter); addNumpad("Enter", KeyTable.XK_Return, KeyTable.XK_KP_Enter);
addStandard("Tab", _keysym2.default.XK_Tab); addStandard("Tab", KeyTable.XK_Tab);
addNumpad(" ", _keysym2.default.XK_space, _keysym2.default.XK_KP_Space); addNumpad(" ", KeyTable.XK_space, KeyTable.XK_KP_Space);
// 2.4. Navigation Keys // 2.4. Navigation Keys
addNumpad("ArrowDown", _keysym2.default.XK_Down, _keysym2.default.XK_KP_Down); addNumpad("ArrowDown", KeyTable.XK_Down, KeyTable.XK_KP_Down);
addNumpad("ArrowUp", _keysym2.default.XK_Up, _keysym2.default.XK_KP_Up); addNumpad("ArrowUp", KeyTable.XK_Up, KeyTable.XK_KP_Up);
addNumpad("ArrowLeft", _keysym2.default.XK_Left, _keysym2.default.XK_KP_Left); addNumpad("ArrowLeft", KeyTable.XK_Left, KeyTable.XK_KP_Left);
addNumpad("ArrowRight", _keysym2.default.XK_Right, _keysym2.default.XK_KP_Right); addNumpad("ArrowRight", KeyTable.XK_Right, KeyTable.XK_KP_Right);
addNumpad("End", _keysym2.default.XK_End, _keysym2.default.XK_KP_End); addNumpad("End", KeyTable.XK_End, KeyTable.XK_KP_End);
addNumpad("Home", _keysym2.default.XK_Home, _keysym2.default.XK_KP_Home); addNumpad("Home", KeyTable.XK_Home, KeyTable.XK_KP_Home);
addNumpad("PageDown", _keysym2.default.XK_Next, _keysym2.default.XK_KP_Next); addNumpad("PageDown", KeyTable.XK_Next, KeyTable.XK_KP_Next);
addNumpad("PageUp", _keysym2.default.XK_Prior, _keysym2.default.XK_KP_Prior); addNumpad("PageUp", KeyTable.XK_Prior, KeyTable.XK_KP_Prior);
// 2.5. Editing Keys // 2.5. Editing Keys
addStandard("Backspace", _keysym2.default.XK_BackSpace); addStandard("Backspace", KeyTable.XK_BackSpace);
addStandard("Clear", _keysym2.default.XK_Clear); addStandard("Clear", KeyTable.XK_Clear);
addStandard("Copy", _keysym2.default.XF86XK_Copy); addStandard("Copy", KeyTable.XF86XK_Copy);
// - CrSel // - CrSel
addStandard("Cut", _keysym2.default.XF86XK_Cut); addStandard("Cut", KeyTable.XF86XK_Cut);
addNumpad("Delete", _keysym2.default.XK_Delete, _keysym2.default.XK_KP_Delete); addNumpad("Delete", KeyTable.XK_Delete, KeyTable.XK_KP_Delete);
// - EraseEof // - EraseEof
// - ExSel // - ExSel
addNumpad("Insert", _keysym2.default.XK_Insert, _keysym2.default.XK_KP_Insert); addNumpad("Insert", KeyTable.XK_Insert, KeyTable.XK_KP_Insert);
addStandard("Paste", _keysym2.default.XF86XK_Paste); addStandard("Paste", KeyTable.XF86XK_Paste);
addStandard("Redo", _keysym2.default.XK_Redo); addStandard("Redo", KeyTable.XK_Redo);
addStandard("Undo", _keysym2.default.XK_Undo); addStandard("Undo", KeyTable.XK_Undo);
// 2.6. UI Keys // 2.6. UI Keys
// - Accept // - Accept
// - Again (could just be XK_Redo) // - Again (could just be XK_Redo)
// - Attn // - Attn
addStandard("Cancel", _keysym2.default.XK_Cancel); addStandard("Cancel", KeyTable.XK_Cancel);
addStandard("ContextMenu", _keysym2.default.XK_Menu); addStandard("ContextMenu", KeyTable.XK_Menu);
addStandard("Escape", _keysym2.default.XK_Escape); addStandard("Escape", KeyTable.XK_Escape);
addStandard("Execute", _keysym2.default.XK_Execute); addStandard("Execute", KeyTable.XK_Execute);
addStandard("Find", _keysym2.default.XK_Find); addStandard("Find", KeyTable.XK_Find);
addStandard("Help", _keysym2.default.XK_Help); addStandard("Help", KeyTable.XK_Help);
addStandard("Pause", _keysym2.default.XK_Pause); addStandard("Pause", KeyTable.XK_Pause);
// - Play // - Play
// - Props // - Props
addStandard("Select", _keysym2.default.XK_Select); addStandard("Select", KeyTable.XK_Select);
addStandard("ZoomIn", _keysym2.default.XF86XK_ZoomIn); addStandard("ZoomIn", KeyTable.XF86XK_ZoomIn);
addStandard("ZoomOut", _keysym2.default.XF86XK_ZoomOut); addStandard("ZoomOut", KeyTable.XF86XK_ZoomOut);
// 2.7. Device Keys // 2.7. Device Keys
addStandard("BrightnessDown", _keysym2.default.XF86XK_MonBrightnessDown); addStandard("BrightnessDown", KeyTable.XF86XK_MonBrightnessDown);
addStandard("BrightnessUp", _keysym2.default.XF86XK_MonBrightnessUp); addStandard("BrightnessUp", KeyTable.XF86XK_MonBrightnessUp);
addStandard("Eject", _keysym2.default.XF86XK_Eject); addStandard("Eject", KeyTable.XF86XK_Eject);
addStandard("LogOff", _keysym2.default.XF86XK_LogOff); addStandard("LogOff", KeyTable.XF86XK_LogOff);
addStandard("Power", _keysym2.default.XF86XK_PowerOff); addStandard("Power", KeyTable.XF86XK_PowerOff);
addStandard("PowerOff", _keysym2.default.XF86XK_PowerDown); addStandard("PowerOff", KeyTable.XF86XK_PowerDown);
addStandard("PrintScreen", _keysym2.default.XK_Print); addStandard("PrintScreen", KeyTable.XK_Print);
addStandard("Hibernate", _keysym2.default.XF86XK_Hibernate); addStandard("Hibernate", KeyTable.XF86XK_Hibernate);
addStandard("Standby", _keysym2.default.XF86XK_Standby); addStandard("Standby", KeyTable.XF86XK_Standby);
addStandard("WakeUp", _keysym2.default.XF86XK_WakeUp); addStandard("WakeUp", KeyTable.XF86XK_WakeUp);
// 2.8. IME and Composition Keys // 2.8. IME and Composition Keys
addStandard("AllCandidates", _keysym2.default.XK_MultipleCandidate); addStandard("AllCandidates", KeyTable.XK_MultipleCandidate);
addStandard("Alphanumeric", _keysym2.default.XK_Eisu_Shift); // could also be _Eisu_Toggle addStandard("Alphanumeric", KeyTable.XK_Eisu_Shift); // could also be _Eisu_Toggle
addStandard("CodeInput", _keysym2.default.XK_Codeinput); addStandard("CodeInput", KeyTable.XK_Codeinput);
addStandard("Compose", _keysym2.default.XK_Multi_key); addStandard("Compose", KeyTable.XK_Multi_key);
addStandard("Convert", _keysym2.default.XK_Henkan); addStandard("Convert", KeyTable.XK_Henkan);
// - Dead // - Dead
// - FinalMode // - FinalMode
addStandard("GroupFirst", _keysym2.default.XK_ISO_First_Group); addStandard("GroupFirst", KeyTable.XK_ISO_First_Group);
addStandard("GroupLast", _keysym2.default.XK_ISO_Last_Group); addStandard("GroupLast", KeyTable.XK_ISO_Last_Group);
addStandard("GroupNext", _keysym2.default.XK_ISO_Next_Group); addStandard("GroupNext", KeyTable.XK_ISO_Next_Group);
addStandard("GroupPrevious", _keysym2.default.XK_ISO_Prev_Group); addStandard("GroupPrevious", KeyTable.XK_ISO_Prev_Group);
// - ModeChange (XK_Mode_switch is often used for AltGr) // - ModeChange (XK_Mode_switch is often used for AltGr)
// - NextCandidate // - NextCandidate
addStandard("NonConvert", _keysym2.default.XK_Muhenkan); addStandard("NonConvert", KeyTable.XK_Muhenkan);
addStandard("PreviousCandidate", _keysym2.default.XK_PreviousCandidate); addStandard("PreviousCandidate", KeyTable.XK_PreviousCandidate);
// - Process // - Process
addStandard("SingleCandidate", _keysym2.default.XK_SingleCandidate); addStandard("SingleCandidate", KeyTable.XK_SingleCandidate);
addStandard("HangulMode", _keysym2.default.XK_Hangul); addStandard("HangulMode", KeyTable.XK_Hangul);
addStandard("HanjaMode", _keysym2.default.XK_Hangul_Hanja); addStandard("HanjaMode", KeyTable.XK_Hangul_Hanja);
addStandard("JunjuaMode", _keysym2.default.XK_Hangul_Jeonja); addStandard("JunjuaMode", KeyTable.XK_Hangul_Jeonja);
addStandard("Eisu", _keysym2.default.XK_Eisu_toggle); addStandard("Eisu", KeyTable.XK_Eisu_toggle);
addStandard("Hankaku", _keysym2.default.XK_Hankaku); addStandard("Hankaku", KeyTable.XK_Hankaku);
addStandard("Hiragana", _keysym2.default.XK_Hiragana); addStandard("Hiragana", KeyTable.XK_Hiragana);
addStandard("HiraganaKatakana", _keysym2.default.XK_Hiragana_Katakana); addStandard("HiraganaKatakana", KeyTable.XK_Hiragana_Katakana);
addStandard("KanaMode", _keysym2.default.XK_Kana_Shift); // could also be _Kana_Lock addStandard("KanaMode", KeyTable.XK_Kana_Shift); // could also be _Kana_Lock
addStandard("KanjiMode", _keysym2.default.XK_Kanji); addStandard("KanjiMode", KeyTable.XK_Kanji);
addStandard("Katakana", _keysym2.default.XK_Katakana); addStandard("Katakana", KeyTable.XK_Katakana);
addStandard("Romaji", _keysym2.default.XK_Romaji); addStandard("Romaji", KeyTable.XK_Romaji);
addStandard("Zenkaku", _keysym2.default.XK_Zenkaku); addStandard("Zenkaku", KeyTable.XK_Zenkaku);
addStandard("ZenkakuHanaku", _keysym2.default.XK_Zenkaku_Hankaku); addStandard("ZenkakuHanaku", KeyTable.XK_Zenkaku_Hankaku);
// 2.9. General-Purpose Function Keys // 2.9. General-Purpose Function Keys
addStandard("F1", _keysym2.default.XK_F1); addStandard("F1", KeyTable.XK_F1);
addStandard("F2", _keysym2.default.XK_F2); addStandard("F2", KeyTable.XK_F2);
addStandard("F3", _keysym2.default.XK_F3); addStandard("F3", KeyTable.XK_F3);
addStandard("F4", _keysym2.default.XK_F4); addStandard("F4", KeyTable.XK_F4);
addStandard("F5", _keysym2.default.XK_F5); addStandard("F5", KeyTable.XK_F5);
addStandard("F6", _keysym2.default.XK_F6); addStandard("F6", KeyTable.XK_F6);
addStandard("F7", _keysym2.default.XK_F7); addStandard("F7", KeyTable.XK_F7);
addStandard("F8", _keysym2.default.XK_F8); addStandard("F8", KeyTable.XK_F8);
addStandard("F9", _keysym2.default.XK_F9); addStandard("F9", KeyTable.XK_F9);
addStandard("F10", _keysym2.default.XK_F10); addStandard("F10", KeyTable.XK_F10);
addStandard("F11", _keysym2.default.XK_F11); addStandard("F11", KeyTable.XK_F11);
addStandard("F12", _keysym2.default.XK_F12); addStandard("F12", KeyTable.XK_F12);
addStandard("F13", _keysym2.default.XK_F13); addStandard("F13", KeyTable.XK_F13);
addStandard("F14", _keysym2.default.XK_F14); addStandard("F14", KeyTable.XK_F14);
addStandard("F15", _keysym2.default.XK_F15); addStandard("F15", KeyTable.XK_F15);
addStandard("F16", _keysym2.default.XK_F16); addStandard("F16", KeyTable.XK_F16);
addStandard("F17", _keysym2.default.XK_F17); addStandard("F17", KeyTable.XK_F17);
addStandard("F18", _keysym2.default.XK_F18); addStandard("F18", KeyTable.XK_F18);
addStandard("F19", _keysym2.default.XK_F19); addStandard("F19", KeyTable.XK_F19);
addStandard("F20", _keysym2.default.XK_F20); addStandard("F20", KeyTable.XK_F20);
addStandard("F21", _keysym2.default.XK_F21); addStandard("F21", KeyTable.XK_F21);
addStandard("F22", _keysym2.default.XK_F22); addStandard("F22", KeyTable.XK_F22);
addStandard("F23", _keysym2.default.XK_F23); addStandard("F23", KeyTable.XK_F23);
addStandard("F24", _keysym2.default.XK_F24); addStandard("F24", KeyTable.XK_F24);
addStandard("F25", _keysym2.default.XK_F25); addStandard("F25", KeyTable.XK_F25);
addStandard("F26", _keysym2.default.XK_F26); addStandard("F26", KeyTable.XK_F26);
addStandard("F27", _keysym2.default.XK_F27); addStandard("F27", KeyTable.XK_F27);
addStandard("F28", _keysym2.default.XK_F28); addStandard("F28", KeyTable.XK_F28);
addStandard("F29", _keysym2.default.XK_F29); addStandard("F29", KeyTable.XK_F29);
addStandard("F30", _keysym2.default.XK_F30); addStandard("F30", KeyTable.XK_F30);
addStandard("F31", _keysym2.default.XK_F31); addStandard("F31", KeyTable.XK_F31);
addStandard("F32", _keysym2.default.XK_F32); addStandard("F32", KeyTable.XK_F32);
addStandard("F33", _keysym2.default.XK_F33); addStandard("F33", KeyTable.XK_F33);
addStandard("F34", _keysym2.default.XK_F34); addStandard("F34", KeyTable.XK_F34);
addStandard("F35", _keysym2.default.XK_F35); addStandard("F35", KeyTable.XK_F35);
// - Soft1... // - Soft1...
// 2.10. Multimedia Keys // 2.10. Multimedia Keys
// - ChannelDown // - ChannelDown
// - ChannelUp // - ChannelUp
addStandard("Close", _keysym2.default.XF86XK_Close); addStandard("Close", KeyTable.XF86XK_Close);
addStandard("MailForward", _keysym2.default.XF86XK_MailForward); addStandard("MailForward", KeyTable.XF86XK_MailForward);
addStandard("MailReply", _keysym2.default.XF86XK_Reply); addStandard("MailReply", KeyTable.XF86XK_Reply);
addStandard("MainSend", _keysym2.default.XF86XK_Send); addStandard("MainSend", KeyTable.XF86XK_Send);
addStandard("MediaFastForward", _keysym2.default.XF86XK_AudioForward); addStandard("MediaFastForward", KeyTable.XF86XK_AudioForward);
addStandard("MediaPause", _keysym2.default.XF86XK_AudioPause); addStandard("MediaPause", KeyTable.XF86XK_AudioPause);
addStandard("MediaPlay", _keysym2.default.XF86XK_AudioPlay); addStandard("MediaPlay", KeyTable.XF86XK_AudioPlay);
addStandard("MediaRecord", _keysym2.default.XF86XK_AudioRecord); addStandard("MediaRecord", KeyTable.XF86XK_AudioRecord);
addStandard("MediaRewind", _keysym2.default.XF86XK_AudioRewind); addStandard("MediaRewind", KeyTable.XF86XK_AudioRewind);
addStandard("MediaStop", _keysym2.default.XF86XK_AudioStop); addStandard("MediaStop", KeyTable.XF86XK_AudioStop);
addStandard("MediaTrackNext", _keysym2.default.XF86XK_AudioNext); addStandard("MediaTrackNext", KeyTable.XF86XK_AudioNext);
addStandard("MediaTrackPrevious", _keysym2.default.XF86XK_AudioPrev); addStandard("MediaTrackPrevious", KeyTable.XF86XK_AudioPrev);
addStandard("New", _keysym2.default.XF86XK_New); addStandard("New", KeyTable.XF86XK_New);
addStandard("Open", _keysym2.default.XF86XK_Open); addStandard("Open", KeyTable.XF86XK_Open);
addStandard("Print", _keysym2.default.XK_Print); addStandard("Print", KeyTable.XK_Print);
addStandard("Save", _keysym2.default.XF86XK_Save); addStandard("Save", KeyTable.XF86XK_Save);
addStandard("SpellCheck", _keysym2.default.XF86XK_Spell); addStandard("SpellCheck", KeyTable.XF86XK_Spell);
// 2.11. Multimedia Numpad Keys // 2.11. Multimedia Numpad Keys
@ -236,13 +231,13 @@ addStandard("SpellCheck", _keysym2.default.XF86XK_Spell);
// - AudioSurroundModeNext // - AudioSurroundModeNext
// - AudioTrebleDown // - AudioTrebleDown
// - AudioTrebleUp // - AudioTrebleUp
addStandard("AudioVolumeDown", _keysym2.default.XF86XK_AudioLowerVolume); addStandard("AudioVolumeDown", KeyTable.XF86XK_AudioLowerVolume);
addStandard("AudioVolumeUp", _keysym2.default.XF86XK_AudioRaiseVolume); addStandard("AudioVolumeUp", KeyTable.XF86XK_AudioRaiseVolume);
addStandard("AudioVolumeMute", _keysym2.default.XF86XK_AudioMute); addStandard("AudioVolumeMute", KeyTable.XF86XK_AudioMute);
// - MicrophoneToggle // - MicrophoneToggle
// - MicrophoneVolumeDown // - MicrophoneVolumeDown
// - MicrophoneVolumeUp // - MicrophoneVolumeUp
addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute); addStandard("MicrophoneVolumeMute", KeyTable.XF86XK_AudioMicMute);
// 2.13. Speech Keys // 2.13. Speech Keys
@ -251,28 +246,28 @@ addStandard("MicrophoneVolumeMute", _keysym2.default.XF86XK_AudioMicMute);
// 2.14. Application Keys // 2.14. Application Keys
addStandard("LaunchCalculator", _keysym2.default.XF86XK_Calculator); addStandard("LaunchCalculator", KeyTable.XF86XK_Calculator);
addStandard("LaunchCalendar", _keysym2.default.XF86XK_Calendar); addStandard("LaunchCalendar", KeyTable.XF86XK_Calendar);
addStandard("LaunchMail", _keysym2.default.XF86XK_Mail); addStandard("LaunchMail", KeyTable.XF86XK_Mail);
addStandard("LaunchMediaPlayer", _keysym2.default.XF86XK_AudioMedia); addStandard("LaunchMediaPlayer", KeyTable.XF86XK_AudioMedia);
addStandard("LaunchMusicPlayer", _keysym2.default.XF86XK_Music); addStandard("LaunchMusicPlayer", KeyTable.XF86XK_Music);
addStandard("LaunchMyComputer", _keysym2.default.XF86XK_MyComputer); addStandard("LaunchMyComputer", KeyTable.XF86XK_MyComputer);
addStandard("LaunchPhone", _keysym2.default.XF86XK_Phone); addStandard("LaunchPhone", KeyTable.XF86XK_Phone);
addStandard("LaunchScreenSaver", _keysym2.default.XF86XK_ScreenSaver); addStandard("LaunchScreenSaver", KeyTable.XF86XK_ScreenSaver);
addStandard("LaunchSpreadsheet", _keysym2.default.XF86XK_Excel); addStandard("LaunchSpreadsheet", KeyTable.XF86XK_Excel);
addStandard("LaunchWebBrowser", _keysym2.default.XF86XK_WWW); addStandard("LaunchWebBrowser", KeyTable.XF86XK_WWW);
addStandard("LaunchWebCam", _keysym2.default.XF86XK_WebCam); addStandard("LaunchWebCam", KeyTable.XF86XK_WebCam);
addStandard("LaunchWordProcessor", _keysym2.default.XF86XK_Word); addStandard("LaunchWordProcessor", KeyTable.XF86XK_Word);
// 2.15. Browser Keys // 2.15. Browser Keys
addStandard("BrowserBack", _keysym2.default.XF86XK_Back); addStandard("BrowserBack", KeyTable.XF86XK_Back);
addStandard("BrowserFavorites", _keysym2.default.XF86XK_Favorites); addStandard("BrowserFavorites", KeyTable.XF86XK_Favorites);
addStandard("BrowserForward", _keysym2.default.XF86XK_Forward); addStandard("BrowserForward", KeyTable.XF86XK_Forward);
addStandard("BrowserHome", _keysym2.default.XF86XK_HomePage); addStandard("BrowserHome", KeyTable.XF86XK_HomePage);
addStandard("BrowserRefresh", _keysym2.default.XF86XK_Refresh); addStandard("BrowserRefresh", KeyTable.XF86XK_Refresh);
addStandard("BrowserSearch", _keysym2.default.XF86XK_Search); addStandard("BrowserSearch", KeyTable.XF86XK_Search);
addStandard("BrowserStop", _keysym2.default.XF86XK_Stop); addStandard("BrowserStop", KeyTable.XF86XK_Stop);
// 2.16. Mobile Phone Keys // 2.16. Mobile Phone Keys
@ -285,31 +280,31 @@ addStandard("BrowserStop", _keysym2.default.XF86XK_Stop);
// 2.18. Media Controller Keys // 2.18. Media Controller Keys
// - A whole bunch... // - A whole bunch...
addStandard("Dimmer", _keysym2.default.XF86XK_BrightnessAdjust); addStandard("Dimmer", KeyTable.XF86XK_BrightnessAdjust);
addStandard("MediaAudioTrack", _keysym2.default.XF86XK_AudioCycleTrack); addStandard("MediaAudioTrack", KeyTable.XF86XK_AudioCycleTrack);
addStandard("RandomToggle", _keysym2.default.XF86XK_AudioRandomPlay); addStandard("RandomToggle", KeyTable.XF86XK_AudioRandomPlay);
addStandard("SplitScreenToggle", _keysym2.default.XF86XK_SplitScreen); addStandard("SplitScreenToggle", KeyTable.XF86XK_SplitScreen);
addStandard("Subtitle", _keysym2.default.XF86XK_Subtitle); addStandard("Subtitle", KeyTable.XF86XK_Subtitle);
addStandard("VideoModeNext", _keysym2.default.XF86XK_Next_VMode); addStandard("VideoModeNext", KeyTable.XF86XK_Next_VMode);
// Extra: Numpad // Extra: Numpad
addNumpad("=", _keysym2.default.XK_equal, _keysym2.default.XK_KP_Equal); addNumpad("=", KeyTable.XK_equal, KeyTable.XK_KP_Equal);
addNumpad("+", _keysym2.default.XK_plus, _keysym2.default.XK_KP_Add); addNumpad("+", KeyTable.XK_plus, KeyTable.XK_KP_Add);
addNumpad("-", _keysym2.default.XK_minus, _keysym2.default.XK_KP_Subtract); addNumpad("-", KeyTable.XK_minus, KeyTable.XK_KP_Subtract);
addNumpad("*", _keysym2.default.XK_asterisk, _keysym2.default.XK_KP_Multiply); addNumpad("*", KeyTable.XK_asterisk, KeyTable.XK_KP_Multiply);
addNumpad("/", _keysym2.default.XK_slash, _keysym2.default.XK_KP_Divide); addNumpad("/", KeyTable.XK_slash, KeyTable.XK_KP_Divide);
addNumpad(".", _keysym2.default.XK_period, _keysym2.default.XK_KP_Decimal); addNumpad(".", KeyTable.XK_period, KeyTable.XK_KP_Decimal);
addNumpad(",", _keysym2.default.XK_comma, _keysym2.default.XK_KP_Separator); addNumpad(",", KeyTable.XK_comma, KeyTable.XK_KP_Separator);
addNumpad("0", _keysym2.default.XK_0, _keysym2.default.XK_KP_0); addNumpad("0", KeyTable.XK_0, KeyTable.XK_KP_0);
addNumpad("1", _keysym2.default.XK_1, _keysym2.default.XK_KP_1); addNumpad("1", KeyTable.XK_1, KeyTable.XK_KP_1);
addNumpad("2", _keysym2.default.XK_2, _keysym2.default.XK_KP_2); addNumpad("2", KeyTable.XK_2, KeyTable.XK_KP_2);
addNumpad("3", _keysym2.default.XK_3, _keysym2.default.XK_KP_3); addNumpad("3", KeyTable.XK_3, KeyTable.XK_KP_3);
addNumpad("4", _keysym2.default.XK_4, _keysym2.default.XK_KP_4); addNumpad("4", KeyTable.XK_4, KeyTable.XK_KP_4);
addNumpad("5", _keysym2.default.XK_5, _keysym2.default.XK_KP_5); addNumpad("5", KeyTable.XK_5, KeyTable.XK_KP_5);
addNumpad("6", _keysym2.default.XK_6, _keysym2.default.XK_KP_6); addNumpad("6", KeyTable.XK_6, KeyTable.XK_KP_6);
addNumpad("7", _keysym2.default.XK_7, _keysym2.default.XK_KP_7); addNumpad("7", KeyTable.XK_7, KeyTable.XK_KP_7);
addNumpad("8", _keysym2.default.XK_8, _keysym2.default.XK_KP_8); addNumpad("8", KeyTable.XK_8, KeyTable.XK_KP_8);
addNumpad("9", _keysym2.default.XK_9, _keysym2.default.XK_KP_9); addNumpad("9", KeyTable.XK_9, KeyTable.XK_KP_9);
exports.default = DOMKeyTable; export default DOMKeyTable;

View file

@ -1,8 +1,3 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2017 Pierre Ossman for Cendio AB * Copyright (C) 2017 Pierre Ossman for Cendio AB
@ -19,114 +14,114 @@ Object.defineProperty(exports, "__esModule", {
* See https://www.w3.org/TR/uievents-key/ for possible values. * See https://www.w3.org/TR/uievents-key/ for possible values.
*/ */
exports.default = { export default {
// 3.1.1.1. Writing System Keys // 3.1.1.1. Writing System Keys
'Backspace': 'Backspace', 'Backspace': 'Backspace',
// 3.1.1.2. Functional Keys // 3.1.1.2. Functional Keys
'AltLeft': 'Alt', 'AltLeft': 'Alt',
'AltRight': 'Alt', // This could also be 'AltGraph' 'AltRight': 'Alt', // This could also be 'AltGraph'
'CapsLock': 'CapsLock', 'CapsLock': 'CapsLock',
'ContextMenu': 'ContextMenu', 'ContextMenu': 'ContextMenu',
'ControlLeft': 'Control', 'ControlLeft': 'Control',
'ControlRight': 'Control', 'ControlRight': 'Control',
'Enter': 'Enter', 'Enter': 'Enter',
'MetaLeft': 'Meta', 'MetaLeft': 'Meta',
'MetaRight': 'Meta', 'MetaRight': 'Meta',
'ShiftLeft': 'Shift', 'ShiftLeft': 'Shift',
'ShiftRight': 'Shift', 'ShiftRight': 'Shift',
'Tab': 'Tab', 'Tab': 'Tab',
// FIXME: Japanese/Korean keys // FIXME: Japanese/Korean keys
// 3.1.2. Control Pad Section // 3.1.2. Control Pad Section
'Delete': 'Delete', 'Delete': 'Delete',
'End': 'End', 'End': 'End',
'Help': 'Help', 'Help': 'Help',
'Home': 'Home', 'Home': 'Home',
'Insert': 'Insert', 'Insert': 'Insert',
'PageDown': 'PageDown', 'PageDown': 'PageDown',
'PageUp': 'PageUp', 'PageUp': 'PageUp',
// 3.1.3. Arrow Pad Section // 3.1.3. Arrow Pad Section
'ArrowDown': 'ArrowDown', 'ArrowDown': 'ArrowDown',
'ArrowLeft': 'ArrowLeft', 'ArrowLeft': 'ArrowLeft',
'ArrowRight': 'ArrowRight', 'ArrowRight': 'ArrowRight',
'ArrowUp': 'ArrowUp', 'ArrowUp': 'ArrowUp',
// 3.1.4. Numpad Section // 3.1.4. Numpad Section
'NumLock': 'NumLock', 'NumLock': 'NumLock',
'NumpadBackspace': 'Backspace', 'NumpadBackspace': 'Backspace',
'NumpadClear': 'Clear', 'NumpadClear': 'Clear',
// 3.1.5. Function Section // 3.1.5. Function Section
'Escape': 'Escape', 'Escape': 'Escape',
'F1': 'F1', 'F1': 'F1',
'F2': 'F2', 'F2': 'F2',
'F3': 'F3', 'F3': 'F3',
'F4': 'F4', 'F4': 'F4',
'F5': 'F5', 'F5': 'F5',
'F6': 'F6', 'F6': 'F6',
'F7': 'F7', 'F7': 'F7',
'F8': 'F8', 'F8': 'F8',
'F9': 'F9', 'F9': 'F9',
'F10': 'F10', 'F10': 'F10',
'F11': 'F11', 'F11': 'F11',
'F12': 'F12', 'F12': 'F12',
'F13': 'F13', 'F13': 'F13',
'F14': 'F14', 'F14': 'F14',
'F15': 'F15', 'F15': 'F15',
'F16': 'F16', 'F16': 'F16',
'F17': 'F17', 'F17': 'F17',
'F18': 'F18', 'F18': 'F18',
'F19': 'F19', 'F19': 'F19',
'F20': 'F20', 'F20': 'F20',
'F21': 'F21', 'F21': 'F21',
'F22': 'F22', 'F22': 'F22',
'F23': 'F23', 'F23': 'F23',
'F24': 'F24', 'F24': 'F24',
'F25': 'F25', 'F25': 'F25',
'F26': 'F26', 'F26': 'F26',
'F27': 'F27', 'F27': 'F27',
'F28': 'F28', 'F28': 'F28',
'F29': 'F29', 'F29': 'F29',
'F30': 'F30', 'F30': 'F30',
'F31': 'F31', 'F31': 'F31',
'F32': 'F32', 'F32': 'F32',
'F33': 'F33', 'F33': 'F33',
'F34': 'F34', 'F34': 'F34',
'F35': 'F35', 'F35': 'F35',
'PrintScreen': 'PrintScreen', 'PrintScreen': 'PrintScreen',
'ScrollLock': 'ScrollLock', 'ScrollLock': 'ScrollLock',
'Pause': 'Pause', 'Pause': 'Pause',
// 3.1.6. Media Keys // 3.1.6. Media Keys
'BrowserBack': 'BrowserBack', 'BrowserBack': 'BrowserBack',
'BrowserFavorites': 'BrowserFavorites', 'BrowserFavorites': 'BrowserFavorites',
'BrowserForward': 'BrowserForward', 'BrowserForward': 'BrowserForward',
'BrowserHome': 'BrowserHome', 'BrowserHome': 'BrowserHome',
'BrowserRefresh': 'BrowserRefresh', 'BrowserRefresh': 'BrowserRefresh',
'BrowserSearch': 'BrowserSearch', 'BrowserSearch': 'BrowserSearch',
'BrowserStop': 'BrowserStop', 'BrowserStop': 'BrowserStop',
'Eject': 'Eject', 'Eject': 'Eject',
'LaunchApp1': 'LaunchMyComputer', 'LaunchApp1': 'LaunchMyComputer',
'LaunchApp2': 'LaunchCalendar', 'LaunchApp2': 'LaunchCalendar',
'LaunchMail': 'LaunchMail', 'LaunchMail': 'LaunchMail',
'MediaPlayPause': 'MediaPlay', 'MediaPlayPause': 'MediaPlay',
'MediaStop': 'MediaStop', 'MediaStop': 'MediaStop',
'MediaTrackNext': 'MediaTrackNext', 'MediaTrackNext': 'MediaTrackNext',
'MediaTrackPrevious': 'MediaTrackPrevious', 'MediaTrackPrevious': 'MediaTrackPrevious',
'Power': 'Power', 'Power': 'Power',
'Sleep': 'Sleep', 'Sleep': 'Sleep',
'AudioVolumeDown': 'AudioVolumeDown', 'AudioVolumeDown': 'AudioVolumeDown',
'AudioVolumeMute': 'AudioVolumeMute', 'AudioVolumeMute': 'AudioVolumeMute',
'AudioVolumeUp': 'AudioVolumeUp', 'AudioVolumeUp': 'AudioVolumeUp',
'WakeUp': 'WakeUp' 'WakeUp': 'WakeUp',
}; };

View file

@ -1,42 +1,26 @@
'use strict'; /*
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/
Object.defineProperty(exports, "__esModule", { import * as Log from '../util/logging.js';
value: true import { stopEvent } from '../util/events.js';
}); import * as KeyboardUtil from "./util.js";
exports.default = Keyboard; import KeyTable from "./keysym.js";
import * as browser from "../util/browser.js";
var _logging = require('../util/logging.js');
var Log = _interopRequireWildcard(_logging);
var _events = require('../util/events.js');
var _util = require('./util.js');
var KeyboardUtil = _interopRequireWildcard(_util);
var _keysym = require('./keysym.js');
var _keysym2 = _interopRequireDefault(_keysym);
var _browser = require('../util/browser.js');
var browser = _interopRequireWildcard(_browser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
// //
// Keyboard event handler // Keyboard event handler
// //
function Keyboard(target) { export default function Keyboard(target) {
this._target = target || null; this._target = target || null;
this._keyDownList = {}; // List of depressed keys this._keyDownList = {}; // List of depressed keys
// (even if they are happy) // (even if they are happy)
this._pendingKey = null; // Key waiting for keypress this._pendingKey = null; // Key waiting for keypress
// keep these here so we can refer to them later // keep these here so we can refer to them later
this._eventHandlers = { this._eventHandlers = {
@ -45,24 +29,18 @@ function Keyboard(target) {
'keypress': this._handleKeyPress.bind(this), 'keypress': this._handleKeyPress.bind(this),
'blur': this._allKeysUp.bind(this) 'blur': this._allKeysUp.bind(this)
}; };
} /* };
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Copyright (C) 2013 Samuel Mannehed for Cendio AB
* Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/
;
Keyboard.prototype = { Keyboard.prototype = {
// ===== EVENT HANDLERS ===== // ===== EVENT HANDLERS =====
onkeyevent: function () {}, // Handler for key press/release onkeyevent: function () {}, // Handler for key press/release
// ===== PRIVATE METHODS ===== // ===== PRIVATE METHODS =====
_sendKeyEvent: function (keysym, code, down) { _sendKeyEvent: function (keysym, code, down) {
Log.Debug("onkeyevent " + (down ? "down" : "up") + ", keysym: " + keysym, ", code: " + code); Log.Debug("onkeyevent " + (down ? "down" : "up") +
", keysym: " + keysym, ", code: " + code);
// Windows sends CtrlLeft+AltRight when you press // Windows sends CtrlLeft+AltRight when you press
// AltGraph, which tends to confuse the hell out of // AltGraph, which tends to confuse the hell out of
@ -70,18 +48,25 @@ Keyboard.prototype = {
// there is a way to detect AltGraph properly. // there is a way to detect AltGraph properly.
var fakeAltGraph = false; var fakeAltGraph = false;
if (down && browser.isWindows()) { if (down && browser.isWindows()) {
if (code !== 'ControlLeft' && code !== 'AltRight' && 'ControlLeft' in this._keyDownList && 'AltRight' in this._keyDownList) { if ((code !== 'ControlLeft') &&
(code !== 'AltRight') &&
('ControlLeft' in this._keyDownList) &&
('AltRight' in this._keyDownList)) {
fakeAltGraph = true; fakeAltGraph = true;
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', false); this.onkeyevent(this._keyDownList['AltRight'],
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', false); 'AltRight', false);
this.onkeyevent(this._keyDownList['ControlLeft'],
'ControlLeft', false);
} }
} }
this.onkeyevent(keysym, code, down); this.onkeyevent(keysym, code, down);
if (fakeAltGraph) { if (fakeAltGraph) {
this.onkeyevent(this._keyDownList['ControlLeft'], 'ControlLeft', true); this.onkeyevent(this._keyDownList['ControlLeft'],
this.onkeyevent(this._keyDownList['AltRight'], 'AltRight', true); 'ControlLeft', true);
this.onkeyevent(this._keyDownList['AltRight'],
'AltRight', true);
} }
}, },
@ -94,7 +79,7 @@ Keyboard.prototype = {
// Unstable, but we don't have anything else to go on // Unstable, but we don't have anything else to go on
// (don't use it for 'keypress' events thought since // (don't use it for 'keypress' events thought since
// WebKit sets it to the same as charCode) // WebKit sets it to the same as charCode)
if (e.keyCode && e.type !== 'keypress') { if (e.keyCode && (e.type !== 'keypress')) {
// 229 is used for composition events // 229 is used for composition events
if (e.keyCode !== 229) { if (e.keyCode !== 229) {
return 'Platform' + e.keyCode; return 'Platform' + e.keyCode;
@ -128,7 +113,7 @@ Keyboard.prototype = {
// to deal with virtual keyboards which omit key info // to deal with virtual keyboards which omit key info
// (iOS omits tracking info on keyup events, which forces us to // (iOS omits tracking info on keyup events, which forces us to
// special treat that platform here) // special treat that platform here)
if (code === 'Unidentified' || browser.isIOS()) { if ((code === 'Unidentified') || browser.isIOS()) {
if (keysym) { if (keysym) {
// If it's a virtual keyboard then it should be // If it's a virtual keyboard then it should be
// sufficient to just send press and release right // sufficient to just send press and release right
@ -137,7 +122,7 @@ Keyboard.prototype = {
this._sendKeyEvent(keysym, code, false); this._sendKeyEvent(keysym, code, false);
} }
(0, _events.stopEvent)(e); stopEvent(e);
return; return;
} }
@ -147,18 +132,18 @@ Keyboard.prototype = {
// possibly others). // possibly others).
if (browser.isMac()) { if (browser.isMac()) {
switch (keysym) { switch (keysym) {
case _keysym2.default.XK_Super_L: case KeyTable.XK_Super_L:
keysym = _keysym2.default.XK_Alt_L; keysym = KeyTable.XK_Alt_L;
break; break;
case _keysym2.default.XK_Super_R: case KeyTable.XK_Super_R:
keysym = _keysym2.default.XK_Super_L; keysym = KeyTable.XK_Super_L;
break; break;
case _keysym2.default.XK_Alt_L: case KeyTable.XK_Alt_L:
keysym = _keysym2.default.XK_Mode_switch; keysym = KeyTable.XK_Mode_switch;
break; break;
case _keysym2.default.XK_Alt_R: case KeyTable.XK_Alt_R:
keysym = _keysym2.default.XK_ISO_Level3_Shift; keysym = KeyTable.XK_ISO_Level3_Shift;
break; break;
} }
} }
@ -172,10 +157,10 @@ Keyboard.prototype = {
// state change events. That gets extra confusing for CapsLock // state change events. That gets extra confusing for CapsLock
// which toggles on each press, but not on release. So pretend // which toggles on each press, but not on release. So pretend
// it was a quick press and release of the button. // it was a quick press and release of the button.
if (browser.isMac() && code === 'CapsLock') { if (browser.isMac() && (code === 'CapsLock')) {
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true); this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false); this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
(0, _events.stopEvent)(e); stopEvent(e);
return; return;
} }
@ -193,7 +178,7 @@ Keyboard.prototype = {
} }
this._pendingKey = null; this._pendingKey = null;
(0, _events.stopEvent)(e); stopEvent(e);
this._keyDownList[code] = keysym; this._keyDownList[code] = keysym;
@ -202,7 +187,7 @@ Keyboard.prototype = {
// Legacy event for browsers without code/key // Legacy event for browsers without code/key
_handleKeyPress: function (e) { _handleKeyPress: function (e) {
(0, _events.stopEvent)(e); stopEvent(e);
// Are we expecting a keypress? // Are we expecting a keypress?
if (this._pendingKey === null) { if (this._pendingKey === null) {
@ -213,7 +198,7 @@ Keyboard.prototype = {
var keysym = KeyboardUtil.getKeysym(e); var keysym = KeyboardUtil.getKeysym(e);
// The key we were waiting for? // The key we were waiting for?
if (code !== 'Unidentified' && code != this._pendingKey) { if ((code !== 'Unidentified') && (code != this._pendingKey)) {
return; return;
} }
@ -243,14 +228,17 @@ Keyboard.prototype = {
// We have no way of knowing the proper keysym with the // We have no way of knowing the proper keysym with the
// information given, but the following are true for most // information given, but the following are true for most
// layouts // layouts
if (e.keyCode >= 0x30 && e.keyCode <= 0x39) { if ((e.keyCode >= 0x30) && (e.keyCode <= 0x39)) {
// Digit // Digit
keysym = e.keyCode; keysym = e.keyCode;
} else if (e.keyCode >= 0x41 && e.keyCode <= 0x5a) { } else if ((e.keyCode >= 0x41) && (e.keyCode <= 0x5a)) {
// Character (A-Z) // Character (A-Z)
var char = String.fromCharCode(e.keyCode); var char = String.fromCharCode(e.keyCode);
// A feeble attempt at the correct case // A feeble attempt at the correct case
if (e.shiftKey) char = char.toUpperCase();else char = char.toLowerCase(); if (e.shiftKey)
char = char.toUpperCase();
else
char = char.toLowerCase();
keysym = char.charCodeAt(); keysym = char.charCodeAt();
} else { } else {
// Unknown, give up // Unknown, give up
@ -263,14 +251,14 @@ Keyboard.prototype = {
}, },
_handleKeyUp: function (e) { _handleKeyUp: function (e) {
(0, _events.stopEvent)(e); stopEvent(e);
var code = this._getKeyCode(e); var code = this._getKeyCode(e);
// See comment in _handleKeyDown() // See comment in _handleKeyDown()
if (browser.isMac() && code === 'CapsLock') { if (browser.isMac() && (code === 'CapsLock')) {
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', true); this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
this._sendKeyEvent(_keysym2.default.XK_Caps_Lock, 'CapsLock', false); this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
return; return;
} }
@ -322,5 +310,5 @@ Keyboard.prototype = {
this._allKeysUp(); this._allKeysUp();
//Log.Debug(">> Keyboard.ungrab"); //Log.Debug(">> Keyboard.ungrab");
} },
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,8 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/* /*
* Mapping from Unicode codepoints to X11/RFB keysyms * Mapping from Unicode codepoints to X11/RFB keysyms
* *
@ -671,13 +666,13 @@ var codepoints = {
0x30f2: 0x04a6, // XK_kana_WO 0x30f2: 0x04a6, // XK_kana_WO
0x30f3: 0x04dd, // XK_kana_N 0x30f3: 0x04dd, // XK_kana_N
0x30fb: 0x04a5, // XK_kana_conjunctive 0x30fb: 0x04a5, // XK_kana_conjunctive
0x30fc: 0x04b0 // XK_prolongedsound 0x30fc: 0x04b0, // XK_prolongedsound
}; };
exports.default = { export default {
lookup: function (u) { lookup : function(u) {
// Latin-1 is one-to-one mapping // Latin-1 is one-to-one mapping
if (u >= 0x20 && u <= 0xff) { if ((u >= 0x20) && (u <= 0xff)) {
return u; return u;
} }
@ -689,5 +684,5 @@ exports.default = {
// General mapping as final fallback // General mapping as final fallback
return 0x01000000 | u; return 0x01000000 | u;
} },
}; };

View file

@ -1,21 +1,3 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = Mouse;
var _logging = require('../util/logging.js');
var Log = _interopRequireWildcard(_logging);
var _browser = require('../util/browser.js');
var _events = require('../util/events.js');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -23,10 +5,15 @@ var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
* Licensed under MPL 2.0 or any later version (see LICENSE.txt) * Licensed under MPL 2.0 or any later version (see LICENSE.txt)
*/ */
import * as Log from '../util/logging.js';
import { isTouchDevice } from '../util/browser.js';
import { setCapture, stopEvent, getPointerEvent } from '../util/events.js';
var WHEEL_STEP = 10; // Delta threshold for a mouse wheel step
var WHEEL_STEP_TIMEOUT = 50; // ms var WHEEL_STEP_TIMEOUT = 50; // ms
var WHEEL_LINE_HEIGHT = 19; var WHEEL_LINE_HEIGHT = 19;
function Mouse(target) { export default function Mouse(target) {
this._target = target || document; this._target = target || document;
this._doubleClickTimer = null; this._doubleClickTimer = null;
@ -50,12 +37,12 @@ function Mouse(target) {
Mouse.prototype = { Mouse.prototype = {
// ===== PROPERTIES ===== // ===== PROPERTIES =====
touchButton: 1, // Button mask (1, 2, 4) for touch devices (0 means ignore clicks) touchButton: 1, // Button mask (1, 2, 4) for touch devices (0 means ignore clicks)
// ===== EVENT HANDLERS ===== // ===== EVENT HANDLERS =====
onmousebutton: function () {}, // Handler for mouse button click/release onmousebutton: function () {}, // Handler for mouse button click/release
onmousemove: function () {}, // Handler for mouse movement onmousemove: function () {}, // Handler for mouse movement
// ===== PRIVATE METHODS ===== // ===== PRIVATE METHODS =====
@ -85,7 +72,7 @@ Mouse.prototype = {
var xs = this._lastTouchPos.x - pos.x; var xs = this._lastTouchPos.x - pos.x;
var ys = this._lastTouchPos.y - pos.y; var ys = this._lastTouchPos.y - pos.y;
var d = Math.sqrt(xs * xs + ys * ys); var d = Math.sqrt((xs * xs) + (ys * ys));
// The goal is to trigger on a certain physical width, the // The goal is to trigger on a certain physical width, the
// devicePixelRatio brings us a bit closer but is not optimal. // devicePixelRatio brings us a bit closer but is not optimal.
@ -103,21 +90,22 @@ Mouse.prototype = {
bmask = 1 << e.button; bmask = 1 << e.button;
} else { } else {
/* IE including 9 */ /* IE including 9 */
bmask = (e.button & 0x1) + // Left bmask = (e.button & 0x1) + // Left
(e.button & 0x2) * 2 + // Right (e.button & 0x2) * 2 + // Right
(e.button & 0x4) / 2; // Middle (e.button & 0x4) / 2; // Middle
} }
Log.Debug("onmousebutton " + (down ? "down" : "up") + ", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask); Log.Debug("onmousebutton " + (down ? "down" : "up") +
", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
this.onmousebutton(pos.x, pos.y, down, bmask); this.onmousebutton(pos.x, pos.y, down, bmask);
(0, _events.stopEvent)(e); stopEvent(e);
}, },
_handleMouseDown: function (e) { _handleMouseDown: function (e) {
// Touch events have implicit capture // Touch events have implicit capture
if (e.type === "mousedown") { if (e.type === "mousedown") {
(0, _events.setCapture)(this._target); setCapture(this._target);
} }
this._handleMouseButton(e, 1); this._handleMouseButton(e, 1);
@ -191,21 +179,25 @@ Mouse.prototype = {
if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) { if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
this._generateWheelStepX(); this._generateWheelStepX();
} else { } else {
this._wheelStepXTimer = window.setTimeout(this._generateWheelStepX.bind(this), WHEEL_STEP_TIMEOUT); this._wheelStepXTimer =
window.setTimeout(this._generateWheelStepX.bind(this),
WHEEL_STEP_TIMEOUT);
} }
if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) { if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) {
this._generateWheelStepY(); this._generateWheelStepY();
} else { } else {
this._wheelStepYTimer = window.setTimeout(this._generateWheelStepY.bind(this), WHEEL_STEP_TIMEOUT); this._wheelStepYTimer =
window.setTimeout(this._generateWheelStepY.bind(this),
WHEEL_STEP_TIMEOUT);
} }
(0, _events.stopEvent)(e); stopEvent(e);
}, },
_handleMouseMove: function (e) { _handleMouseMove: function (e) {
this._updateMousePosition(e); this._updateMousePosition(e);
this.onmousemove(this._pos.x, this._pos.y); this.onmousemove(this._pos.x, this._pos.y);
(0, _events.stopEvent)(e); stopEvent(e);
}, },
_handleMouseDisable: function (e) { _handleMouseDisable: function (e) {
@ -216,13 +208,13 @@ Mouse.prototype = {
* to listen on the document element instead. * to listen on the document element instead.
*/ */
if (e.target == this._target) { if (e.target == this._target) {
(0, _events.stopEvent)(e); stopEvent(e);
} }
}, },
// Update coordinates relative to target // Update coordinates relative to target
_updateMousePosition: function (e) { _updateMousePosition: function(e) {
e = (0, _events.getPointerEvent)(e); e = getPointerEvent(e);
var bounds = this._target.getBoundingClientRect(); var bounds = this._target.getBoundingClientRect();
var x, y; var x, y;
// Clip to target bounds // Clip to target bounds
@ -240,7 +232,7 @@ Mouse.prototype = {
} else { } else {
y = e.clientY - bounds.top; y = e.clientY - bounds.top;
} }
this._pos = { x: x, y: y }; this._pos = {x:x, y:y};
}, },
// ===== PUBLIC METHODS ===== // ===== PUBLIC METHODS =====
@ -248,7 +240,7 @@ Mouse.prototype = {
grab: function () { grab: function () {
var c = this._target; var c = this._target;
if (_browser.isTouchDevice) { if (isTouchDevice) {
c.addEventListener('touchstart', this._eventHandlers.mousedown); c.addEventListener('touchstart', this._eventHandlers.mousedown);
c.addEventListener('touchend', this._eventHandlers.mouseup); c.addEventListener('touchend', this._eventHandlers.mouseup);
c.addEventListener('touchmove', this._eventHandlers.mousemove); c.addEventListener('touchmove', this._eventHandlers.mousemove);
@ -271,7 +263,7 @@ Mouse.prototype = {
this._resetWheelStepTimers(); this._resetWheelStepTimers();
if (_browser.isTouchDevice) { if (isTouchDevice) {
c.removeEventListener('touchstart', this._eventHandlers.mousedown); c.removeEventListener('touchstart', this._eventHandlers.mousedown);
c.removeEventListener('touchend', this._eventHandlers.mouseup); c.removeEventListener('touchend', this._eventHandlers.mouseup);
c.removeEventListener('touchmove', this._eventHandlers.mousemove); c.removeEventListener('touchmove', this._eventHandlers.mousemove);
@ -285,4 +277,4 @@ Mouse.prototype = {
c.removeEventListener('contextmenu', this._eventHandlers.mousedisable); c.removeEventListener('contextmenu', this._eventHandlers.mousedisable);
} }
}; };

View file

@ -1,42 +1,12 @@
"use strict"; import KeyTable from "./keysym.js";
import keysyms from "./keysymdef.js";
Object.defineProperty(exports, "__esModule", { import vkeys from "./vkeys.js";
value: true import fixedkeys from "./fixedkeys.js";
}); import DOMKeyTable from "./domkeytable.js";
exports.getKeycode = getKeycode; import * as browser from "../util/browser.js";
exports.getKey = getKey;
exports.getKeysym = getKeysym;
var _keysym = require("./keysym.js");
var _keysym2 = _interopRequireDefault(_keysym);
var _keysymdef = require("./keysymdef.js");
var _keysymdef2 = _interopRequireDefault(_keysymdef);
var _vkeys = require("./vkeys.js");
var _vkeys2 = _interopRequireDefault(_vkeys);
var _fixedkeys = require("./fixedkeys.js");
var _fixedkeys2 = _interopRequireDefault(_fixedkeys);
var _domkeytable = require("./domkeytable.js");
var _domkeytable2 = _interopRequireDefault(_domkeytable);
var _browser = require("../util/browser.js");
var browser = _interopRequireWildcard(_browser);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Get 'KeyboardEvent.code', handling legacy browsers // Get 'KeyboardEvent.code', handling legacy browsers
function getKeycode(evt) { export function getKeycode(evt){
// Are we getting proper key identifiers? // Are we getting proper key identifiers?
// (unfortunately Firefox and Chrome are crappy here and gives // (unfortunately Firefox and Chrome are crappy here and gives
// us an empty string on some platforms, rather than leaving it // us an empty string on some platforms, rather than leaving it
@ -44,10 +14,8 @@ function getKeycode(evt) {
if (evt.code) { if (evt.code) {
// Mozilla isn't fully in sync with the spec yet // Mozilla isn't fully in sync with the spec yet
switch (evt.code) { switch (evt.code) {
case 'OSLeft': case 'OSLeft': return 'MetaLeft';
return 'MetaLeft'; case 'OSRight': return 'MetaRight';
case 'OSRight':
return 'MetaRight';
} }
return evt.code; return evt.code;
@ -56,11 +24,11 @@ function getKeycode(evt) {
// The de-facto standard is to use Windows Virtual-Key codes // The de-facto standard is to use Windows Virtual-Key codes
// in the 'keyCode' field for non-printable characters. However // in the 'keyCode' field for non-printable characters. However
// Webkit sets it to the same as charCode in 'keypress' events. // Webkit sets it to the same as charCode in 'keypress' events.
if (evt.type !== 'keypress' && evt.keyCode in _vkeys2.default) { if ((evt.type !== 'keypress') && (evt.keyCode in vkeys)) {
var code = _vkeys2.default[evt.keyCode]; var code = vkeys[evt.keyCode];
// macOS has messed up this code for some reason // macOS has messed up this code for some reason
if (browser.isMac() && code === 'ContextMenu') { if (browser.isMac() && (code === 'ContextMenu')) {
code = 'MetaRight'; code = 'MetaRight';
} }
@ -68,40 +36,26 @@ function getKeycode(evt) {
// for the standard modifiers // for the standard modifiers
if (evt.location === 2) { if (evt.location === 2) {
switch (code) { switch (code) {
case 'ShiftLeft': case 'ShiftLeft': return 'ShiftRight';
return 'ShiftRight'; case 'ControlLeft': return 'ControlRight';
case 'ControlLeft': case 'AltLeft': return 'AltRight';
return 'ControlRight';
case 'AltLeft':
return 'AltRight';
} }
} }
// Nor a bunch of the numpad keys // Nor a bunch of the numpad keys
if (evt.location === 3) { if (evt.location === 3) {
switch (code) { switch (code) {
case 'Delete': case 'Delete': return 'NumpadDecimal';
return 'NumpadDecimal'; case 'Insert': return 'Numpad0';
case 'Insert': case 'End': return 'Numpad1';
return 'Numpad0'; case 'ArrowDown': return 'Numpad2';
case 'End': case 'PageDown': return 'Numpad3';
return 'Numpad1'; case 'ArrowLeft': return 'Numpad4';
case 'ArrowDown': case 'ArrowRight': return 'Numpad6';
return 'Numpad2'; case 'Home': return 'Numpad7';
case 'PageDown': case 'ArrowUp': return 'Numpad8';
return 'Numpad3'; case 'PageUp': return 'Numpad9';
case 'ArrowLeft': case 'Enter': return 'NumpadEnter';
return 'Numpad4';
case 'ArrowRight':
return 'Numpad6';
case 'Home':
return 'Numpad7';
case 'ArrowUp':
return 'Numpad8';
case 'PageUp':
return 'Numpad9';
case 'Enter':
return 'NumpadEnter';
} }
} }
@ -112,75 +66,54 @@ function getKeycode(evt) {
} }
// Get 'KeyboardEvent.key', handling legacy browsers // Get 'KeyboardEvent.key', handling legacy browsers
function getKey(evt) { export function getKey(evt) {
// Are we getting a proper key value? // Are we getting a proper key value?
if (evt.key !== undefined) { if (evt.key !== undefined) {
// IE and Edge use some ancient version of the spec // IE and Edge use some ancient version of the spec
// https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/ // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
switch (evt.key) { switch (evt.key) {
case 'Spacebar': case 'Spacebar': return ' ';
return ' '; case 'Esc': return 'Escape';
case 'Esc': case 'Scroll': return 'ScrollLock';
return 'Escape'; case 'Win': return 'Meta';
case 'Scroll': case 'Apps': return 'ContextMenu';
return 'ScrollLock'; case 'Up': return 'ArrowUp';
case 'Win': case 'Left': return 'ArrowLeft';
return 'Meta'; case 'Right': return 'ArrowRight';
case 'Apps': case 'Down': return 'ArrowDown';
return 'ContextMenu'; case 'Del': return 'Delete';
case 'Up': case 'Divide': return '/';
return 'ArrowUp'; case 'Multiply': return '*';
case 'Left': case 'Subtract': return '-';
return 'ArrowLeft'; case 'Add': return '+';
case 'Right': case 'Decimal': return evt.char;
return 'ArrowRight';
case 'Down':
return 'ArrowDown';
case 'Del':
return 'Delete';
case 'Divide':
return '/';
case 'Multiply':
return '*';
case 'Subtract':
return '-';
case 'Add':
return '+';
case 'Decimal':
return evt.char;
} }
// Mozilla isn't fully in sync with the spec yet // Mozilla isn't fully in sync with the spec yet
switch (evt.key) { switch (evt.key) {
case 'OS': case 'OS': return 'Meta';
return 'Meta';
} }
// iOS leaks some OS names // iOS leaks some OS names
switch (evt.key) { switch (evt.key) {
case 'UIKeyInputUpArrow': case 'UIKeyInputUpArrow': return 'ArrowUp';
return 'ArrowUp'; case 'UIKeyInputDownArrow': return 'ArrowDown';
case 'UIKeyInputDownArrow': case 'UIKeyInputLeftArrow': return 'ArrowLeft';
return 'ArrowDown'; case 'UIKeyInputRightArrow': return 'ArrowRight';
case 'UIKeyInputLeftArrow': case 'UIKeyInputEscape': return 'Escape';
return 'ArrowLeft';
case 'UIKeyInputRightArrow':
return 'ArrowRight';
case 'UIKeyInputEscape':
return 'Escape';
} }
// IE and Edge have broken handling of AltGraph so we cannot // IE and Edge have broken handling of AltGraph so we cannot
// trust them for printable characters // trust them for printable characters
if (evt.key.length !== 1 || !browser.isIE() && !browser.isEdge()) { if ((evt.key.length !== 1) || (!browser.isIE() && !browser.isEdge())) {
return evt.key; return evt.key;
} }
} }
// Try to deduce it based on the physical key // Try to deduce it based on the physical key
var code = getKeycode(evt); var code = getKeycode(evt);
if (code in _fixedkeys2.default) { if (code in fixedkeys) {
return _fixedkeys2.default[code]; return fixedkeys[code];
} }
// If that failed, then see if we have a printable character // If that failed, then see if we have a printable character
@ -193,7 +126,7 @@ function getKey(evt) {
} }
// Get the most reliable keysym value we can get from a key event // Get the most reliable keysym value we can get from a key event
function getKeysym(evt) { export function getKeysym(evt){
var key = getKey(evt); var key = getKey(evt);
if (key === 'Unidentified') { if (key === 'Unidentified') {
@ -201,19 +134,19 @@ function getKeysym(evt) {
} }
// First look up special keys // First look up special keys
if (key in _domkeytable2.default) { if (key in DOMKeyTable) {
var location = evt.location; var location = evt.location;
// Safari screws up location for the right cmd key // Safari screws up location for the right cmd key
if (key === 'Meta' && location === 0) { if ((key === 'Meta') && (location === 0)) {
location = 2; location = 2;
} }
if (location === undefined || location > 3) { if ((location === undefined) || (location > 3)) {
location = 0; location = 0;
} }
return _domkeytable2.default[key][location]; return DOMKeyTable[key][location];
} }
// Now we need to look at the Unicode symbol instead // Now we need to look at the Unicode symbol instead
@ -227,8 +160,8 @@ function getKeysym(evt) {
codepoint = key.charCodeAt(); codepoint = key.charCodeAt();
if (codepoint) { if (codepoint) {
return _keysymdef2.default.lookup(codepoint); return keysyms.lookup(codepoint);
} }
return null; return null;
} }

View file

@ -1,8 +1,3 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2017 Pierre Ossman for Cendio AB * Copyright (C) 2017 Pierre Ossman for Cendio AB
@ -14,108 +9,108 @@ Object.defineProperty(exports, "__esModule", {
* HTML key codes. * HTML key codes.
*/ */
exports.default = { export default {
0x08: 'Backspace', 0x08: 'Backspace',
0x09: 'Tab', 0x09: 'Tab',
0x0a: 'NumpadClear', 0x0a: 'NumpadClear',
0x0d: 'Enter', 0x0d: 'Enter',
0x10: 'ShiftLeft', 0x10: 'ShiftLeft',
0x11: 'ControlLeft', 0x11: 'ControlLeft',
0x12: 'AltLeft', 0x12: 'AltLeft',
0x13: 'Pause', 0x13: 'Pause',
0x14: 'CapsLock', 0x14: 'CapsLock',
0x15: 'Lang1', 0x15: 'Lang1',
0x19: 'Lang2', 0x19: 'Lang2',
0x1b: 'Escape', 0x1b: 'Escape',
0x1c: 'Convert', 0x1c: 'Convert',
0x1d: 'NonConvert', 0x1d: 'NonConvert',
0x20: 'Space', 0x20: 'Space',
0x21: 'PageUp', 0x21: 'PageUp',
0x22: 'PageDown', 0x22: 'PageDown',
0x23: 'End', 0x23: 'End',
0x24: 'Home', 0x24: 'Home',
0x25: 'ArrowLeft', 0x25: 'ArrowLeft',
0x26: 'ArrowUp', 0x26: 'ArrowUp',
0x27: 'ArrowRight', 0x27: 'ArrowRight',
0x28: 'ArrowDown', 0x28: 'ArrowDown',
0x29: 'Select', 0x29: 'Select',
0x2c: 'PrintScreen', 0x2c: 'PrintScreen',
0x2d: 'Insert', 0x2d: 'Insert',
0x2e: 'Delete', 0x2e: 'Delete',
0x2f: 'Help', 0x2f: 'Help',
0x30: 'Digit0', 0x30: 'Digit0',
0x31: 'Digit1', 0x31: 'Digit1',
0x32: 'Digit2', 0x32: 'Digit2',
0x33: 'Digit3', 0x33: 'Digit3',
0x34: 'Digit4', 0x34: 'Digit4',
0x35: 'Digit5', 0x35: 'Digit5',
0x36: 'Digit6', 0x36: 'Digit6',
0x37: 'Digit7', 0x37: 'Digit7',
0x38: 'Digit8', 0x38: 'Digit8',
0x39: 'Digit9', 0x39: 'Digit9',
0x5b: 'MetaLeft', 0x5b: 'MetaLeft',
0x5c: 'MetaRight', 0x5c: 'MetaRight',
0x5d: 'ContextMenu', 0x5d: 'ContextMenu',
0x5f: 'Sleep', 0x5f: 'Sleep',
0x60: 'Numpad0', 0x60: 'Numpad0',
0x61: 'Numpad1', 0x61: 'Numpad1',
0x62: 'Numpad2', 0x62: 'Numpad2',
0x63: 'Numpad3', 0x63: 'Numpad3',
0x64: 'Numpad4', 0x64: 'Numpad4',
0x65: 'Numpad5', 0x65: 'Numpad5',
0x66: 'Numpad6', 0x66: 'Numpad6',
0x67: 'Numpad7', 0x67: 'Numpad7',
0x68: 'Numpad8', 0x68: 'Numpad8',
0x69: 'Numpad9', 0x69: 'Numpad9',
0x6a: 'NumpadMultiply', 0x6a: 'NumpadMultiply',
0x6b: 'NumpadAdd', 0x6b: 'NumpadAdd',
0x6c: 'NumpadDecimal', 0x6c: 'NumpadDecimal',
0x6d: 'NumpadSubtract', 0x6d: 'NumpadSubtract',
0x6e: 'NumpadDecimal', // Duplicate, because buggy on Windows 0x6e: 'NumpadDecimal', // Duplicate, because buggy on Windows
0x6f: 'NumpadDivide', 0x6f: 'NumpadDivide',
0x70: 'F1', 0x70: 'F1',
0x71: 'F2', 0x71: 'F2',
0x72: 'F3', 0x72: 'F3',
0x73: 'F4', 0x73: 'F4',
0x74: 'F5', 0x74: 'F5',
0x75: 'F6', 0x75: 'F6',
0x76: 'F7', 0x76: 'F7',
0x77: 'F8', 0x77: 'F8',
0x78: 'F9', 0x78: 'F9',
0x79: 'F10', 0x79: 'F10',
0x7a: 'F11', 0x7a: 'F11',
0x7b: 'F12', 0x7b: 'F12',
0x7c: 'F13', 0x7c: 'F13',
0x7d: 'F14', 0x7d: 'F14',
0x7e: 'F15', 0x7e: 'F15',
0x7f: 'F16', 0x7f: 'F16',
0x80: 'F17', 0x80: 'F17',
0x81: 'F18', 0x81: 'F18',
0x82: 'F19', 0x82: 'F19',
0x83: 'F20', 0x83: 'F20',
0x84: 'F21', 0x84: 'F21',
0x85: 'F22', 0x85: 'F22',
0x86: 'F23', 0x86: 'F23',
0x87: 'F24', 0x87: 'F24',
0x90: 'NumLock', 0x90: 'NumLock',
0x91: 'ScrollLock', 0x91: 'ScrollLock',
0xa6: 'BrowserBack', 0xa6: 'BrowserBack',
0xa7: 'BrowserForward', 0xa7: 'BrowserForward',
0xa8: 'BrowserRefresh', 0xa8: 'BrowserRefresh',
0xa9: 'BrowserStop', 0xa9: 'BrowserStop',
0xaa: 'BrowserSearch', 0xaa: 'BrowserSearch',
0xab: 'BrowserFavorites', 0xab: 'BrowserFavorites',
0xac: 'BrowserHome', 0xac: 'BrowserHome',
0xad: 'AudioVolumeMute', 0xad: 'AudioVolumeMute',
0xae: 'AudioVolumeDown', 0xae: 'AudioVolumeDown',
0xaf: 'AudioVolumeUp', 0xaf: 'AudioVolumeUp',
0xb0: 'MediaTrackNext', 0xb0: 'MediaTrackNext',
0xb1: 'MediaTrackPrevious', 0xb1: 'MediaTrackPrevious',
0xb2: 'MediaStop', 0xb2: 'MediaStop',
0xb3: 'MediaPlayPause', 0xb3: 'MediaPlayPause',
0xb4: 'LaunchMail', 0xb4: 'LaunchMail',
0xb5: 'MediaSelect', 0xb5: 'MediaSelect',
0xb6: 'LaunchApp1', 0xb6: 'LaunchApp1',
0xb7: 'LaunchApp2', 0xb7: 'LaunchApp2',
0xe1: 'AltRight' // Only when it is AltGraph 0xe1: 'AltRight', // Only when it is AltGraph
}; };

View file

@ -1,15 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/* /*
* This file is auto-generated from keymaps.csv on 2017-05-31 16:20 * This file is auto-generated from keymaps.csv on 2017-05-31 16:20
* Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94) * Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
* To re-generate, run: * To re-generate, run:
* keymap-gen --lang=js code-map keymaps.csv html atset1 * keymap-gen --lang=js code-map keymaps.csv html atset1
*/ */
exports.default = { export default {
"Again": 0xe005, /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */ "Again": 0xe005, /* html:Again (Again) -> linux:129 (KEY_AGAIN) -> atset1:57349 */
"AltLeft": 0x38, /* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */ "AltLeft": 0x38, /* html:AltLeft (AltLeft) -> linux:56 (KEY_LEFTALT) -> atset1:56 */
"AltRight": 0xe038, /* html:AltRight (AltRight) -> linux:100 (KEY_RIGHTALT) -> atset1:57400 */ "AltRight": 0xe038, /* html:AltRight (AltRight) -> linux:100 (KEY_RIGHTALT) -> atset1:57400 */
@ -172,5 +167,5 @@ exports.default = {
"Suspend": 0xe025, /* html:Suspend (Suspend) -> linux:205 (KEY_SUSPEND) -> atset1:57381 */ "Suspend": 0xe025, /* html:Suspend (Suspend) -> linux:205 (KEY_SUSPEND) -> atset1:57381 */
"Tab": 0xf, /* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */ "Tab": 0xf, /* html:Tab (Tab) -> linux:15 (KEY_TAB) -> atset1:15 */
"Undo": 0xe007, /* html:Undo (Undo) -> linux:131 (KEY_UNDO) -> atset1:57351 */ "Undo": 0xe007, /* html:Undo (Undo) -> linux:131 (KEY_UNDO) -> atset1:57351 */
"WakeUp": 0xe063 /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */ "WakeUp": 0xe063, /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,43 +1,28 @@
'use strict'; /*
* noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* See README.md for usage and integration instructions.
*/
Object.defineProperty(exports, "__esModule", { import * as Log from './logging.js';
value: true
});
exports.isTouchDevice = undefined;
exports.supportsCursorURIs = supportsCursorURIs;
exports.isMac = isMac;
exports.isIE = isIE;
exports.isEdge = isEdge;
exports.isWindows = isWindows;
exports.isIOS = isIOS;
var _logging = require('./logging.js');
var Log = _interopRequireWildcard(_logging);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
// Touch detection // Touch detection
var isTouchDevice = exports.isTouchDevice = 'ontouchstart' in document.documentElement || export var isTouchDevice = ('ontouchstart' in document.documentElement) ||
// requried for Chrome debugger // requried for Chrome debugger
document.ontouchstart !== undefined || (document.ontouchstart !== undefined) ||
// required for MS Surface // required for MS Surface
navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; /* (navigator.maxTouchPoints > 0) ||
* noVNC: HTML5 VNC client (navigator.msMaxTouchPoints > 0);
* Copyright (C) 2012 Joel Martin
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* See README.md for usage and integration instructions.
*/
window.addEventListener('touchstart', function onFirstTouch() { window.addEventListener('touchstart', function onFirstTouch() {
exports.isTouchDevice = isTouchDevice = true; isTouchDevice = true;
window.removeEventListener('touchstart', onFirstTouch, false); window.removeEventListener('touchstart', onFirstTouch, false);
}, false); }, false);
var _cursor_uris_supported = null; var _cursor_uris_supported = null;
function supportsCursorURIs() { export function supportsCursorURIs () {
if (_cursor_uris_supported === null) { if (_cursor_uris_supported === null) {
try { try {
var target = document.createElement('canvas'); var target = document.createElement('canvas');
@ -59,22 +44,26 @@ function supportsCursorURIs() {
return _cursor_uris_supported; return _cursor_uris_supported;
}; };
function isMac() { export function isMac() {
return navigator && !!/mac/i.exec(navigator.platform); return navigator && !!(/mac/i).exec(navigator.platform);
} }
function isIE() { export function isIE() {
return navigator && !!/trident/i.exec(navigator.userAgent); return navigator && !!(/trident/i).exec(navigator.userAgent);
} }
function isEdge() { export function isEdge() {
return navigator && !!/edge/i.exec(navigator.userAgent); return navigator && !!(/edge/i).exec(navigator.userAgent);
} }
function isWindows() { export function isWindows() {
return navigator && !!/win/i.exec(navigator.platform); return navigator && !!(/win/i).exec(navigator.platform);
}
export function isIOS() {
return navigator &&
(!!(/ipad/i).exec(navigator.platform) ||
!!(/iphone/i).exec(navigator.platform) ||
!!(/ipod/i).exec(navigator.platform));
} }
function isIOS() {
return navigator && (!!/ipad/i.exec(navigator.platform) || !!/iphone/i.exec(navigator.platform) || !!/ipod/i.exec(navigator.platform));
}

View file

@ -1,12 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getPointerEvent = getPointerEvent;
exports.stopEvent = stopEvent;
exports.setCapture = setCapture;
exports.releaseCapture = releaseCapture;
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -19,11 +10,11 @@ exports.releaseCapture = releaseCapture;
* Cross-browser event and position routines * Cross-browser event and position routines
*/ */
function getPointerEvent(e) { export function getPointerEvent (e) {
return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e; return e.changedTouches ? e.changedTouches[0] : e.touches ? e.touches[0] : e;
}; };
function stopEvent(e) { export function stopEvent (e) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}; };
@ -65,13 +56,14 @@ var _captureObserver = new MutationObserver(_captureElemChanged);
var _captureIndex = 0; var _captureIndex = 0;
function setCapture(elem) { export function setCapture (elem) {
if (elem.setCapture) { if (elem.setCapture) {
elem.setCapture(); elem.setCapture();
// IE releases capture on 'click' events which might not trigger // IE releases capture on 'click' events which might not trigger
elem.addEventListener('mouseup', releaseCapture); elem.addEventListener('mouseup', releaseCapture);
} else { } else {
// Release any existing capture in case this method is // Release any existing capture in case this method is
// called multiple times without coordination // called multiple times without coordination
@ -103,7 +95,7 @@ function setCapture(elem) {
_captureIndex++; _captureIndex++;
// Track cursor and get initial cursor // Track cursor and get initial cursor
_captureObserver.observe(elem, { attributes: true }); _captureObserver.observe(elem, {attributes:true});
_captureElemChanged(); _captureElemChanged();
captureElem.style.display = ""; captureElem.style.display = "";
@ -115,10 +107,11 @@ function setCapture(elem) {
} }
}; };
function releaseCapture() { export function releaseCapture () {
if (document.releaseCapture) { if (document.releaseCapture) {
document.releaseCapture(); document.releaseCapture();
} else { } else {
if (!_captureElem) { if (!_captureElem) {
return; return;
@ -126,7 +119,7 @@ function releaseCapture() {
// There might be events already queued, so we need to wait for // There might be events already queued, so we need to wait for
// them to flush. E.g. contextmenu in Microsoft Edge // them to flush. E.g. contextmenu in Microsoft Edge
window.setTimeout(function (expected) { window.setTimeout(function(expected) {
// Only clear it if it's the expected grab (i.e. no one // Only clear it if it's the expected grab (i.e. no one
// else has initiated a new grab) // else has initiated a new grab)
if (_captureIndex === expected) { if (_captureIndex === expected) {
@ -142,4 +135,4 @@ function releaseCapture() {
window.removeEventListener('mousemove', _captureProxy); window.removeEventListener('mousemove', _captureProxy);
window.removeEventListener('mouseup', _captureProxy); window.removeEventListener('mouseup', _captureProxy);
} }
}; };

View file

@ -1,8 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright 2017 Pierre Ossman for Cendio AB * Copyright 2017 Pierre Ossman for Cendio AB
@ -12,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
*/ */
var EventTargetMixin = { var EventTargetMixin = {
_listeners: null, _listeners: null,
addEventListener: function (type, callback) { addEventListener: function(type, callback) {
if (!this._listeners) { if (!this._listeners) {
this._listeners = new Map(); this._listeners = new Map();
} }
@ -24,14 +19,14 @@ var EventTargetMixin = {
this._listeners.get(type).add(callback); this._listeners.get(type).add(callback);
}, },
removeEventListener: function (type, callback) { removeEventListener: function(type, callback) {
if (!this._listeners || !this._listeners.has(type)) { if (!this._listeners || !this._listeners.has(type)) {
return; return;
} }
this._listeners.get(type).delete(callback); this._listeners.get(type).delete(callback);
}, },
dispatchEvent: function (event) { dispatchEvent: function(event) {
if (!this._listeners || !this._listeners.has(event.type)) { if (!this._listeners || !this._listeners.has(event.type)) {
return true; return true;
} }
@ -39,7 +34,7 @@ var EventTargetMixin = {
callback.call(this, event); callback.call(this, event);
}, this); }, this);
return !event.defaultPrevented; return !event.defaultPrevented;
} },
}; };
exports.default = EventTargetMixin; export default EventTargetMixin;

View file

@ -1,10 +1,3 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.init_logging = init_logging;
exports.get_logging = get_logging;
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -24,24 +17,24 @@ var Info = function (msg) {};
var Warn = function (msg) {}; var Warn = function (msg) {};
var Error = function (msg) {}; var Error = function (msg) {};
function init_logging(level) { export function init_logging (level) {
if (typeof level === 'undefined') { if (typeof level === 'undefined') {
level = _log_level; level = _log_level;
} else { } else {
_log_level = level; _log_level = level;
} }
exports.Debug = Debug = exports.Info = Info = exports.Warn = Warn = exports.Error = Error = function (msg) {}; Debug = Info = Warn = Error = function (msg) {};
if (typeof window.console !== "undefined") { if (typeof window.console !== "undefined") {
switch (level) { switch (level) {
case 'debug': case 'debug':
exports.Debug = Debug = console.debug.bind(window.console); Debug = console.debug.bind(window.console);
case 'info': case 'info':
exports.Info = Info = console.info.bind(window.console); Info = console.info.bind(window.console);
case 'warn': case 'warn':
exports.Warn = Warn = console.warn.bind(window.console); Warn = console.warn.bind(window.console);
case 'error': case 'error':
exports.Error = Error = console.error.bind(window.console); Error = console.error.bind(window.console);
case 'none': case 'none':
break; break;
default: default:
@ -49,14 +42,10 @@ function init_logging(level) {
} }
} }
}; };
function get_logging() { export function get_logging () {
return _log_level; return _log_level;
}; };
exports.Debug = Debug; export { Debug, Info, Warn, Error };
exports.Info = Info;
exports.Warn = Warn;
exports.Error = Error;
// Initialize logging level // Initialize logging level
init_logging();
init_logging();

View file

@ -1,5 +1,3 @@
'use strict';
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright 2017 Pierre Ossman for noVNC * Copyright 2017 Pierre Ossman for noVNC
@ -12,12 +10,9 @@
if (typeof Object.assign != 'function') { if (typeof Object.assign != 'function') {
// Must be writable: true, enumerable: false, configurable: true // Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", { Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) { value: function assign(target, varArgs) { // .length of function is 2
// .length of function is 2
'use strict'; 'use strict';
if (target == null) { // TypeError if undefined or null
if (target == null) {
// TypeError if undefined or null
throw new TypeError('Cannot convert undefined or null to object'); throw new TypeError('Cannot convert undefined or null to object');
} }
@ -26,8 +21,7 @@ if (typeof Object.assign != 'function') {
for (var index = 1; index < arguments.length; index++) { for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index]; var nextSource = arguments[index];
if (nextSource != null) { if (nextSource != null) { // Skip over if undefined or null
// Skip over if undefined or null
for (var nextKey in nextSource) { for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed // Avoid bugs when hasOwnProperty is shadowed
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
@ -45,10 +39,10 @@ if (typeof Object.assign != 'function') {
/* CustomEvent constructor (taken from MDN) */ /* CustomEvent constructor (taken from MDN) */
(function () { (function () {
function CustomEvent(event, params) { function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined }; params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent('CustomEvent'); var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt; return evt;
} }
@ -57,4 +51,4 @@ if (typeof Object.assign != 'function') {
if (typeof window.CustomEvent !== "function") { if (typeof window.CustomEvent !== "function") {
window.CustomEvent = CustomEvent; window.CustomEvent = CustomEvent;
} }
})(); })();

View file

@ -1,9 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.decodeUTF8 = decodeUTF8;
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
@ -15,8 +9,7 @@ exports.decodeUTF8 = decodeUTF8;
/* /*
* Decode from UTF-8 * Decode from UTF-8
*/ */
function decodeUTF8(utf8string) { export function decodeUTF8 (utf8string) {
"use strict"; "use strict";
return decodeURIComponent(escape(utf8string));
return decodeURIComponent(escape(utf8string)); };
};

View file

@ -1,32 +1,35 @@
'use strict'; /*
* Websock: high-performance binary WebSockets
* Copyright (C) 2012 Joel Martin
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* Websock is similar to the standard WebSocket object but with extra
* buffer handling.
*
* Websock has built-in receive queue buffering; the message event
* does not contain actual data but is simply a notification that
* there is new data available. Several rQ* methods are available to
* read binary data off of the receive queue.
*/
Object.defineProperty(exports, "__esModule", { import * as Log from './util/logging.js';
value: true
});
exports.default = Websock;
var _logging = require('./util/logging.js'); export default function Websock() {
var Log = _interopRequireWildcard(_logging);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function Websock() {
"use strict"; "use strict";
this._websocket = null; // WebSocket object this._websocket = null; // WebSocket object
this._rQi = 0; // Receive queue index this._rQi = 0; // Receive queue index
this._rQlen = 0; // Next write position in the receive queue this._rQlen = 0; // Next write position in the receive queue
this._rQbufferSize = 1024 * 1024 * 4; // Receive queue buffer size (4 MiB) this._rQbufferSize = 1024 * 1024 * 4; // Receive queue buffer size (4 MiB)
this._rQmax = this._rQbufferSize / 8; this._rQmax = this._rQbufferSize / 8;
// called in init: this._rQ = new Uint8Array(this._rQbufferSize); // called in init: this._rQ = new Uint8Array(this._rQbufferSize);
this._rQ = null; // Receive queue this._rQ = null; // Receive queue
this._sQbufferSize = 1024 * 10; // 10 KiB this._sQbufferSize = 1024 * 10; // 10 KiB
// called in init: this._sQ = new Uint8Array(this._sQbufferSize); // called in init: this._sQ = new Uint8Array(this._sQbufferSize);
this._sQlen = 0; this._sQlen = 0;
this._sQ = null; // Send queue this._sQ = null; // Send queue
this._eventHandlers = { this._eventHandlers = {
'message': function () {}, 'message': function () {},
@ -34,44 +37,29 @@ function Websock() {
'close': function () {}, 'close': function () {},
'error': function () {} 'error': function () {}
}; };
} /* };
* Websock: high-performance binary WebSockets
* Copyright (C) 2012 Joel Martin
* Licensed under MPL 2.0 (see LICENSE.txt)
*
* Websock is similar to the standard WebSocket object but with extra
* buffer handling.
*
* Websock has built-in receive queue buffering; the message event
* does not contain actual data but is simply a notification that
* there is new data available. Several rQ* methods are available to
* read binary data off of the receive queue.
*/
;
// this has performance issues in some versions Chromium, and // this has performance issues in some versions Chromium, and
// doesn't gain a tremendous amount of performance increase in Firefox // 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. // at the moment. It may be valuable to turn it on in the future.
var ENABLE_COPYWITHIN = false; var ENABLE_COPYWITHIN = false;
var MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB var MAX_RQ_GROW_SIZE = 40 * 1024 * 1024; // 40 MiB
var typedArrayToString = function () { var typedArrayToString = (function () {
// This is only for PhantomJS, which doesn't like apply-ing // This is only for PhantomJS, which doesn't like apply-ing
// with Typed Arrays // with Typed Arrays
try { try {
var arr = new Uint8Array([1, 2, 3]); var arr = new Uint8Array([1, 2, 3]);
String.fromCharCode.apply(null, arr); String.fromCharCode.apply(null, arr);
return function (a) { return function (a) { return String.fromCharCode.apply(null, a); };
return String.fromCharCode.apply(null, a);
};
} catch (ex) { } catch (ex) {
return function (a) { return function (a) {
return String.fromCharCode.apply(null, Array.prototype.slice.call(a)); return String.fromCharCode.apply(
null, Array.prototype.slice.call(a));
}; };
} }
}(); })();
Websock.prototype = { Websock.prototype = {
// Getters and Setters // Getters and Setters
@ -114,34 +102,32 @@ Websock.prototype = {
// TODO(directxman12): test performance with these vs a DataView // TODO(directxman12): test performance with these vs a DataView
rQshift16: function () { rQshift16: function () {
return (this._rQ[this._rQi++] << 8) + this._rQ[this._rQi++]; return (this._rQ[this._rQi++] << 8) +
this._rQ[this._rQi++];
}, },
rQshift32: function () { rQshift32: function () {
return (this._rQ[this._rQi++] << 24) + (this._rQ[this._rQi++] << 16) + (this._rQ[this._rQi++] << 8) + this._rQ[this._rQi++]; return (this._rQ[this._rQi++] << 24) +
(this._rQ[this._rQi++] << 16) +
(this._rQ[this._rQi++] << 8) +
this._rQ[this._rQi++];
}, },
rQshiftStr: function (len) { rQshiftStr: function (len) {
if (typeof len === 'undefined') { if (typeof(len) === 'undefined') { len = this.rQlen(); }
len = this.rQlen();
}
var arr = new Uint8Array(this._rQ.buffer, this._rQi, len); var arr = new Uint8Array(this._rQ.buffer, this._rQi, len);
this._rQi += len; this._rQi += len;
return typedArrayToString(arr); return typedArrayToString(arr);
}, },
rQshiftBytes: function (len) { rQshiftBytes: function (len) {
if (typeof len === 'undefined') { if (typeof(len) === 'undefined') { len = this.rQlen(); }
len = this.rQlen();
}
this._rQi += len; this._rQi += len;
return new Uint8Array(this._rQ.buffer, this._rQi - len, len); return new Uint8Array(this._rQ.buffer, this._rQi - len, len);
}, },
rQshiftTo: function (target, len) { rQshiftTo: function (target, len) {
if (len === undefined) { if (len === undefined) { len = this.rQlen(); }
len = this.rQlen();
}
// TODO: make this just use set with views when using a ArrayBuffer to store the rQ // 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)); target.set(new Uint8Array(this._rQ.buffer, this._rQi, len));
this._rQi += len; this._rQi += len;
@ -225,7 +211,7 @@ Websock.prototype = {
this._websocket.binaryType = 'arraybuffer'; this._websocket.binaryType = 'arraybuffer';
this._websocket.onmessage = this._recv_message.bind(this); this._websocket.onmessage = this._recv_message.bind(this);
this._websocket.onopen = function () { this._websocket.onopen = (function () {
Log.Debug('>> WebSock.onopen'); Log.Debug('>> WebSock.onopen');
if (this._websocket.protocol) { if (this._websocket.protocol) {
Log.Info("Server choose sub-protocol: " + this._websocket.protocol); Log.Info("Server choose sub-protocol: " + this._websocket.protocol);
@ -233,29 +219,28 @@ Websock.prototype = {
this._eventHandlers.open(); this._eventHandlers.open();
Log.Debug("<< WebSock.onopen"); Log.Debug("<< WebSock.onopen");
}.bind(this); }).bind(this);
this._websocket.onclose = function (e) { this._websocket.onclose = (function (e) {
Log.Debug(">> WebSock.onclose"); Log.Debug(">> WebSock.onclose");
this._eventHandlers.close(e); this._eventHandlers.close(e);
Log.Debug("<< WebSock.onclose"); Log.Debug("<< WebSock.onclose");
}.bind(this); }).bind(this);
this._websocket.onerror = function (e) { this._websocket.onerror = (function (e) {
Log.Debug(">> WebSock.onerror: " + e); Log.Debug(">> WebSock.onerror: " + e);
this._eventHandlers.error(e); this._eventHandlers.error(e);
Log.Debug("<< WebSock.onerror: " + e); Log.Debug("<< WebSock.onerror: " + e);
}.bind(this); }).bind(this);
}, },
close: function () { close: function () {
if (this._websocket) { if (this._websocket) {
if (this._websocket.readyState === WebSocket.OPEN || this._websocket.readyState === WebSocket.CONNECTING) { if ((this._websocket.readyState === WebSocket.OPEN) ||
(this._websocket.readyState === WebSocket.CONNECTING)) {
Log.Info("Closing WebSocket connection"); Log.Info("Closing WebSocket connection");
this._websocket.close(); this._websocket.close();
} }
this._websocket.onmessage = function (e) { this._websocket.onmessage = function (e) { return; };
return;
};
} }
}, },
@ -328,4 +313,4 @@ Websock.prototype = {
Log.Debug("Ignoring empty message"); Log.Debug("Ignoring empty message");
} }
} }
}; };

View file

View file

@ -0,0 +1,15 @@
Custom Browser ES Module Loader
===============================
This is a module loader using babel and the ES Module Loader polyfill.
It's based heavily on
https://github.com/ModuleLoader/browser-es-module-loader, but uses
WebWorkers to compile the modules in the background.
To generate, run `rollup -c` in this directory, and then run `browserify
src/babel-worker.js > dist/babel-worker.js`.
LICENSE
-------
MIT

View file

@ -0,0 +1,23 @@
/*import { transform as babelTransform } from 'babel-core';
import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
// sadly, due to how rollup works, we can't use es6 imports here
var babelTransform = require('babel-core').transform;
var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
self.onmessage = function (evt) {
// transform source with Babel
var output = babelTransform(evt.data.source, {
compact: false,
filename: evt.data.key + '!transpiled',
sourceFileName: evt.data.key,
moduleIds: false,
sourceMaps: 'inline',
babelrc: false,
plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
});
self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
};

View file

@ -0,0 +1,273 @@
import RegisterLoader from 'es-module-loader/core/register-loader.js';
import { InternalModuleNamespace as ModuleNamespace } from 'es-module-loader/core/loader-polyfill.js';
import { baseURI, global, isBrowser } from 'es-module-loader/core/common.js';
import { resolveIfNotPlain } from 'es-module-loader/core/resolve.js';
var loader;
// <script type="module"> support
var anonSources = {};
if (typeof document != 'undefined' && document.getElementsByTagName) {
var handleError = function(err) {
// dispatch an error event so that we can display in errors in browsers
// that don't yet support unhandledrejection
if (window.onunhandledrejection === undefined) {
try {
var evt = new Event('error');
} catch (_eventError) {
var evt = document.createEvent('Event');
evt.initEvent('error', true, true);
}
evt.message = err.message;
if (err.fileName) {
evt.filename = err.fileName;
evt.lineno = err.lineNumber;
evt.colno = err.columnNumber;
} else if (err.sourceURL) {
evt.filename = err.sourceURL;
evt.lineno = err.line;
evt.colno = err.column;
}
evt.error = err;
window.dispatchEvent(evt);
}
// throw so it still shows up in the console
throw err;
}
var ready = function() {
document.removeEventListener('DOMContentLoaded', ready, false );
var anonCnt = 0;
var scripts = document.getElementsByTagName('script');
for (var i = 0; i < scripts.length; i++) {
var script = scripts[i];
if (script.type == 'module' && !script.loaded) {
script.loaded = true;
if (script.src) {
loader.import(script.src).catch(handleError);
}
// anonymous modules supported via a custom naming scheme and registry
else {
var uri = './<anon' + ++anonCnt + '>.js';
if (script.id !== ""){
uri = "./" + script.id;
}
var anonName = resolveIfNotPlain(uri, baseURI);
anonSources[anonName] = script.innerHTML;
loader.import(anonName).catch(handleError);
}
}
}
}
// simple DOM ready
if (document.readyState === 'complete')
setTimeout(ready);
else
document.addEventListener('DOMContentLoaded', ready, false);
}
function BrowserESModuleLoader(baseKey) {
if (baseKey)
this.baseKey = resolveIfNotPlain(baseKey, baseURI) || resolveIfNotPlain('./' + baseKey, baseURI);
RegisterLoader.call(this);
var loader = this;
// ensure System.register is available
global.System = global.System || {};
if (typeof global.System.register == 'function')
var prevRegister = global.System.register;
global.System.register = function() {
loader.register.apply(loader, arguments);
if (prevRegister)
prevRegister.apply(this, arguments);
};
}
BrowserESModuleLoader.prototype = Object.create(RegisterLoader.prototype);
// normalize is never given a relative name like "./x", that part is already handled
BrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent) {
var resolved = RegisterLoader.prototype[RegisterLoader.resolve].call(this, key, parent || this.baseKey) || key;
if (!resolved)
throw new RangeError('ES module loader does not resolve plain module names, resolving "' + key + '" to ' + parent);
return resolved;
};
function xhrFetch(url, resolve, reject) {
var xhr = new XMLHttpRequest();
var load = function(source) {
resolve(xhr.responseText);
}
var error = function() {
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
}
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
// in Chrome on file:/// URLs, status is 0
if (xhr.status == 0) {
if (xhr.responseText) {
load();
}
else {
// when responseText is empty, wait for load or error event
// to inform if it is a 404 or empty file
xhr.addEventListener('error', error);
xhr.addEventListener('load', load);
}
}
else if (xhr.status === 200) {
load();
}
else {
error();
}
}
};
xhr.open("GET", url, true);
xhr.send(null);
}
var WorkerPool = function (script, size) {
var current = document.currentScript;
// IE doesn't support currentScript
if (!current) {
// We should be the last loaded script
var scripts = document.getElementsByTagName('script');
current = scripts[scripts.length - 1];
}
script = current.src.substr(0, current.src.lastIndexOf("/")) + "/" + script;
this._workers = new Array(size);
this._ind = 0;
this._size = size;
this._jobs = 0;
this.onmessage = undefined;
this._stopTimeout = undefined;
for (var i = 0; i < size; i++) {
var wrkr = new Worker(script);
wrkr._count = 0;
wrkr._ind = i;
wrkr.onmessage = this._onmessage.bind(this, wrkr);
wrkr.onerror = this._onerror.bind(this);
this._workers[i] = wrkr;
}
this._checkJobs();
};
WorkerPool.prototype = {
postMessage: function (msg) {
if (this._stopTimeout !== undefined) {
clearTimeout(this._stopTimeout);
this._stopTimeout = undefined;
}
var wrkr = this._workers[this._ind % this._size];
wrkr._count++;
this._jobs++;
wrkr.postMessage(msg);
this._ind++;
},
_onmessage: function (wrkr, evt) {
wrkr._count--;
this._jobs--;
this.onmessage(evt, wrkr);
this._checkJobs();
},
_onerror: function(err) {
try {
var evt = new Event('error');
} catch (_eventError) {
var evt = document.createEvent('Event');
evt.initEvent('error', true, true);
}
evt.message = err.message;
evt.filename = err.filename;
evt.lineno = err.lineno;
evt.colno = err.colno;
evt.error = err.error;
window.dispatchEvent(evt);
},
_checkJobs: function () {
if (this._jobs === 0 && this._stopTimeout === undefined) {
// wait for 2s of inactivity before stopping (that should be enough for local loading)
this._stopTimeout = setTimeout(this._stop.bind(this), 2000);
}
},
_stop: function () {
this._workers.forEach(function(wrkr) {
wrkr.terminate();
});
}
};
var promiseMap = new Map();
var babelWorker = new WorkerPool('babel-worker.js', 3);
babelWorker.onmessage = function (evt) {
var promFuncs = promiseMap.get(evt.data.key);
promFuncs.resolve(evt.data);
promiseMap.delete(evt.data.key);
};
// instantiate just needs to run System.register
// so we fetch the source, convert into the Babel System module format, then evaluate it
BrowserESModuleLoader.prototype[RegisterLoader.instantiate] = function(key, processAnonRegister) {
var loader = this;
// load as ES with Babel converting into System.register
return new Promise(function(resolve, reject) {
// anonymous module
if (anonSources[key]) {
resolve(anonSources[key])
anonSources[key] = undefined;
}
// otherwise we fetch
else {
xhrFetch(key, resolve, reject);
}
})
.then(function(source) {
// check our cache first
var cacheEntry = localStorage.getItem(key);
if (cacheEntry) {
cacheEntry = JSON.parse(cacheEntry);
// TODO: store a hash instead
if (cacheEntry.source === source) {
return Promise.resolve({key: key, code: cacheEntry.code, source: cacheEntry.source});
}
}
return new Promise(function (resolve, reject) {
promiseMap.set(key, {resolve: resolve, reject: reject});
babelWorker.postMessage({key: key, source: source});
});
}).then(function (data) {
// evaluate without require, exports and module variables
// we leave module in for now to allow module.require access
try {
var cacheEntry = JSON.stringify({source: data.source, code: data.code});
localStorage.setItem(key, cacheEntry);
} catch (e) {
if (window.console) {
window.console.warn('Unable to cache transpiled version of ' + key + ': ' + e);
}
}
(0, eval)(data.code + '\n//# sourceURL=' + data.key + '!transpiled');
processAnonRegister();
});
};
// create a default loader instance in the browser
if (isBrowser)
loader = new BrowserESModuleLoader();
export default BrowserESModuleLoader;

21
static/js/novnc/vendor/pako/LICENSE vendored Executable file
View file

@ -0,0 +1,21 @@
(The MIT License)
Copyright (C) 2014-2016 by Vitaly Puzrin
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.

6
static/js/novnc/vendor/pako/README.md vendored Executable file
View file

@ -0,0 +1,6 @@
This is an ES6-modules-compatible version of
https://github.com/nodeca/pako, based on pako version 1.0.3.
It's more-or-less a direct translation of the original, with unused parts
removed, and the dynamic support for non-typed arrays removed (since ES6
modules don't work well with dynamic exports).

View file

@ -1,24 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.shrinkBuf = shrinkBuf;
exports.arraySet = arraySet;
exports.flattenChunks = flattenChunks;
// reduce buffer size, avoiding mem copy // reduce buffer size, avoiding mem copy
function shrinkBuf(buf, size) { export function shrinkBuf (buf, size) {
if (buf.length === size) { if (buf.length === size) { return buf; }
return buf; if (buf.subarray) { return buf.subarray(0, size); }
}
if (buf.subarray) {
return buf.subarray(0, size);
}
buf.length = size; buf.length = size;
return buf; return buf;
}; };
function arraySet(dest, src, src_offs, len, dest_offs) {
export function arraySet (dest, src, src_offs, len, dest_offs) {
if (src.subarray && dest.subarray) { if (src.subarray && dest.subarray) {
dest.set(src.subarray(src_offs, src_offs + len), dest_offs); dest.set(src.subarray(src_offs, src_offs + len), dest_offs);
return; return;
@ -30,7 +19,7 @@ function arraySet(dest, src, src_offs, len, dest_offs) {
} }
// Join array of chunks to single array. // Join array of chunks to single array.
function flattenChunks(chunks) { export function flattenChunks (chunks) {
var i, l, len, pos, chunk, result; var i, l, len, pos, chunk, result;
// calculate data length // calculate data length
@ -51,6 +40,6 @@ function flattenChunks(chunks) {
return result; return result;
} }
var Buf8 = exports.Buf8 = Uint8Array; export var Buf8 = Uint8Array;
var Buf16 = exports.Buf16 = Uint16Array; export var Buf16 = Uint16Array;
var Buf32 = exports.Buf32 = Int32Array; export var Buf32 = Int32Array;

View file

@ -1,16 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = adler32;
// Note: adler32 takes 12% for level 0 and 2% for level 6. // Note: adler32 takes 12% for level 0 and 2% for level 6.
// It doesn't worth to make additional optimizationa as in original. // It doesn't worth to make additional optimizationa as in original.
// Small size is preferable. // Small size is preferable.
function adler32(adler, buf, len, pos) { export default function adler32(adler, buf, len, pos) {
var s1 = adler & 0xffff | 0, var s1 = (adler & 0xffff) |0,
s2 = adler >>> 16 & 0xffff | 0, s2 = ((adler >>> 16) & 0xffff) |0,
n = 0; n = 0;
while (len !== 0) { while (len !== 0) {
@ -21,13 +15,13 @@ function adler32(adler, buf, len, pos) {
len -= n; len -= n;
do { do {
s1 = s1 + buf[pos++] | 0; s1 = (s1 + buf[pos++]) |0;
s2 = s2 + s1 | 0; s2 = (s2 + s1) |0;
} while (--n); } while (--n);
s1 %= 65521; s1 %= 65521;
s2 %= 65521; s2 %= 65521;
} }
return s1 | s2 << 16 | 0; return (s1 | (s2 << 16)) |0;
} }

View file

@ -1,51 +1,47 @@
"use strict"; export default {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = {
/* Allowed flush values; see deflate() and inflate() below for details */ /* Allowed flush values; see deflate() and inflate() below for details */
Z_NO_FLUSH: 0, Z_NO_FLUSH: 0,
Z_PARTIAL_FLUSH: 1, Z_PARTIAL_FLUSH: 1,
Z_SYNC_FLUSH: 2, Z_SYNC_FLUSH: 2,
Z_FULL_FLUSH: 3, Z_FULL_FLUSH: 3,
Z_FINISH: 4, Z_FINISH: 4,
Z_BLOCK: 5, Z_BLOCK: 5,
Z_TREES: 6, Z_TREES: 6,
/* Return codes for the compression/decompression functions. Negative values /* Return codes for the compression/decompression functions. Negative values
* are errors, positive values are used for special but normal events. * are errors, positive values are used for special but normal events.
*/ */
Z_OK: 0, Z_OK: 0,
Z_STREAM_END: 1, Z_STREAM_END: 1,
Z_NEED_DICT: 2, Z_NEED_DICT: 2,
Z_ERRNO: -1, Z_ERRNO: -1,
Z_STREAM_ERROR: -2, Z_STREAM_ERROR: -2,
Z_DATA_ERROR: -3, Z_DATA_ERROR: -3,
//Z_MEM_ERROR: -4, //Z_MEM_ERROR: -4,
Z_BUF_ERROR: -5, Z_BUF_ERROR: -5,
//Z_VERSION_ERROR: -6, //Z_VERSION_ERROR: -6,
/* compression levels */ /* compression levels */
Z_NO_COMPRESSION: 0, Z_NO_COMPRESSION: 0,
Z_BEST_SPEED: 1, Z_BEST_SPEED: 1,
Z_BEST_COMPRESSION: 9, Z_BEST_COMPRESSION: 9,
Z_DEFAULT_COMPRESSION: -1, Z_DEFAULT_COMPRESSION: -1,
Z_FILTERED: 1,
Z_HUFFMAN_ONLY: 2, Z_FILTERED: 1,
Z_RLE: 3, Z_HUFFMAN_ONLY: 2,
Z_FIXED: 4, Z_RLE: 3,
Z_DEFAULT_STRATEGY: 0, Z_FIXED: 4,
Z_DEFAULT_STRATEGY: 0,
/* Possible values of the data_type field (though see inflate()) */ /* Possible values of the data_type field (though see inflate()) */
Z_BINARY: 0, Z_BINARY: 0,
Z_TEXT: 1, Z_TEXT: 1,
//Z_ASCII: 1, // = Z_TEXT (deprecated) //Z_ASCII: 1, // = Z_TEXT (deprecated)
Z_UNKNOWN: 2, Z_UNKNOWN: 2,
/* The deflate compression method */ /* The deflate compression method */
Z_DEFLATED: 8 Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type //Z_NULL: null // Use -1 or null inline, depending on var type
}; };

View file

@ -1,23 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = makeTable;
// Note: we can't get significant speed boost here. // Note: we can't get significant speed boost here.
// So write code to minimize size - no pregenerated tables // So write code to minimize size - no pregenerated tables
// and array tools dependencies. // and array tools dependencies.
// Use ordinary array, since untyped makes no boost here // Use ordinary array, since untyped makes no boost here
function makeTable() { export default function makeTable() {
var c, var c, table = [];
table = [];
for (var n = 0; n < 256; n++) { for (var n = 0; n < 256; n++) {
c = n; c = n;
for (var k = 0; k < 8; k++) { for (var k = 0; k < 8; k++) {
c = c & 1 ? 0xEDB88320 ^ c >>> 1 : c >>> 1; c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
} }
table[n] = c; table[n] = c;
} }
@ -28,6 +21,7 @@ function makeTable() {
// Create table on load. Just 255 signed longs. Not a problem. // Create table on load. Just 255 signed longs. Not a problem.
var crcTable = makeTable(); var crcTable = makeTable();
function crc32(crc, buf, len, pos) { function crc32(crc, buf, len, pos) {
var t = crcTable, var t = crcTable,
end = pos + len; end = pos + len;
@ -35,8 +29,8 @@ function crc32(crc, buf, len, pos) {
crc ^= -1; crc ^= -1;
for (var i = pos; i < end; i++) { for (var i = pos; i < end; i++) {
crc = crc >>> 8 ^ t[(crc ^ buf[i]) & 0xFF]; crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
} }
return crc ^ -1; // >>> 0; return (crc ^ (-1)); // >>> 0;
} }

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,17 @@
'use strict'; export default function GZheader() {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = GZheader;
function GZheader() {
/* true if compressed data believed to be text */ /* true if compressed data believed to be text */
this.text = 0; this.text = 0;
/* modification time */ /* modification time */
this.time = 0; this.time = 0;
/* extra flags (not used when writing a gzip file) */ /* extra flags (not used when writing a gzip file) */
this.xflags = 0; this.xflags = 0;
/* operating system */ /* operating system */
this.os = 0; this.os = 0;
/* pointer to extra field or Z_NULL if none */ /* pointer to extra field or Z_NULL if none */
this.extra = null; this.extra = null;
/* extra field length (valid if extra != Z_NULL) */ /* extra field length (valid if extra != Z_NULL) */
this.extra_len = 0; // Actually, we don't need it in JS, this.extra_len = 0; // Actually, we don't need it in JS,
// but leave for few code modifications // but leave for few code modifications
// //
// Setup limits is not necessary because in js we should not preallocate memory // Setup limits is not necessary because in js we should not preallocate memory
@ -27,15 +21,15 @@ function GZheader() {
/* space at extra (only when reading header) */ /* space at extra (only when reading header) */
// this.extra_max = 0; // this.extra_max = 0;
/* pointer to zero-terminated file name or Z_NULL */ /* pointer to zero-terminated file name or Z_NULL */
this.name = ''; this.name = '';
/* space at name (only when reading header) */ /* space at name (only when reading header) */
// this.name_max = 0; // this.name_max = 0;
/* pointer to zero-terminated comment or Z_NULL */ /* pointer to zero-terminated comment or Z_NULL */
this.comment = ''; this.comment = '';
/* space at comment (only when reading header) */ /* space at comment (only when reading header) */
// this.comm_max = 0; // this.comm_max = 0;
/* true if there was or will be a header crc */ /* true if there was or will be a header crc */
this.hcrc = 0; this.hcrc = 0;
/* true when done reading gzip header (not used when writing a gzip file) */ /* true when done reading gzip header (not used when writing a gzip file) */
this.done = false; this.done = false;
} }

View file

@ -1,12 +1,6 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inflate_fast;
// See state defs from inflate.js // See state defs from inflate.js
var BAD = 30; /* got a data error -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */
var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
/* /*
Decode literal, length, and distance codes and write out the resulting Decode literal, length, and distance codes and write out the resulting
@ -43,35 +37,36 @@ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */
requires strm.avail_out >= 258 for each loop to avoid checking for requires strm.avail_out >= 258 for each loop to avoid checking for
output space. output space.
*/ */
function inflate_fast(strm, start) { export default function inflate_fast(strm, start) {
var state; var state;
var _in; /* local strm.input */ var _in; /* local strm.input */
var last; /* have enough input while in < last */ var last; /* have enough input while in < last */
var _out; /* local strm.output */ var _out; /* local strm.output */
var beg; /* inflate()'s initial strm.output */ var beg; /* inflate()'s initial strm.output */
var end; /* while out < end, enough space available */ var end; /* while out < end, enough space available */
//#ifdef INFLATE_STRICT //#ifdef INFLATE_STRICT
var dmax; /* maximum distance from zlib header */ var dmax; /* maximum distance from zlib header */
//#endif //#endif
var wsize; /* window size or zero if not using window */ var wsize; /* window size or zero if not using window */
var whave; /* valid bytes in the window */ var whave; /* valid bytes in the window */
var wnext; /* window write index */ var wnext; /* window write index */
// Use `s_window` instead `window`, avoid conflict with instrumentation tools // Use `s_window` instead `window`, avoid conflict with instrumentation tools
var s_window; /* allocated sliding window, if wsize != 0 */ var s_window; /* allocated sliding window, if wsize != 0 */
var hold; /* local strm.hold */ var hold; /* local strm.hold */
var bits; /* local strm.bits */ var bits; /* local strm.bits */
var lcode; /* local strm.lencode */ var lcode; /* local strm.lencode */
var dcode; /* local strm.distcode */ var dcode; /* local strm.distcode */
var lmask; /* mask for first level of length codes */ var lmask; /* mask for first level of length codes */
var dmask; /* mask for first level of distance codes */ var dmask; /* mask for first level of distance codes */
var here; /* retrieved table entry */ var here; /* retrieved table entry */
var op; /* code bits, operation, extra bits, or */ var op; /* code bits, operation, extra bits, or */
/* window position, window bytes to copy */ /* window position, window bytes to copy */
var len; /* match length, unused bytes */ var len; /* match length, unused bytes */
var dist; /* match distance */ var dist; /* match distance */
var from; /* where to copy match from */ var from; /* where to copy match from */
var from_source; var from_source;
var input, output; // JS specific, because we have no pointers var input, output; // JS specific, because we have no pointers
/* copy state to local variables */ /* copy state to local variables */
@ -84,9 +79,9 @@ function inflate_fast(strm, start) {
output = strm.output; output = strm.output;
beg = _out - (start - strm.avail_out); beg = _out - (start - strm.avail_out);
end = _out + (strm.avail_out - 257); end = _out + (strm.avail_out - 257);
//#ifdef INFLATE_STRICT //#ifdef INFLATE_STRICT
dmax = state.dmax; dmax = state.dmax;
//#endif //#endif
wsize = state.wsize; wsize = state.wsize;
whave = state.whave; whave = state.whave;
wnext = state.wnext; wnext = state.wnext;
@ -98,10 +93,12 @@ function inflate_fast(strm, start) {
lmask = (1 << state.lenbits) - 1; lmask = (1 << state.lenbits) - 1;
dmask = (1 << state.distbits) - 1; dmask = (1 << state.distbits) - 1;
/* decode literals and length/distances until end-of-block or not enough /* decode literals and length/distances until end-of-block or not enough
input data or output space */ input data or output space */
top: do { top:
do {
if (bits < 15) { if (bits < 15) {
hold += input[_in++] << bits; hold += input[_in++] << bits;
bits += 8; bits += 8;
@ -111,28 +108,27 @@ function inflate_fast(strm, start) {
here = lcode[hold & lmask]; here = lcode[hold & lmask];
dolen: for (;;) { dolen:
// Goto emulation for (;;) { // Goto emulation
op = here >>> 24 /*here.bits*/; op = here >>> 24/*here.bits*/;
hold >>>= op; hold >>>= op;
bits -= op; bits -= op;
op = here >>> 16 & 0xff /*here.op*/; op = (here >>> 16) & 0xff/*here.op*/;
if (op === 0) { if (op === 0) { /* literal */
/* literal */
//Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
// "inflate: literal '%c'\n" : // "inflate: literal '%c'\n" :
// "inflate: literal 0x%02x\n", here.val)); // "inflate: literal 0x%02x\n", here.val));
output[_out++] = here & 0xffff /*here.val*/; output[_out++] = here & 0xffff/*here.val*/;
} else if (op & 16) { }
/* length base */ else if (op & 16) { /* length base */
len = here & 0xffff /*here.val*/; len = here & 0xffff/*here.val*/;
op &= 15; /* number of extra bits */ op &= 15; /* number of extra bits */
if (op) { if (op) {
if (bits < op) { if (bits < op) {
hold += input[_in++] << bits; hold += input[_in++] << bits;
bits += 8; bits += 8;
} }
len += hold & (1 << op) - 1; len += hold & ((1 << op) - 1);
hold >>>= op; hold >>>= op;
bits -= op; bits -= op;
} }
@ -145,17 +141,16 @@ function inflate_fast(strm, start) {
} }
here = dcode[hold & dmask]; here = dcode[hold & dmask];
dodist: for (;;) { dodist:
// goto emulation for (;;) { // goto emulation
op = here >>> 24 /*here.bits*/; op = here >>> 24/*here.bits*/;
hold >>>= op; hold >>>= op;
bits -= op; bits -= op;
op = here >>> 16 & 0xff /*here.op*/; op = (here >>> 16) & 0xff/*here.op*/;
if (op & 16) { if (op & 16) { /* distance base */
/* distance base */ dist = here & 0xffff/*here.val*/;
dist = here & 0xffff /*here.val*/; op &= 15; /* number of extra bits */
op &= 15; /* number of extra bits */
if (bits < op) { if (bits < op) {
hold += input[_in++] << bits; hold += input[_in++] << bits;
bits += 8; bits += 8;
@ -164,21 +159,20 @@ function inflate_fast(strm, start) {
bits += 8; bits += 8;
} }
} }
dist += hold & (1 << op) - 1; dist += hold & ((1 << op) - 1);
//#ifdef INFLATE_STRICT //#ifdef INFLATE_STRICT
if (dist > dmax) { if (dist > dmax) {
strm.msg = 'invalid distance too far back'; strm.msg = 'invalid distance too far back';
state.mode = BAD; state.mode = BAD;
break top; break top;
} }
//#endif //#endif
hold >>>= op; hold >>>= op;
bits -= op; bits -= op;
//Tracevv((stderr, "inflate: distance %u\n", dist)); //Tracevv((stderr, "inflate: distance %u\n", dist));
op = _out - beg; /* max distance in output */ op = _out - beg; /* max distance in output */
if (dist > op) { if (dist > op) { /* see if copy from window */
/* see if copy from window */ op = dist - op; /* distance back in window */
op = dist - op; /* distance back in window */
if (op > whave) { if (op > whave) {
if (state.sane) { if (state.sane) {
strm.msg = 'invalid distance too far back'; strm.msg = 'invalid distance too far back';
@ -186,74 +180,69 @@ function inflate_fast(strm, start) {
break top; break top;
} }
// (!) This block is disabled in zlib defailts, // (!) This block is disabled in zlib defailts,
// don't enable it for binary compatibility // don't enable it for binary compatibility
//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
// if (len <= op - whave) { // if (len <= op - whave) {
// do { // do {
// output[_out++] = 0; // output[_out++] = 0;
// } while (--len); // } while (--len);
// continue top; // continue top;
// } // }
// len -= op - whave; // len -= op - whave;
// do { // do {
// output[_out++] = 0; // output[_out++] = 0;
// } while (--op > whave); // } while (--op > whave);
// if (op === 0) { // if (op === 0) {
// from = _out - dist; // from = _out - dist;
// do { // do {
// output[_out++] = output[from++]; // output[_out++] = output[from++];
// } while (--len); // } while (--len);
// continue top; // continue top;
// } // }
//#endif //#endif
} }
from = 0; // window index from = 0; // window index
from_source = s_window; from_source = s_window;
if (wnext === 0) { if (wnext === 0) { /* very common case */
/* very common case */
from += wsize - op; from += wsize - op;
if (op < len) { if (op < len) { /* some from window */
/* some from window */
len -= op; len -= op;
do { do {
output[_out++] = s_window[from++]; output[_out++] = s_window[from++];
} while (--op); } while (--op);
from = _out - dist; /* rest from output */ from = _out - dist; /* rest from output */
from_source = output; from_source = output;
} }
} else if (wnext < op) { }
/* wrap around window */ else if (wnext < op) { /* wrap around window */
from += wsize + wnext - op; from += wsize + wnext - op;
op -= wnext; op -= wnext;
if (op < len) { if (op < len) { /* some from end of window */
/* some from end of window */
len -= op; len -= op;
do { do {
output[_out++] = s_window[from++]; output[_out++] = s_window[from++];
} while (--op); } while (--op);
from = 0; from = 0;
if (wnext < len) { if (wnext < len) { /* some from start of window */
/* some from start of window */
op = wnext; op = wnext;
len -= op; len -= op;
do { do {
output[_out++] = s_window[from++]; output[_out++] = s_window[from++];
} while (--op); } while (--op);
from = _out - dist; /* rest from output */ from = _out - dist; /* rest from output */
from_source = output; from_source = output;
} }
} }
} else { }
/* contiguous in window */ else { /* contiguous in window */
from += wnext - op; from += wnext - op;
if (op < len) { if (op < len) { /* some from window */
/* some from window */
len -= op; len -= op;
do { do {
output[_out++] = s_window[from++]; output[_out++] = s_window[from++];
} while (--op); } while (--op);
from = _out - dist; /* rest from output */ from = _out - dist; /* rest from output */
from_source = output; from_source = output;
} }
} }
@ -269,10 +258,10 @@ function inflate_fast(strm, start) {
output[_out++] = from_source[from++]; output[_out++] = from_source[from++];
} }
} }
} else { }
from = _out - dist; /* copy direct from output */ else {
do { from = _out - dist; /* copy direct from output */
/* minimum length is three */ do { /* minimum length is three */
output[_out++] = output[from++]; output[_out++] = output[from++];
output[_out++] = output[from++]; output[_out++] = output[from++];
output[_out++] = output[from++]; output[_out++] = output[from++];
@ -285,11 +274,12 @@ function inflate_fast(strm, start) {
} }
} }
} }
} else if ((op & 64) === 0) { }
/* 2nd level distance code */ else if ((op & 64) === 0) { /* 2nd level distance code */
here = dcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)]; here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
continue dodist; continue dodist;
} else { }
else {
strm.msg = 'invalid distance code'; strm.msg = 'invalid distance code';
state.mode = BAD; state.mode = BAD;
break top; break top;
@ -297,16 +287,17 @@ function inflate_fast(strm, start) {
break; // need to emulate goto via "continue" break; // need to emulate goto via "continue"
} }
} else if ((op & 64) === 0) { }
/* 2nd level length code */ else if ((op & 64) === 0) { /* 2nd level length code */
here = lcode[(here & 0xffff) + ( /*here.val*/hold & (1 << op) - 1)]; here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))];
continue dolen; continue dolen;
} else if (op & 32) { }
/* end-of-block */ else if (op & 32) { /* end-of-block */
//Tracevv((stderr, "inflate: end of block\n")); //Tracevv((stderr, "inflate: end of block\n"));
state.mode = TYPE; state.mode = TYPE;
break top; break top;
} else { }
else {
strm.msg = 'invalid literal/length code'; strm.msg = 'invalid literal/length code';
state.mode = BAD; state.mode = BAD;
break top; break top;
@ -325,9 +316,9 @@ function inflate_fast(strm, start) {
/* update state and return */ /* update state and return */
strm.next_in = _in; strm.next_in = _in;
strm.next_out = _out; strm.next_out = _out;
strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last));
strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end));
state.hold = hold; state.hold = hold;
state.bits = bits; state.bits = bits;
return; return;
}; };

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,4 @@
"use strict"; import * as utils from "../utils/common.js";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = inflate_table;
var _common = require("../utils/common.js");
var utils = _interopRequireWildcard(_common);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var MAXBITS = 15; var MAXBITS = 15;
var ENOUGH_LENS = 852; var ENOUGH_LENS = 852;
@ -20,41 +9,51 @@ var CODES = 0;
var LENS = 1; var LENS = 1;
var DISTS = 2; var DISTS = 2;
var lbase = [/* Length codes 257..285 base */ var lbase = [ /* Length codes 257..285 base */
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0]; 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
];
var lext = [/* Length codes 257..285 extra */ var lext = [ /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78]; 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78
];
var dbase = [/* Distance codes 0..29 base */ var dbase = [ /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0]; 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
8193, 12289, 16385, 24577, 0, 0
];
var dext = [/* Distance codes 0..29 extra */ var dext = [ /* Distance codes 0..29 extra */
16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64]; 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
23, 23, 24, 24, 25, 25, 26, 26, 27, 27,
28, 28, 29, 29, 64, 64
];
function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { export default function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts)
{
var bits = opts.bits; var bits = opts.bits;
//here = opts.here; /* table entry for duplication */ //here = opts.here; /* table entry for duplication */
var len = 0; /* a code's length in bits */ var len = 0; /* a code's length in bits */
var sym = 0; /* index of code symbols */ var sym = 0; /* index of code symbols */
var min = 0, var min = 0, max = 0; /* minimum and maximum code lengths */
max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */
var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */
var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */
var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */
var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */
var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */
var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */
var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */
var fill; /* index for replicating entries */ var low; /* low bits for current root entry */
var low; /* low bits for current root entry */ var mask; /* mask for low root bits */
var mask; /* mask for low root bits */ var next; /* next available space in table */
var next; /* next available space in table */ var base = null; /* base value table to use */
var base = null; /* base value table to use */
var base_index = 0; var base_index = 0;
// var shoextra; /* extra bits table to use */ // var shoextra; /* extra bits table to use */
var end; /* use base and extra for symbol > end */ var end; /* use base and extra for symbol > end */
var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */
var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */
var extra = null; var extra = null;
@ -74,16 +73,19 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
from their more natural integer increment ordering, and so when the from their more natural integer increment ordering, and so when the
decoding tables are built in the large loop below, the integer codes decoding tables are built in the large loop below, the integer codes
are incremented backwards. are incremented backwards.
This routine assumes, but does not check, that all of the entries in
This routine assumes, but does not check, that all of the entries in
lens[] are in the range 0..MAXBITS. The caller must assure this. lens[] are in the range 0..MAXBITS. The caller must assure this.
1..MAXBITS is interpreted as that code length. zero means that that 1..MAXBITS is interpreted as that code length. zero means that that
symbol does not occur in this code. symbol does not occur in this code.
The codes are sorted by computing a count of codes for each length,
The codes are sorted by computing a count of codes for each length,
creating from that a table of starting indices for each length in the creating from that a table of starting indices for each length in the
sorted table, and then entering the symbols in order in the sorted sorted table, and then entering the symbols in order in the sorted
table. The sorted table is work[], with that space being provided by table. The sorted table is work[], with that space being provided by
the caller. the caller.
The length counts are used for other purposes as well, i.e. finding
The length counts are used for other purposes as well, i.e. finding
the minimum and maximum length codes, determining if there are any the minimum and maximum length codes, determining if there are any
codes at all, checking for a valid set of lengths, and looking ahead codes at all, checking for a valid set of lengths, and looking ahead
at length counts to determine sub-table sizes when building the at length counts to determine sub-table sizes when building the
@ -101,32 +103,28 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
/* bound code lengths, force root to be within code lengths */ /* bound code lengths, force root to be within code lengths */
root = bits; root = bits;
for (max = MAXBITS; max >= 1; max--) { for (max = MAXBITS; max >= 1; max--) {
if (count[max] !== 0) { if (count[max] !== 0) { break; }
break;
}
} }
if (root > max) { if (root > max) {
root = max; root = max;
} }
if (max === 0) { if (max === 0) { /* no symbols to code at all */
/* no symbols to code at all */
//table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */
//table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.bits[opts.table_index] = 1; //here.bits = (var char)1;
//table.val[opts.table_index++] = 0; //here.val = (var short)0; //table.val[opts.table_index++] = 0; //here.val = (var short)0;
table[table_index++] = 1 << 24 | 64 << 16 | 0; table[table_index++] = (1 << 24) | (64 << 16) | 0;
//table.op[opts.table_index] = 64; //table.op[opts.table_index] = 64;
//table.bits[opts.table_index] = 1; //table.bits[opts.table_index] = 1;
//table.val[opts.table_index++] = 0; //table.val[opts.table_index++] = 0;
table[table_index++] = 1 << 24 | 64 << 16 | 0; table[table_index++] = (1 << 24) | (64 << 16) | 0;
opts.bits = 1; opts.bits = 1;
return 0; /* no symbols, but wait for decoding to report error */ return 0; /* no symbols, but wait for decoding to report error */
} }
for (min = 1; min < max; min++) { for (min = 1; min < max; min++) {
if (count[min] !== 0) { if (count[min] !== 0) { break; }
break;
}
} }
if (root < min) { if (root < min) {
root = min; root = min;
@ -139,10 +137,10 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
left -= count[len]; left -= count[len];
if (left < 0) { if (left < 0) {
return -1; return -1;
} /* over-subscribed */ } /* over-subscribed */
} }
if (left > 0 && (type === CODES || max !== 1)) { if (left > 0 && (type === CODES || max !== 1)) {
return -1; /* incomplete set */ return -1; /* incomplete set */
} }
/* generate offsets into symbol table for each length for sorting */ /* generate offsets into symbol table for each length for sorting */
@ -165,21 +163,25 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
bits off of the bottom. For codes where len is less than drop + curr, bits off of the bottom. For codes where len is less than drop + curr,
those top drop + curr - len bits are incremented through all values to those top drop + curr - len bits are incremented through all values to
fill the table with replicated entries. fill the table with replicated entries.
root is the number of index bits for the root table. When len exceeds
root is the number of index bits for the root table. When len exceeds
root, sub-tables are created pointed to by the root entry with an index root, sub-tables are created pointed to by the root entry with an index
of the low root bits of huff. This is saved in low to check for when a of the low root bits of huff. This is saved in low to check for when a
new sub-table should be started. drop is zero when the root table is new sub-table should be started. drop is zero when the root table is
being filled, and drop is root when sub-tables are being filled. being filled, and drop is root when sub-tables are being filled.
When a new sub-table is needed, it is necessary to look ahead in the
When a new sub-table is needed, it is necessary to look ahead in the
code lengths to determine what size sub-table is needed. The length code lengths to determine what size sub-table is needed. The length
counts are used for this, and so count[] is decremented as codes are counts are used for this, and so count[] is decremented as codes are
entered in the tables. entered in the tables.
used keeps track of how many table entries have been allocated from the
used keeps track of how many table entries have been allocated from the
provided *table space. It is checked for LENS and DIST tables against provided *table space. It is checked for LENS and DIST tables against
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
the initial root table size constants. See the comments in inftrees.h the initial root table size constants. See the comments in inftrees.h
for more information. for more information.
sym increments through all symbols, and the loop terminates when
sym increments through all symbols, and the loop terminates when
all codes of length max, i.e. all codes, have been processed. This all codes of length max, i.e. all codes, have been processed. This
routine permits incomplete codes, so another loop after this one fills routine permits incomplete codes, so another loop after this one fills
in the rest of the decoding tables with invalid code markers. in the rest of the decoding tables with invalid code markers.
@ -189,34 +191,36 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
// poor man optimization - use if-else instead of switch, // poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8 // to avoid deopts in old v8
if (type === CODES) { if (type === CODES) {
base = extra = work; /* dummy value--not used */ base = extra = work; /* dummy value--not used */
end = 19; end = 19;
} else if (type === LENS) { } else if (type === LENS) {
base = lbase; base = lbase;
base_index -= 257; base_index -= 257;
extra = lext; extra = lext;
extra_index -= 257; extra_index -= 257;
end = 256; end = 256;
} else {
/* DISTS */ } else { /* DISTS */
base = dbase; base = dbase;
extra = dext; extra = dext;
end = -1; end = -1;
} }
/* initialize opts for loop */ /* initialize opts for loop */
huff = 0; /* starting code */ huff = 0; /* starting code */
sym = 0; /* starting code symbol */ sym = 0; /* starting code symbol */
len = min; /* starting code length */ len = min; /* starting code length */
next = table_index; /* current table to fill in */ next = table_index; /* current table to fill in */
curr = root; /* current table index bits */ curr = root; /* current table index bits */
drop = 0; /* current bits to drop from code for index */ drop = 0; /* current bits to drop from code for index */
low = -1; /* trigger new sub-table when len > root */ low = -1; /* trigger new sub-table when len > root */
used = 1 << root; /* use root table entries */ used = 1 << root; /* use root table entries */
mask = used - 1; /* mask for comparing low */ mask = used - 1; /* mask for comparing low */
/* check available table space */ /* check available table space */
if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { if ((type === LENS && used > ENOUGH_LENS) ||
(type === DISTS && used > ENOUGH_DISTS)) {
return 1; return 1;
} }
@ -227,25 +231,27 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
if (work[sym] < end) { if (work[sym] < end) {
here_op = 0; here_op = 0;
here_val = work[sym]; here_val = work[sym];
} else if (work[sym] > end) { }
else if (work[sym] > end) {
here_op = extra[extra_index + work[sym]]; here_op = extra[extra_index + work[sym]];
here_val = base[base_index + work[sym]]; here_val = base[base_index + work[sym]];
} else { }
here_op = 32 + 64; /* end of block */ else {
here_op = 32 + 64; /* end of block */
here_val = 0; here_val = 0;
} }
/* replicate for those indices with low len bits equal to huff */ /* replicate for those indices with low len bits equal to huff */
incr = 1 << len - drop; incr = 1 << (len - drop);
fill = 1 << curr; fill = 1 << curr;
min = fill; /* save offset to next table */ min = fill; /* save offset to next table */
do { do {
fill -= incr; fill -= incr;
table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0;
} while (fill !== 0); } while (fill !== 0);
/* backwards increment the len-bit code huff */ /* backwards increment the len-bit code huff */
incr = 1 << len - 1; incr = 1 << (len - 1);
while (huff & incr) { while (huff & incr) {
incr >>= 1; incr >>= 1;
} }
@ -259,9 +265,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
/* go to next symbol, update count, len */ /* go to next symbol, update count, len */
sym++; sym++;
if (--count[len] === 0) { if (--count[len] === 0) {
if (len === max) { if (len === max) { break; }
break;
}
len = lens[lens_index + work[sym]]; len = lens[lens_index + work[sym]];
} }
@ -273,23 +277,22 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
} }
/* increment past last table */ /* increment past last table */
next += min; /* here min is 1 << curr */ next += min; /* here min is 1 << curr */
/* determine length of next table */ /* determine length of next table */
curr = len - drop; curr = len - drop;
left = 1 << curr; left = 1 << curr;
while (curr + drop < max) { while (curr + drop < max) {
left -= count[curr + drop]; left -= count[curr + drop];
if (left <= 0) { if (left <= 0) { break; }
break;
}
curr++; curr++;
left <<= 1; left <<= 1;
} }
/* check for enough space */ /* check for enough space */
used += 1 << curr; used += 1 << curr;
if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { if ((type === LENS && used > ENOUGH_LENS) ||
(type === DISTS && used > ENOUGH_DISTS)) {
return 1; return 1;
} }
@ -298,7 +301,7 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
/*table.op[low] = curr; /*table.op[low] = curr;
table.bits[low] = root; table.bits[low] = root;
table.val[low] = next - opts.table_index;*/ table.val[low] = next - opts.table_index;*/
table[low] = root << 24 | curr << 16 | next - table_index | 0; table[low] = (root << 24) | (curr << 16) | (next - table_index) |0;
} }
} }
@ -309,11 +312,11 @@ function inflate_table(type, lens, lens_index, codes, table, table_index, work,
//table.op[next + huff] = 64; /* invalid code marker */ //table.op[next + huff] = 64; /* invalid code marker */
//table.bits[next + huff] = len - drop; //table.bits[next + huff] = len - drop;
//table.val[next + huff] = 0; //table.val[next + huff] = 0;
table[next + huff] = len - drop << 24 | 64 << 16 | 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0;
} }
/* set return parameters */ /* set return parameters */
//opts.table_index += used; //opts.table_index += used;
opts.bits = root; opts.bits = root;
return 0; return 0;
}; };

View file

@ -1,16 +1,11 @@
'use strict'; export default {
2: 'need dictionary', /* Z_NEED_DICT 2 */
Object.defineProperty(exports, "__esModule", { 1: 'stream end', /* Z_STREAM_END 1 */
value: true 0: '', /* Z_OK 0 */
}); '-1': 'file error', /* Z_ERRNO (-1) */
exports.default = { '-2': 'stream error', /* Z_STREAM_ERROR (-2) */
2: 'need dictionary', /* Z_NEED_DICT 2 */ '-3': 'data error', /* Z_DATA_ERROR (-3) */
1: 'stream end', /* Z_STREAM_END 1 */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
0: '', /* Z_OK 0 */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-1': 'file error', /* Z_ERRNO (-1) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
'-2': 'stream error', /* Z_STREAM_ERROR (-2) */ };
'-3': 'data error', /* Z_DATA_ERROR (-3) */
'-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,4 @@
'use strict'; export default function ZStream() {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = ZStream;
function ZStream() {
/* next input byte */ /* next input byte */
this.input = null; // JS specific, because we have no pointers this.input = null; // JS specific, because we have no pointers
this.next_in = 0; this.next_in = 0;
@ -20,11 +14,11 @@ function ZStream() {
/* total number of bytes output so far */ /* total number of bytes output so far */
this.total_out = 0; this.total_out = 0;
/* last error message, NULL if no error */ /* last error message, NULL if no error */
this.msg = '' /*Z_NULL*/; this.msg = ''/*Z_NULL*/;
/* not visible by applications */ /* not visible by applications */
this.state = null; this.state = null;
/* best guess about the data type: binary or text */ /* best guess about the data type: binary or text */
this.data_type = 2 /*Z_UNKNOWN*/; this.data_type = 2/*Z_UNKNOWN*/;
/* adler32 value of the uncompressed data */ /* adler32 value of the uncompressed data */
this.adler = 0; this.adler = 0;
} }

14043
static/js/novnc/vendor/sinon.js vendored Executable file

File diff suppressed because one or more lines are too long

View file

@ -1,323 +0,0 @@
{% extends "console-base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block head %}
<!--
noVNC example: simple example using default UI
Copyright (C) 2012 Joel Martin
Copyright (C) 2016 Samuel Mannehed for Cendio AB
Copyright (C) 2016 Pierre Ossman for Cendio AB
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
Connect parameters are provided in query string:
http://example.com/?host=HOST&port=PORT&encrypt=1
or the fragment:
http://example.com/#host=HOST&port=PORT&encrypt=1
-->
<title xmlns="http://www.w3.org/1999/html">noVNC</title>
<meta charset="utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- Icons (see Makefile for what the sizes are for) -->
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
<link rel="icon" sizes="24x24" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-24x24.png" %}">
<link rel="icon" sizes="32x32" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-32x32.png" %}">
<link rel="icon" sizes="48x48" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-48x48.png" %}">
<link rel="icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
<link rel="icon" sizes="64x64" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-64x64.png" %}">
<link rel="icon" sizes="72x72" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-72x72.png" %}">
<link rel="icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
<link rel="icon" sizes="96x96" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-96x96.png" %}">
<link rel="icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
<link rel="icon" sizes="144x144" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-144x144.png" %}">
<link rel="icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
<link rel="icon" sizes="192x192" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-192x192.png" %}">
<!-- Firefox currently mishandles SVG, see #1419039
<link rel="icon" sizes="any" type="image/svg+xml" href="{% static "js/novnc/app/images/icons/novnc-icon.svg" %}">
-->
<!-- Repeated last so that legacy handling will pick this -->
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
<!-- Apple iOS Safari settings -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<!-- Home Screen Icons (favourites and bookmarks use the normal icons) -->
<link rel="apple-touch-icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
<link rel="apple-touch-icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
<link rel="apple-touch-icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
<link rel="apple-touch-icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
<!-- Stylesheets -->
<link rel="stylesheet" href="{% static "js/novnc/app/styles/base.css" %}"/>
<!--
<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
-->
<!-- this is included as a normal file in order to catch script-loading errors as well -->
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
<!-- begin scripts -->
<script src="{% static "js/novnc/app.js" %}"></script>
<!-- end scripts -->
{% endblock %}
{% block content %}
<div id="noVNC_fallback_error" class="noVNC_center">
<div>
<div>noVNC encountered an error:</div>
<br>
<div id="noVNC_fallback_errormsg"></div>
</div>
</div>
<!-- noVNC Control Bar -->
<div id="noVNC_control_bar_anchor" class="noVNC_vcenter">
<div id="noVNC_control_bar">
<div id="noVNC_control_bar_handle" title="Hide/Show the control bar"><div></div></div>
<div class="noVNC_scroll">
<h1 class="noVNC_logo" translate="no"><span>no</span><br />VNC</h1>
<!-- Drag/Pan the viewport -->
<input type="image" alt="viewport drag" src="{% static "js/novnc/app/images/drag.svg" %}"
id="noVNC_view_drag_button" class="noVNC_button noVNC_hidden"
title="Move/Drag Viewport" />
<!--noVNC Touch Device only buttons-->
<div id="noVNC_mobile_buttons">
<input type="image" alt="No mousebutton" src="{% static "js/novnc/app/images/mouse_none.svg" %}"
id="noVNC_mouse_button0" class="noVNC_button"
title="Active Mouse Button"/>
<input type="image" alt="Left mousebutton" src="{% static "js/novnc/app/images/mouse_left.svg" %}"
id="noVNC_mouse_button1" class="noVNC_button"
title="Active Mouse Button"/>
<input type="image" alt="Middle mousebutton" src="{% static "js/novnc/app/images/mouse_middle.svg" %}"
id="noVNC_mouse_button2" class="noVNC_button"
title="Active Mouse Button"/>
<input type="image" alt="Right mousebutton" src="{% static "js/novnc/app/images/mouse_right.svg" %}"
id="noVNC_mouse_button4" class="noVNC_button"
title="Active Mouse Button"/>
<input type="image" alt="Keyboard" src="{% static "js/novnc/app/images/keyboard.svg" %}"
id="noVNC_keyboard_button" class="noVNC_button"
value="Keyboard" title="Show Keyboard" />
</div>
<!-- Extra manual keys -->
<div id="noVNC_extra_keys">
<input type="image" alt="Extra keys" src="{% static "js/novnc/app/images/toggleextrakeys.svg" %}"
id="noVNC_toggle_extra_keys_button" class="noVNC_button"
title="Show Extra Keys"/>
<div class="noVNC_vcenter">
<div id="noVNC_modifiers" class="noVNC_panel">
<input type="image" alt="Ctrl" src="{% static "js/novnc/app/images/ctrl.svg" %}"
id="noVNC_toggle_ctrl_button" class="noVNC_button"
title="Toggle Ctrl"/>
<input type="image" alt="Alt" src="{% static "js/novnc/app/images/alt.svg" %}"
id="noVNC_toggle_alt_button" class="noVNC_button"
title="Toggle Alt"/>
<input type="image" alt="Tab" src="{% static "js/novnc/app/images/tab.svg" %}"
id="noVNC_send_tab_button" class="noVNC_button"
title="Send Tab"/>
<input type="image" alt="Esc" src="{% static "js/novnc/app/images/esc.svg" %}"
id="noVNC_send_esc_button" class="noVNC_button"
title="Send Escape"/>
<input type="image" alt="Ctrl+Alt+Del" src="{% static "js/novnc/app/images/ctrlaltdel.svg" %}"
id="noVNC_send_ctrl_alt_del_button" class="noVNC_button"
title="Send Ctrl-Alt-Del" />
</div>
</div>
</div>
<!-- Shutdown/Reboot -->
<input type="image" alt="Shutdown/Reboot" src="{% static "js/novnc/app/images/power.svg" %}"
id="noVNC_power_button" class="noVNC_button"
title="Shutdown/Reboot..." />
<div class="noVNC_vcenter">
<div id="noVNC_power" class="noVNC_panel">
<div class="noVNC_heading">
<img src="{% static "js/novnc/app/images/power.svg" %}"> Power
</div>
<input type="button" id="noVNC_shutdown_button" value="Shutdown" />
<input type="button" id="noVNC_reboot_button" value="Reboot" />
<input type="button" id="noVNC_reset_button" value="Reset" />
</div>
</div>
<!-- Clipboard -->
<input type="image" alt="Clipboard" src="{% static "js/novnc/app/images/clipboard.svg" %}"
id="noVNC_clipboard_button" class="noVNC_button"
title="Clipboard" />
<div class="noVNC_vcenter">
<div id="noVNC_clipboard" class="noVNC_panel">
<div class="noVNC_heading">
<img src="{% static "js/novnc/app/images/clipboard.svg" %}"> Clipboard
</div>
<textarea id="noVNC_clipboard_text" rows=5></textarea>
<br />
<input id="noVNC_clipboard_clear_button" type="button"
value="Clear" class="noVNC_submit" />
</div>
</div>
<!-- Toggle fullscreen -->
<input type="image" alt="Fullscreen" src="{% static "js/novnc/app/images/fullscreen.svg" %}"
id="noVNC_fullscreen_button" class="noVNC_button noVNC_hidden"
title="Fullscreen" />
<!-- Settings -->
<input type="image" alt="Settings" src="{% static "js/novnc/app/images/settings.svg" %}"
id="noVNC_settings_button" class="noVNC_button"
title="Settings" />
<div class="noVNC_vcenter">
<div id="noVNC_settings" class="noVNC_panel">
<ul>
<li class="noVNC_heading">
<img src="{% static "js/novnc/app/images/settings.svg" %}"> Settings
</li>
<li>
<label><input id="noVNC_setting_shared" type="checkbox" /> Shared Mode</label>
</li>
<li>
<label><input id="noVNC_setting_view_only" type="checkbox" /> View Only</label>
</li>
<li><hr></li>
<li>
<label><input id="noVNC_setting_view_clip" type="checkbox" /> Clip to Window</label>
</li>
<li>
<label for="noVNC_setting_resize">Scaling Mode:</label>
<select id="noVNC_setting_resize" name="vncResize">
<option value="off">None</option>
<option value="scale">Local Scaling</option>
<option value="remote">Remote Resizing</option>
</select>
</li>
<li><hr></li>
<li>
<div class="noVNC_expander">Advanced</div>
<div><ul>
<li>
<label for="noVNC_setting_repeaterID">Repeater ID:</label>
<input id="noVNC_setting_repeaterID" type="input" value="" />
</li>
<li>
<div class="noVNC_expander">WebSocket</div>
<div><ul>
<li>
<label><input id="noVNC_setting_encrypt" type="checkbox" /> Encrypt</label>
</li>
<li>
<label for="noVNC_setting_host">Host:</label>
<input id="noVNC_setting_host" value="{{ ws_host }}"/>
</li>
<li>
<label for="noVNC_setting_port">Port:</label>
<input id="noVNC_setting_port" value="{{ ws_port }}" type="number" />
</li>
<li>
<label for="noVNC_setting_path">Path:</label>
<input id="noVNC_setting_path" type="input" value="websockify" />
</li>
</ul></div>
</li>
<li><hr></li>
<li>
<label><input id="noVNC_setting_reconnect" type="checkbox" /> Automatic Reconnect</label>
<input id="noVNC_setting_autoconnect" type="checkbox" value="true" hidden/>
</li>
<li>
<label for="noVNC_setting_reconnect_delay">Reconnect Delay (ms):</label>
<input id="noVNC_setting_reconnect_delay" type="number" />
</li>
<li><hr></li>
<!-- Logging selection dropdown -->
<li>
<label>Logging:
<select id="noVNC_setting_logging" name="vncLogging">
</select>
</label>
</li>
</ul></div>
</li>
</ul>
</div>
</div>
<!-- Connection Controls -->
<input type="image" alt="Disconnect" src="{% static "js/novnc/app/images/disconnect.svg" %}"
id="noVNC_disconnect_button" class="noVNC_button"
title="Disconnect" />
</div>
</div>
<div id="noVNC_control_bar_hint"></div>
</div> <!-- End of noVNC_control_bar -->
<!-- Status Dialog -->
<div id="noVNC_status"></div>
<!-- Connect button -->
<div class="noVNC_center">
<div id="noVNC_connect_dlg">
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
<div id="noVNC_connect_button">
<div>
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
</div>
</div>
</div>
</div>
<!-- Password Dialog -->
<div class="noVNC_center noVNC_connect_layer">
<div id="noVNC_password_dlg" class="noVNC_panel"><form>
<ul>
<li>
<label>Password:</label>
<input id="noVNC_password_input" type="password" />
</li>
<li>
<input id="noVNC_password_button" type="submit" value="Send Password" class="noVNC_submit" />
</li>
</ul>
</form></div>
</div>
<!-- Transition Screens -->
<div id="noVNC_transition">
<div id="noVNC_transition_text"></div>
<div>
<input type="button" id="noVNC_cancel_reconnect_button" value="Cancel" class="noVNC_submit" />
</div>
<div class="noVNC_spinner"></div>
</div>
<!-- This is where the RFB elements will attach -->
<div id="noVNC_container">
<!-- Note that Google Chrome on Android doesn't respect any of these,
html attributes which attempt to disable text suggestions on the
on-screen keyboard. Let's hope Chrome implements the ime-mode
style for example -->
<textarea id="noVNC_keyboardinput" autocapitalize="off"
autocorrect="off" autocomplete="off" spellcheck="false"
mozactionhint="Enter" tabindex="-1"></textarea>
</div>
<audio id="noVNC_bell">
<source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg">
<source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg">
</audio>
{% endblock %}

View file

@ -204,6 +204,30 @@ function sendCtrlAltDel()
} }
} }
function sendCtrlAltFN(f) {
if (sc && sc.inputs && sc.inputs.state === "ready"){
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
if (keys_code[f]==undefined) {
return;
}
var key = new SpiceMsgcKeyDown();
var msg = new SpiceMiniData();
update_modifier(true, KEY_LCtrl, sc);
update_modifier(true, KEY_Alt, sc);
key.code = keys_code[f];
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
sc.inputs.send_msg(msg);
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
sc.inputs.send_msg(msg);
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
}
}
function update_modifier(state, code, sc) function update_modifier(state, code, sc)
{ {
var msg = new SpiceMiniData(); var msg = new SpiceMiniData();