Commit 465a5b0b authored by Christian Beier's avatar Christian Beier

Update noVNC HTML5 client to latest version from https://github.com/kanaka/noVNC.

parent ad7a054e
noVNC is Copyright (C) 2011 Joel Martin <github@martintribe.org> noVNC is Copyright (C) 2011 Joel Martin <github@martintribe.org>
The noVNC core library is licensed under the LGPLv3 (GNU Lesser The noVNC core library files are licensed under the MPL 2.0 (Mozilla
General Public License). The noVNC core library is composed of the Public License 2.0). The noVNC core library is composed of the
Javascript code necessary for full noVNC operation. This includes (but Javascript code necessary for full noVNC operation. This includes (but
is not limited to): is not limited to):
...@@ -10,6 +10,7 @@ is not limited to): ...@@ -10,6 +10,7 @@ is not limited to):
include/display.js include/display.js
include/input.js include/input.js
include/jsunzip.js include/jsunzip.js
include/keysym.js
include/logo.js include/logo.js
include/rfb.js include/rfb.js
include/ui.js include/ui.js
...@@ -36,21 +37,15 @@ The HTML, CSS, font and image files are licensed as follows: ...@@ -36,21 +37,15 @@ The HTML, CSS, font and image files are licensed as follows:
images/ : Creative Commons Attribution-ShareAlike images/ : Creative Commons Attribution-ShareAlike
http://creativecommons.org/licenses/by-sa/3.0/ http://creativecommons.org/licenses/by-sa/3.0/
In addition the following file, which is part of the noVNC core
library, may be licensed under either the LGPL-2, LGPL-3 or MPL 2.0
when it used separately from the noVNC core library.
include/input.js : LGPL-2 or any later version
Some portions of noVNC are copyright to their individual authors. Some portions of noVNC are copyright to their individual authors.
Please refer to the individual source files and/or to the noVNC commit Please refer to the individual source files and/or to the noVNC commit
history: https://github.com/kanaka/noVNC/commits/master history: https://github.com/kanaka/noVNC/commits/master
The are several files and projects that have been incorporated into The are several files and projects that have been incorporated into
the noVNC core library. Here is a list of those files and the original the noVNC core library. Here is a list of those files and the original
licenses (all LGPL-3 compatible): licenses (all MPL 2.0 compatible):
include/base64.js : MPL 1.1, GPL-2 or LGPL-2.1 include/base64.js : MPL 2.0
include/des.js : Various BSD style licenses include/des.js : Various BSD style licenses
...@@ -59,20 +54,29 @@ licenses (all LGPL-3 compatible): ...@@ -59,20 +54,29 @@ licenses (all LGPL-3 compatible):
include/web-socket-js/ : New BSD license (3-clause). Source code at include/web-socket-js/ : New BSD license (3-clause). Source code at
http://github.com/gimite/web-socket-js http://github.com/gimite/web-socket-js
include/chrome-app/tcp-stream.js
: Apache 2.0 license
utils/websockify
utils/websocket.py : LGPL 3
The following license texts are included: The following license texts are included:
docs/LICENSE.MPL-2.0
docs/LICENSE.LGPL-3 and docs/LICENSE.LGPL-3 and
docs/LICENSE.GPL-3 docs/LICENSE.GPL-3
docs/LICENSE.OFL-1.1 docs/LICENSE.OFL-1.1
docs/LICENSE.BSD-3-Clause (New BSD) docs/LICENSE.BSD-3-Clause (New BSD)
docs/LICENSE.BSD-2-Clause (Simplified BSD / FreeBSD) docs/LICENSE.BSD-2-Clause (Simplified BSD / FreeBSD)
docs/LICENSE.zlib docs/LICENSE.zlib
docs/LICENSE.MPL-2.0 docs/LICENSE.Apache-2.0
Or alternatively the license texts may be found here: Or alternatively the license texts may be found here:
http://www.mozilla.org/MPL/2.0/
http://www.gnu.org/licenses/lgpl.html and http://www.gnu.org/licenses/lgpl.html and
http://www.gnu.org/licenses/gpl.html http://www.gnu.org/licenses/gpl.html
http://scripts.sil.org/OFL http://scripts.sil.org/OFL
http://www.mozilla.org/MPL/1.1/ http://en.wikipedia.org/wiki/BSD_licenses
http://www.mozilla.org/MPL/2.0/ http://www.gzip.org/zlib/zlib_license.html
http://www.apache.org/licenses/LICENSE-2.0.html
## noVNC: HTML5 VNC Client ## noVNC: HTML5 VNC Client
[![Build Status](https://travis-ci.org/kanaka/noVNC.svg?branch=master)](https://travis-ci.org/kanaka/noVNC)
### Description ### Description
noVNC is a HTML5 VNC client that runs well in any modern browser noVNC is a HTML5 VNC client that runs well in any modern browser
including mobile browsers (iPhone/iPad and Android). including mobile browsers (iPhone/iPad and Android).
Many companies/projects have integrated noVNC including [Ganeti Web
Manager](http://code.osuosl.org/projects/ganeti-webmgr),
[OpenStack](http://www.openstack.org),
[OpenNebula](http://opennebula.org/), and
[LibVNCServer](http://libvncserver.sourceforge.net). See [the Projects
and Companies wiki
page](https://github.com/kanaka/noVNC/wiki/ProjectsCompanies-using-noVNC)
for a more complete list with additional info and links.
### News/help/contact
Notable commits, announcements and news are posted to Notable commits, announcements and news are posted to
@<a href="http://www.twitter.com/noVNC">noVNC</a> <a href="http://www.twitter.com/noVNC">@noVNC</a>
If you are a noVNC developer/integrator/user (or want to be) please
join the <a
href="https://groups.google.com/forum/?fromgroups#!forum/novnc">noVNC
discussion group</a>
Bugs and feature requests can be submitted via [github
issues](https://github.com/kanaka/noVNC/issues). If you are looking
for a place to start contributing to noVNC, a good place to start
would be the issues that are marked as
["patchwelcome"](https://github.com/kanaka/noVNC/issues?labels=patchwelcome).
There are many companies/projects that have integrated noVNC into If you want to show appreciation for noVNC you could donate to a great
their products including: [Ganeti Web Manager](http://code.osuosl.org/projects/ganeti-webmgr), [Archipel](http://archipelproject.org), [openQRM](http://www.openqrm.com/), [OpenNode](http://www.opennodecloud.com/), [OpenStack](http://www.openstack.org), [Broadway (HTML5 GDK/GTK+ backend)](http://blogs.gnome.org/alexl/2011/03/15/gtk-html-backend-update/), [OpenNebula](http://opennebula.org/), [CloudSigma](http://www.cloudsigma.com/), [Zentyal (formerly eBox)](http://www.zentyal.org/), [SlapOS](http://www.slapos.org), [Intel MeshCentral](https://meshcentral.com), [Amahi](http://amahi.org), [Brightbox](http://brightbox.com/), [Foreman](http://theforeman.org), [LibVNCServer](http://libvnc.github.io/) and [PocketVNC](http://www.pocketvnc.com/blog/?page_id=866). See [this wiki page](https://github.com/kanaka/noVNC/wiki/ProjectsCompanies-using-noVNC) for more info and links. non-profits such as: [Compassion
International](http://www.compassion.com/), [SIL](http://www.sil.org),
[Habitat for Humanity](http://www.habitat.org), [Electronic Frontier
Foundation](https://www.eff.org/), [Against Malaria
Foundation](http://www.againstmalaria.com/), [Nothing But
Nets](http://www.nothingbutnets.net/), etc. Please tweet <a
href="http://www.twitter.com/noVNC">@noVNC</a> if you do.
### Features ### Features
...@@ -24,7 +53,7 @@ their products including: [Ganeti Web Manager](http://code.osuosl.org/projects/g ...@@ -24,7 +53,7 @@ their products including: [Ganeti Web Manager](http://code.osuosl.org/projects/g
* Clipboard copy/paste * Clipboard copy/paste
* Clipping or scolling modes for large remote screens * Clipping or scolling modes for large remote screens
* Easy site integration and theming (3 example themes included) * Easy site integration and theming (3 example themes included)
* Licensed under the [LGPLv3](http://www.gnu.org/licenses/lgpl.html) * Licensed under the [MPL 2.0](http://www.mozilla.org/MPL/2.0/)
### Screenshots ### Screenshots
...@@ -49,17 +78,18 @@ See more screenshots <a href="http://kanaka.github.com/noVNC/screenshots.html">h ...@@ -49,17 +78,18 @@ See more screenshots <a href="http://kanaka.github.com/noVNC/screenshots.html">h
* Fast Javascript Engine: this is not strictly a requirement, but * Fast Javascript Engine: this is not strictly a requirement, but
without a fast Javascript engine, noVNC might be painfully slow. without a fast Javascript engine, noVNC might be painfully slow.
* I maintain a more detailed browser compatibility list <a * See the more detailed [browser compatibility wiki page](https://github.com/kanaka/noVNC/wiki/Browser-support).
href="https://github.com/kanaka/noVNC/wiki/Browser-support">here</a>.
### Server Requirements ### Server Requirements
Unless you are using a VNC server with support for WebSockets Unless you are using a VNC server with support for WebSockets
connections (such as [x11vnc/libvncserver](http://libvnc.github.io/) or connections (such as
[PocketVNC](http://www.pocketvnc.com/blog/?page_id=866)), [x11vnc/libvncserver](http://libvncserver.sourceforge.net/),
you need to use a WebSockets to TCP socket proxy. There is [QEMU](http://www.qemu.org/), or
a python proxy included ('websockify'). [PocketVNC](http://www.pocketvnc.com/blog/?page_id=866)), you need to
use a WebSockets to TCP socket proxy. There is a python proxy included
('websockify').
### Quick Start ### Quick Start
...@@ -88,8 +118,14 @@ a python proxy included ('websockify'). ...@@ -88,8 +118,14 @@ a python proxy included ('websockify').
### Authors/Contributors ### Authors/Contributors
* noVNC : Joel Martin (github.com/kanaka) * Core team:
* New UI and Icons : Chris Gordon * [Joel Martin](https://github.com/kanaka)
* [Samuel Mannehed](https://github.com/samhed) (Cendio)
* [Peter Åstrand](https://github.com/astrand) (Cendio)
* [Solly Ross](https://github.com/DirectXMan12) (Red Hat / OpenStack)
* Notable contributions:
* UI and Icons : Chris Gordon
* Original Logo : Michael Sersen * Original Logo : Michael Sersen
* tight encoding : Michael Tinglof (Mercuri.ca) * tight encoding : Michael Tinglof (Mercuri.ca)
...@@ -100,5 +136,3 @@ a python proxy included ('websockify'). ...@@ -100,5 +136,3 @@ a python proxy included ('websockify').
* jsunzip : Erik Moller (github.com/operasoftware/jsunzip), * jsunzip : Erik Moller (github.com/operasoftware/jsunzip),
* tinflate : Joergen Ibsen (ibsensoftware.com) * tinflate : Joergen Ibsen (ibsensoftware.com)
* DES : Dave Zimmerman (Widget Workshop), Jef Poskanzer (ACME Labs) * DES : Dave Zimmerman (Widget Workshop), Jef Poskanzer (ACME Labs)
/* /*
* noVNC base CSS * noVNC base CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* noVNC is licensed under the LGPL-3 (see LICENSE.txt) * Copyright (C) 2013 Samuel Mannehed 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). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
...@@ -40,9 +41,6 @@ html { ...@@ -40,9 +41,6 @@ html {
} }
#noVNC_encrypt { #noVNC_encrypt {
} }
#noVNC_connectTimeout {
width: 30px;
}
#noVNC_path { #noVNC_path {
width: 100px; width: 100px;
} }
...@@ -51,6 +49,9 @@ html { ...@@ -51,6 +49,9 @@ html {
float:right; float:right;
} }
#noVNC_buttons {
white-space: nowrap;
}
#noVNC_view_drag_button { #noVNC_view_drag_button {
display: none; display: none;
...@@ -58,38 +59,43 @@ html { ...@@ -58,38 +59,43 @@ html {
#sendCtrlAltDelButton { #sendCtrlAltDelButton {
display: none; display: none;
} }
#noVNC_xvp_buttons {
display: none;
}
#noVNC_mobile_buttons { #noVNC_mobile_buttons {
display: none; display: none;
} }
#noVNC_extra_keys {
display: inline;
list-style-type: none;
padding: 0px;
margin: 0px;
position: relative;
}
.noVNC-buttons-left { .noVNC-buttons-left {
float: left; float: left;
padding-left:10px; z-index: 1;
padding-top:4px; position: relative;
} }
.noVNC-buttons-right { .noVNC-buttons-right {
float:right; float:right;
right: 0px; right: 0px;
padding-right:10px; z-index: 2;
padding-top:4px; position: absolute;
}
#noVNC_status_bar {
margin-top: 0px;
padding: 0px;
} }
#noVNC_status_bar div { #noVNC_status {
font-size: 12px; font-size: 12px;
padding-top: 4px; padding-top: 4px;
width:100%; height:32px;
}
#noVNC_status {
height:20px;
text-align: center; text-align: center;
font-weight: bold;
color: #fff;
} }
#noVNC_settings_menu { #noVNC_settings_menu {
margin: 3px; margin: 3px;
text-align: left; text-align: left;
...@@ -104,22 +110,12 @@ html { ...@@ -104,22 +110,12 @@ html {
float:right; float:right;
} }
.noVNC_status_normal {
background: #eee;
}
.noVNC_status_error {
background: #f44;
}
.noVNC_status_warn {
background: #ff4;
}
/* Do not set width/height for VNC_screen or VNC_canvas or incorrect /* Do not set width/height for VNC_screen or VNC_canvas or incorrect
* scaling will occur. Canvas resizes to remote VNC settings */ * scaling will occur. Canvas resizes to remote VNC settings */
#noVNC_screen_pad { #noVNC_screen_pad {
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
height: 44px; height: 36px;
} }
#noVNC_screen { #noVNC_screen {
text-align: center; text-align: center;
...@@ -154,14 +150,14 @@ html { ...@@ -154,14 +150,14 @@ html {
/*Bubble contents divs*/ /*Bubble contents divs*/
#noVNC_settings { #noVNC_settings {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:20px; right:20px;
position:fixed; position:fixed;
} }
#noVNC_controls { #noVNC_controls {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:12px; right:12px;
position:fixed; position:fixed;
} }
...@@ -173,7 +169,7 @@ html { ...@@ -173,7 +169,7 @@ html {
display:none; display:none;
position:fixed; position:fixed;
margin-top:77px; margin-top:73px;
right:20px; right:20px;
left:20px; left:20px;
padding:15px; padding:15px;
...@@ -186,9 +182,40 @@ html { ...@@ -186,9 +182,40 @@ html {
border-radius:10px; border-radius:10px;
} }
#noVNC_popup_status_panel {
display:none;
position: fixed;
z-index: 1;
margin:15px;
margin-top:60px;
padding:15px;
width:auto;
text-align:center;
font-weight:bold;
word-wrap:break-word;
color:#fff;
background:rgba(0,0,0,0.65);
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
}
#noVNC_xvp {
display:none;
margin-top:73px;
right:30px;
position:fixed;
}
#noVNC_xvp.top:after {
right:125px;
}
#noVNC_clipboard { #noVNC_clipboard {
display:none; display:none;
margin-top:77px; margin-top:73px;
right:30px; right:30px;
position:fixed; position:fixed;
} }
...@@ -207,17 +234,11 @@ html { ...@@ -207,17 +234,11 @@ html {
z-index: -1; z-index: -1;
} }
.noVNC_status_warn {
background-color:yellow;
}
/* /*
* Advanced Styling * Advanced Styling
*/ */
/* Control bar */ .noVNC_status_normal {
#noVNC-control-bar {
position:fixed;
background: #b2bdcd; /* Old browsers */ background: #b2bdcd; /* Old browsers */
background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #b2bdcd 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b2bdcd), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
...@@ -225,9 +246,32 @@ html { ...@@ -225,9 +246,32 @@ html {
background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */ background: -o-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */ background: -ms-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */ background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
.noVNC_status_error {
background: #f04040; /* Old browsers */
background: -moz-linear-gradient(top, #f04040 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f04040), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #f04040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
.noVNC_status_warn {
background: #f0f040; /* Old browsers */
background: -moz-linear-gradient(top, #f0f040 0%, #899cb3 49%, #7e93af 51%, #6e84a3 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f040), color-stop(49%,#899cb3), color-stop(51%,#7e93af), color-stop(100%,#6e84a3)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* IE10+ */
background: linear-gradient(top, #f0f040 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
}
/* Control bar */
#noVNC-control-bar {
position:fixed;
display:block; display:block;
height:44px; height:36px;
left:0; left:0;
top:0; top:0;
width:100%; width:100%;
...@@ -368,22 +412,85 @@ html { ...@@ -368,22 +412,85 @@ html {
font-size: 180px; font-size: 180px;
} }
@media screen and (min-width: 481px) and (max-width: 640px) { .noVNC-buttons-left {
.noVNC_status_button { padding-left: 10px;
font-size: 10px; }
.noVNC-buttons-right {
padding-right: 10px;
}
#noVNC_status {
z-index: 0;
position: absolute;
width: 100%;
margin-left: 0px;
}
#showExtraKeysButton { display: none; }
#toggleCtrlButton { display: inline; }
#toggleAltButton { display: inline; }
#sendTabButton { display: inline; }
#sendEscButton { display: inline; }
/* left-align the status text on lower resolutions */
@media screen and (max-width: 800px){
#noVNC_status {
z-index: 1;
position: relative;
width: auto;
float: left;
margin-left: 4px;
} }
}
@media screen and (max-width: 640px){
#noVNC_clipboard_text { #noVNC_clipboard_text {
width: 410px; width: 410px;
} }
#noVNC_logo { #noVNC_logo {
font-size: 150px; font-size: 150px;
} }
}
@media screen and (min-width: 321px) and (max-width: 480px) {
.noVNC_status_button { .noVNC_status_button {
font-size: 10px; font-size: 10px;
} }
.noVNC-buttons-left {
padding-left: 0px;
}
.noVNC-buttons-right {
padding-right: 0px;
}
/* collapse the extra keys on lower resolutions */
#showExtraKeysButton {
display: inline;
}
#toggleCtrlButton {
display: none;
position: absolute;
top: 30px;
left: 0px;
}
#toggleAltButton {
display: none;
position: absolute;
top: 65px;
left: 0px;
}
#sendTabButton {
display: none;
position: absolute;
top: 100px;
left: 0px;
}
#sendEscButton {
display: none;
position: absolute;
top: 135px;
left: 0px;
}
}
@media screen and (min-width: 321px) and (max-width: 480px) {
#noVNC_clipboard_text { #noVNC_clipboard_text {
width: 250px; width: 250px;
} }
......
/* /* This Source Code Form is subject to the terms of the Mozilla Public
* Modified from: * License, v. 2.0. If a copy of the MPL was not distributed with this
* http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js#956 * 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
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 /*jslint white: false */
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla XML-RPC Client component.
*
* The Initial Developer of the Original Code is
* Digital Creations 2, Inc.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Martijn Pieters <mj@digicool.com> (original author)
* Samuel Sieb <samuel@sieb.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/*jslint white: false, bitwise: false, plusplus: false */
/*global console */ /*global console */
var Base64 = { var Base64 = {
/* Convert data (an array of integers) to a Base64 string. */
toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='.split(''),
base64Pad : '=',
/* Convert data (an array of integers) to a Base64 string. */ encode: function (data) {
toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
base64Pad : '=',
encode: function (data) {
"use strict"; "use strict";
var result = '', var result = '';
chrTable = Base64.toBase64Table.split(''), var toBase64Table = Base64.toBase64Table;
pad = Base64.base64Pad, var length = data.length;
length = data.length, var lengthpad = (length % 3);
i;
// Convert every three bytes to 4 ascii characters. // Convert every three bytes to 4 ascii characters.
for (i = 0; i < (length - 2); i += 3) {
result += chrTable[data[i] >> 2]; for (var i = 0; i < (length - 2); i += 3) {
result += chrTable[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[data[i] >> 2];
result += chrTable[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)]; result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
result += chrTable[data[i+2] & 0x3f]; result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
result += toBase64Table[data[i + 2] & 0x3f];
} }
// Convert the remaining 1 or 2 bytes, pad out to 4 characters. // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
if (length%3) { var j = 0;
i = length - (length%3); if (lengthpad === 2) {
result += chrTable[data[i] >> 2]; j = length - lengthpad;
if ((length%3) === 2) { result += toBase64Table[data[j] >> 2];
result += chrTable[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[((data[j] & 0x03) << 4) + (data[j + 1] >> 4)];
result += chrTable[(data[i+1] & 0x0f) << 2]; result += toBase64Table[(data[j + 1] & 0x0f) << 2];
result += pad; result += toBase64Table[64];
} else { } else if (lengthpad === 1) {
result += chrTable[(data[i] & 0x03) << 4]; j = length - lengthpad;
result += pad + pad; result += toBase64Table[data[j] >> 2];
} result += toBase64Table[(data[j] & 0x03) << 4];
result += toBase64Table[64];
result += toBase64Table[64];
} }
return result; return result;
}, },
/* Convert Base64 data to a string */ /* Convert Base64 data to a string */
toBinaryTable : [ /* jshint -W013 */
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,-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, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
...@@ -92,28 +57,29 @@ toBinaryTable : [ ...@@ -92,28 +57,29 @@ toBinaryTable : [
15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, 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, -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 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
], ],
/* jshint +W013 */
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 binTable = Base64.toBinaryTable, var toBinaryTable = Base64.toBinaryTable;
pad = Base64.base64Pad, var base64Pad = Base64.base64Pad;
result, result_length, idx, i, c, padding, var result, result_length;
leftbits = 0, // number of bits decoded, but yet to be appended var leftbits = 0; // number of bits decoded, but yet to be appended
leftdata = 0, // bits decoded, but yet to be appended var leftdata = 0; // bits decoded, but yet to be appended
data_length = data.indexOf('=') - offset; var data_length = data.indexOf('=') - offset;
if (data_length < 0) { data_length = data.length - offset; } if (data_length < 0) { 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 (idx = 0, i = offset; i < data.length; i++) { for (var idx = 0, i = offset; i < data.length; i++) {
c = binTable[data.charCodeAt(i) & 0x7f]; var c = toBinaryTable[data.charCodeAt(i) & 0x7f];
padding = (data.charAt(i) === pad); var padding = (data.charAt(i) === base64Pad);
// Skip illegal characters and whitespace // Skip illegal characters and whitespace
if (c === -1) { if (c === -1) {
console.error("Illegal character code " + data.charCodeAt(i) + " at position " + i); console.error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
...@@ -137,11 +103,11 @@ decode: function (data, offset) { ...@@ -137,11 +103,11 @@ decode: function (data, offset) {
// If there are any bits left, the base64 string was corrupted // If there are any bits left, the base64 string was corrupted
if (leftbits) { if (leftbits) {
throw {name: 'Base64-Error', err = new Error('Corrupted base64 string');
message: 'Corrupted base64 string'}; err.name = 'Base64-Error';
throw err;
} }
return result; return result;
} }
}; /* End of Base64 namespace */ }; /* End of Base64 namespace */
/* /*
* noVNC base CSS * noVNC black CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* noVNC is licensed under the LGPL-3 (see LICENSE.txt) * Copyright (C) 2013 Samuel Mannehed 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). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
...@@ -9,7 +10,7 @@ ...@@ -9,7 +10,7 @@
background-color:#000; background-color:#000;
} }
#noVNC-control-bar { .noVNC_status_normal {
background: #4c4c4c; /* Old browsers */ background: #4c4c4c; /* Old browsers */
background: -moz-linear-gradient(top, #4c4c4c 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */ background: -moz-linear-gradient(top, #4c4c4c 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4c4c4c), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
...@@ -18,6 +19,24 @@ ...@@ -18,6 +19,24 @@
background: -ms-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */ background: -ms-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */ background: linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
} }
.noVNC_status_error {
background: #f04040; /* Old browsers */
background: -moz-linear-gradient(top, #f04040 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f04040), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #f04040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
}
.noVNC_status_warn {
background: #f0f040; /* Old browsers */
background: -moz-linear-gradient(top, #f0f040 0%, #2c2c2c 50%, #000000 51%, #131313 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f0f040), color-stop(50%,#2c2c2c), color-stop(51%,#000000), color-stop(100%,#131313)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
background: linear-gradient(top, #f0f040 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
}
.triangle-right { .triangle-right {
border:2px solid #fff; border:2px solid #fff;
......
/* /*
* noVNC base CSS * noVNC blue CSS
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* noVNC is licensed under the LGPL-3 (see LICENSE.txt) * Copyright (C) 2013 Samuel Mannehed 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). * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
*/ */
#noVNC-control-bar { .noVNC_status_normal {
background-color:#04073d; background-color:#04073d;
background-image: -webkit-gradient( background-image: -webkit-gradient(
linear, linear,
...@@ -20,6 +21,36 @@ ...@@ -20,6 +21,36 @@
rgb(4,7,61) 50% rgb(4,7,61) 50%
); );
} }
.noVNC_status_error {
background-color:#f04040;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.54, rgb(240,64,64)),
color-stop(0.5, rgb(4,7,61))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(4,7,61) 54%,
rgb(249,64,64) 50%
);
}
.noVNC_status_warn {
background-color:#f0f040;
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.54, rgb(240,240,64)),
color-stop(0.5, rgb(4,7,61))
);
background-image: -moz-linear-gradient(
center bottom,
rgb(4,7,61) 54%,
rgb(240,240,64) 50%
);
}
.triangle-right { .triangle-right {
border:2px solid #fff; border:2px solid #fff;
......
/*
Copyright 2012 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Author: Boris Smus (smus@chromium.org)
*/
(function(exports) {
// Define some local variables here.
var socket = chrome.socket || chrome.experimental.socket;
var dns = chrome.experimental.dns;
/**
* Creates an instance of the client
*
* @param {String} host The remote host to connect to
* @param {Number} port The port to connect to at the remote host
*/
function TcpClient(host, port, pollInterval) {
this.host = host;
this.port = port;
this.pollInterval = pollInterval || 15;
// Callback functions.
this.callbacks = {
connect: null, // Called when socket is connected.
disconnect: null, // Called when socket is disconnected.
recvBuffer: null, // Called (as ArrayBuffer) when client receives data from server.
recvString: null, // Called (as string) when client receives data from server.
sent: null // Called when client sends data to server.
};
// Socket.
this.socketId = null;
this.isConnected = false;
log('initialized tcp client');
}
/**
* Connects to the TCP socket, and creates an open socket.
*
* @see http://developer.chrome.com/trunk/apps/socket.html#method-create
* @param {Function} callback The function to call on connection
*/
TcpClient.prototype.connect = function(callback) {
// First resolve the hostname to an IP.
dns.resolve(this.host, function(result) {
this.addr = result.address;
socket.create('tcp', {}, this._onCreate.bind(this));
// Register connect callback.
this.callbacks.connect = callback;
}.bind(this));
};
/**
* Sends an arraybuffer/view down the wire to the remote side
*
* @see http://developer.chrome.com/trunk/apps/socket.html#method-write
* @param {String} msg The arraybuffer/view to send
* @param {Function} callback The function to call when the message has sent
*/
TcpClient.prototype.sendBuffer = function(buf, callback) {
if (buf.buffer) {
buf = buf.buffer;
}
/*
// Debug
var bytes = [], u8 = new Uint8Array(buf);
for (var i = 0; i < u8.length; i++) {
bytes.push(u8[i]);
}
log("sending bytes: " + (bytes.join(',')));
*/
socket.write(this.socketId, buf, this._onWriteComplete.bind(this));
// Register sent callback.
this.callbacks.sent = callback;
};
/**
* Sends a string down the wire to the remote side
*
* @see http://developer.chrome.com/trunk/apps/socket.html#method-write
* @param {String} msg The string to send
* @param {Function} callback The function to call when the message has sent
*/
TcpClient.prototype.sendString = function(msg, callback) {
/*
// Debug
log("sending string: " + msg);
*/
this._stringToArrayBuffer(msg, function(arrayBuffer) {
socket.write(this.socketId, arrayBuffer, this._onWriteComplete.bind(this));
}.bind(this));
// Register sent callback.
this.callbacks.sent = callback;
};
/**
* Sets the callback for when a message is received
*
* @param {Function} callback The function to call when a message has arrived
* @param {String} type The callback argument type: "arraybuffer" or "string"
*/
TcpClient.prototype.addResponseListener = function(callback, type) {
if (typeof type === "undefined") {
type = "arraybuffer";
}
// Register received callback.
if (type === "string") {
this.callbacks.recvString = callback;
} else {
this.callbacks.recvBuffer = callback;
}
};
/**
* Sets the callback for when the socket disconnects
*
* @param {Function} callback The function to call when the socket disconnects
* @param {String} type The callback argument type: "arraybuffer" or "string"
*/
TcpClient.prototype.addDisconnectListener = function(callback) {
// Register disconnect callback.
this.callbacks.disconnect = callback;
};
/**
* Disconnects from the remote side
*
* @see http://developer.chrome.com/trunk/apps/socket.html#method-disconnect
*/
TcpClient.prototype.disconnect = function() {
if (this.isConnected) {
this.isConnected = false;
socket.disconnect(this.socketId);
if (this.callbacks.disconnect) {
this.callbacks.disconnect();
}
log('socket disconnected');
}
};
/**
* The callback function used for when we attempt to have Chrome
* create a socket. If the socket is successfully created
* we go ahead and connect to the remote side.
*
* @private
* @see http://developer.chrome.com/trunk/apps/socket.html#method-connect
* @param {Object} createInfo The socket details
*/
TcpClient.prototype._onCreate = function(createInfo) {
this.socketId = createInfo.socketId;
if (this.socketId > 0) {
socket.connect(this.socketId, this.addr, this.port, this._onConnectComplete.bind(this));
} else {
error('Unable to create socket');
}
};
/**
* The callback function used for when we attempt to have Chrome
* connect to the remote side. If a successful connection is
* made then polling starts to check for data to read
*
* @private
* @param {Number} resultCode Indicates whether the connection was successful
*/
TcpClient.prototype._onConnectComplete = function(resultCode) {
// Start polling for reads.
this.isConnected = true;
setTimeout(this._periodicallyRead.bind(this), this.pollInterval);
if (this.callbacks.connect) {
log('connect complete');
this.callbacks.connect();
}
log('onConnectComplete');
};
/**
* Checks for new data to read from the socket
*
* @see http://developer.chrome.com/trunk/apps/socket.html#method-read
*/
TcpClient.prototype._periodicallyRead = function() {
var that = this;
socket.getInfo(this.socketId, function (info) {
if (info.connected) {
setTimeout(that._periodicallyRead.bind(that), that.pollInterval);
socket.read(that.socketId, null, that._onDataRead.bind(that));
} else if (that.isConnected) {
log('socket disconnect detected');
that.disconnect();
}
});
};
/**
* Callback function for when data has been read from the socket.
* Converts the array buffer that is read in to a string
* and sends it on for further processing by passing it to
* the previously assigned callback function.
*
* @private
* @see TcpClient.prototype.addResponseListener
* @param {Object} readInfo The incoming message
*/
TcpClient.prototype._onDataRead = function(readInfo) {
// Call received callback if there's data in the response.
if (readInfo.resultCode > 0) {
log('onDataRead');
/*
// Debug
var bytes = [], u8 = new Uint8Array(readInfo.data);
for (var i = 0; i < u8.length; i++) {
bytes.push(u8[i]);
}
log("received bytes: " + (bytes.join(',')));
*/
if (this.callbacks.recvBuffer) {
// Return raw ArrayBuffer directly.
this.callbacks.recvBuffer(readInfo.data);
}
if (this.callbacks.recvString) {
// Convert ArrayBuffer to string.
this._arrayBufferToString(readInfo.data, function(str) {
this.callbacks.recvString(str);
}.bind(this));
}
// Trigger another read right away
setTimeout(this._periodicallyRead.bind(this), 0);
}
};
/**
* Callback for when data has been successfully
* written to the socket.
*
* @private
* @param {Object} writeInfo The outgoing message
*/
TcpClient.prototype._onWriteComplete = function(writeInfo) {
log('onWriteComplete');
// Call sent callback.
if (this.callbacks.sent) {
this.callbacks.sent(writeInfo);
}
};
/**
* Converts an array buffer to a string
*
* @private
* @param {ArrayBuffer} buf The buffer to convert
* @param {Function} callback The function to call when conversion is complete
*/
TcpClient.prototype._arrayBufferToString = function(buf, callback) {
var bb = new Blob([new Uint8Array(buf)]);
var f = new FileReader();
f.onload = function(e) {
callback(e.target.result);
};
f.readAsText(bb);
};
/**
* Converts a string to an array buffer
*
* @private
* @param {String} str The string to convert
* @param {Function} callback The function to call when conversion is complete
*/
TcpClient.prototype._stringToArrayBuffer = function(str, callback) {
var bb = new Blob([str]);
var f = new FileReader();
f.onload = function(e) {
callback(e.target.result);
};
f.readAsArrayBuffer(bb);
};
/**
* Wrapper function for logging
*/
function log(msg) {
console.log(msg);
}
/**
* Wrapper function for error logging
*/
function error(msg) {
console.error(msg);
}
exports.TcpClient = TcpClient;
})(window);
...@@ -75,67 +75,70 @@ ...@@ -75,67 +75,70 @@
* fine Java utilities: http://www.acme.com/java/ * fine Java utilities: http://www.acme.com/java/
*/ */
"use strict"; /* jslint white: false */
/*jslint white: false, bitwise: false, plusplus: false */
function DES(passwd) { function DES(passwd) {
"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, // jshint -W013
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, 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 ], 50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31 ],
totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28], totrot = [ 1, 2, 4, 6, 8,10,12,14,15,17,19,21,23,25,27,28],
z = 0x0, a,b,c,d,e,f, SP1,SP2,SP3,SP4,SP5,SP6,SP7,SP8, z = 0x0, a,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; // jshint -W015
SP1 = [c|e,z|z,a|z,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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]; 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; 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, 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, 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, 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]; z|z,c|f,a|d,b|d,c|z,b|e,b|f,z|z,c|f,a|e,a|e,z|f,z|f,a|d,b|z,c|e];
// jshint +W013,+W015
// Set the key. // Set the key.
function setKeys(keyBlock) { function setKeys(keyBlock) {
var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [], var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [],
raw0, raw1, rawi, KnLi; 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;
} }
...@@ -144,8 +147,8 @@ function setKeys(keyBlock) { ...@@ -144,8 +147,8 @@ function setKeys(keyBlock) {
m = i << 1; m = i << 1;
n = m + 1; n = m + 1;
kn[m] = kn[n] = 0; kn[m] = kn[n] = 0;
for (o=28; o<59; o+=28) { for (o = 28; o < 59; o += 28) {
for (j = o-28; j < o; ++j) { for (j = o - 28; j < o; ++j) {
l = j + totrot[i]; l = j + totrot[i];
if (l < o) { if (l < o) {
pcr[j] = pc1m[l]; pcr[j] = pc1m[l];
...@@ -156,10 +159,10 @@ function setKeys(keyBlock) { ...@@ -156,10 +159,10 @@ function setKeys(keyBlock) {
} }
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);
} }
} }
} }
...@@ -179,10 +182,10 @@ function setKeys(keyBlock) { ...@@ -179,10 +182,10 @@ function setKeys(keyBlock) {
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, b = text.slice(), fval, keysi = 0, var i = 0, b = text.slice(), fval, keysi = 0,
l, r, x; // left, right, accumulator l, r, x; // left, right, accumulator
...@@ -256,18 +259,18 @@ function enc8(text) { ...@@ -256,18 +259,18 @@ function enc8(text) {
// 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) { b[i] += 256; } // unsigned if (b[i] < 0) { b[i] += 256; } // unsigned
} }
return b; return b;
} }
// Encrypt 16 bytes of text using passwd as key // Encrypt 16 bytes of text using passwd as key
function encrypt(t) { function encrypt(t) {
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
This diff is collapsed.
This diff is collapsed.
...@@ -352,20 +352,28 @@ this.getbit = function(d) ...@@ -352,20 +352,28 @@ this.getbit = function(d)
} }
/* read a num bit value from a stream and add base */ /* read a num bit value from a stream and add base */
function read_bits_direct(source, bitcount, tag, idx, num)
{
var val = 0;
while (bitcount < 24) {
tag = tag | (source[idx++] & 0xff) << bitcount;
bitcount += 8;
}
val = tag & (0xffff >> (16 - num));
tag >>= num;
bitcount -= num;
return [bitcount, tag, idx, val];
}
this.read_bits = function(d, num, base) this.read_bits = function(d, num, base)
{ {
if (!num) if (!num)
return base; return base;
var val = 0; var ret = read_bits_direct(d.source, d.bitcount, d.tag, d.sourceIndex, num);
while (d.bitcount < 24) { d.bitcount = ret[0];
d.tag = d.tag | (d.source[d.sourceIndex++] & 0xff) << d.bitcount; d.tag = ret[1];
d.bitcount += 8; d.sourceIndex = ret[2];
} return ret[3] + base;
val = d.tag & (0xffff >> (16 - num));
d.tag >>= num;
d.bitcount -= num;
return val + base;
} }
/* given a data stream and a tree, decode a symbol */ /* given a data stream and a tree, decode a symbol */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* /*
* noVNC: HTML5 VNC client * noVNC: HTML5 VNC client
* Copyright (C) 2012 Joel Martin * Copyright (C) 2012 Joel Martin
* Licensed under LGPL-3 (see LICENSE.LGPL-3) * Licensed under MPL 2.0 (see LICENSE.txt)
*/ */
"use strict"; "use strict";
...@@ -79,10 +79,22 @@ queue_next_packet = function () { ...@@ -79,10 +79,22 @@ queue_next_packet = function () {
} }
}; };
var bytes_processed = 0;
do_packet = function () { do_packet = function () {
//Util.Debug("Processing frame: " + frame_idx); //Util.Debug("Processing frame: " + frame_idx);
var frame = VNC_frame_data[frame_idx]; var frame = VNC_frame_data[frame_idx],
rfb.recv_message({'data' : frame.slice(frame.indexOf('{', 1) + 1)}); start = frame.indexOf('{', 1) + 1;
bytes_processed += frame.length - start;
if (VNC_frame_encoding === 'binary') {
var u8 = new Uint8Array(frame.length - start);
for (var i = 0; i < frame.length - start; i++) {
u8[i] = frame.charCodeAt(start + i);
}
rfb.recv_message({'data' : u8});
} else {
rfb.recv_message({'data' : frame.slice(start)});
}
frame_idx += 1; frame_idx += 1;
queue_next_packet(); queue_next_packet();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright: Hiroshi Ichikawa <http://gimite.net/en/> // Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
// License: New BSD License // License: New BSD License
// Reference: http://dev.w3.org/html5/websockets/ // Reference: http://dev.w3.org/html5/websockets/
// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol // Reference: http://tools.ietf.org/html/rfc6455
(function() { (function() {
if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) return; if (window.WEB_SOCKET_FORCE_FLASH) {
// Keeps going.
} else if (window.WebSocket) {
return;
} else if (window.MozWebSocket) {
// Firefox.
window.WebSocket = MozWebSocket;
return;
}
var console = window.console; var logger;
if (!console || !console.log || !console.error) { if (window.WEB_SOCKET_LOGGER) {
console = {log: function(){ }, error: function(){ }}; logger = WEB_SOCKET_LOGGER;
} else if (window.console && window.console.log && window.console.error) {
// In some environment, console is defined but console.log or console.error is missing.
logger = window.console;
} else {
logger = {log: function(){ }, error: function(){ }};
} }
if (!swfobject.hasFlashPlayerVersion("10.0.0")) { // swfobject.hasFlashPlayerVersion("10.0.0") doesn't work with Gnash.
console.error("Flash Player >= 10.0.0 is required."); if (swfobject.getFlashPlayerVersion().major < 10) {
logger.error("Flash Player >= 10.0.0 is required.");
return; return;
} }
if (location.protocol == "file:") { if (location.protocol == "file:") {
console.error( logger.error(
"WARNING: web-socket-js doesn't work in file:///... URL " + "WARNING: web-socket-js doesn't work in file:///... URL " +
"unless you set Flash Security Settings properly. " + "unless you set Flash Security Settings properly. " +
"Open the page via Web server i.e. http://..."); "Open the page via Web server i.e. http://...");
} }
/** /**
* This class represents a faux web socket. * Our own implementation of WebSocket class using Flash.
* @param {string} url * @param {string} url
* @param {string} protocol * @param {array or string} protocols
* @param {string} proxyHost * @param {string} proxyHost
* @param {int} proxyPort * @param {int} proxyPort
* @param {string} headers * @param {string} headers
*/ */
WebSocket = function(url, protocol, proxyHost, proxyPort, headers) { window.WebSocket = function(url, protocols, proxyHost, proxyPort, headers) {
var self = this; var self = this;
self.__id = WebSocket.__nextId++; self.__id = WebSocket.__nextId++;
WebSocket.__instances[self.__id] = self; WebSocket.__instances[self.__id] = self;
self.readyState = WebSocket.CONNECTING; self.readyState = WebSocket.CONNECTING;
self.bufferedAmount = 0; self.bufferedAmount = 0;
self.__events = {}; self.__events = {};
if (!protocols) {
protocols = [];
} else if (typeof protocols == "string") {
protocols = [protocols];
}
// Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc. // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
// Otherwise, when onopen fires immediately, onopen is called before it is set. // Otherwise, when onopen fires immediately, onopen is called before it is set.
setTimeout(function() { self.__createTask = setTimeout(function() {
WebSocket.__addTask(function() { WebSocket.__addTask(function() {
self.__createTask = null;
WebSocket.__flash.create( WebSocket.__flash.create(
self.__id, url, protocol, proxyHost || null, proxyPort || 0, headers || null); self.__id, url, protocols, proxyHost || null, proxyPort || 0, headers || null);
}); });
}, 0); }, 0);
}; };
...@@ -78,6 +98,12 @@ ...@@ -78,6 +98,12 @@
* Close this web socket gracefully. * Close this web socket gracefully.
*/ */
WebSocket.prototype.close = function() { WebSocket.prototype.close = function() {
if (this.__createTask) {
clearTimeout(this.__createTask);
this.__createTask = null;
this.readyState = WebSocket.CLOSED;
return;
}
if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) { if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
return; return;
} }
...@@ -131,7 +157,7 @@ ...@@ -131,7 +157,7 @@
events[i](event); events[i](event);
} }
var handler = this["on" + event.type]; var handler = this["on" + event.type];
if (handler) handler(event); if (handler) handler.apply(this, [event]);
}; };
/** /**
...@@ -139,16 +165,22 @@ ...@@ -139,16 +165,22 @@
* @param {Object} flashEvent * @param {Object} flashEvent
*/ */
WebSocket.prototype.__handleEvent = function(flashEvent) { WebSocket.prototype.__handleEvent = function(flashEvent) {
if ("readyState" in flashEvent) { if ("readyState" in flashEvent) {
this.readyState = flashEvent.readyState; this.readyState = flashEvent.readyState;
} }
if ("protocol" in flashEvent) {
this.protocol = flashEvent.protocol;
}
var jsEvent; var jsEvent;
if (flashEvent.type == "open" || flashEvent.type == "error") { if (flashEvent.type == "open" || flashEvent.type == "error") {
jsEvent = this.__createSimpleEvent(flashEvent.type); jsEvent = this.__createSimpleEvent(flashEvent.type);
} else if (flashEvent.type == "close") { } else if (flashEvent.type == "close") {
// TODO implement jsEvent.wasClean
jsEvent = this.__createSimpleEvent("close"); jsEvent = this.__createSimpleEvent("close");
jsEvent.wasClean = flashEvent.wasClean ? true : false;
jsEvent.code = flashEvent.code;
jsEvent.reason = flashEvent.reason;
} else if (flashEvent.type == "message") { } else if (flashEvent.type == "message") {
var data = decodeURIComponent(flashEvent.message); var data = decodeURIComponent(flashEvent.message);
jsEvent = this.__createMessageEvent("message", data); jsEvent = this.__createMessageEvent("message", data);
...@@ -157,6 +189,7 @@ ...@@ -157,6 +189,7 @@
} }
this.dispatchEvent(jsEvent); this.dispatchEvent(jsEvent);
}; };
WebSocket.prototype.__createSimpleEvent = function(type) { WebSocket.prototype.__createSimpleEvent = function(type) {
...@@ -188,6 +221,9 @@ ...@@ -188,6 +221,9 @@
WebSocket.CLOSING = 2; WebSocket.CLOSING = 2;
WebSocket.CLOSED = 3; WebSocket.CLOSED = 3;
// Field to check implementation of WebSocket.
WebSocket.__isFlashImplementation = true;
WebSocket.__initialized = false;
WebSocket.__flash = null; WebSocket.__flash = null;
WebSocket.__instances = {}; WebSocket.__instances = {};
WebSocket.__tasks = []; WebSocket.__tasks = [];
...@@ -207,16 +243,31 @@ ...@@ -207,16 +243,31 @@
* Loads WebSocketMain.swf and creates WebSocketMain object in Flash. * Loads WebSocketMain.swf and creates WebSocketMain object in Flash.
*/ */
WebSocket.__initialize = function() { WebSocket.__initialize = function() {
if (WebSocket.__flash) return;
if (WebSocket.__initialized) return;
WebSocket.__initialized = true;
if (WebSocket.__swfLocation) { if (WebSocket.__swfLocation) {
// For backword compatibility. // For backword compatibility.
window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation; window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
} }
if (!window.WEB_SOCKET_SWF_LOCATION) { if (!window.WEB_SOCKET_SWF_LOCATION) {
console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf"); logger.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
return; return;
} }
if (!window.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR &&
!WEB_SOCKET_SWF_LOCATION.match(/(^|\/)WebSocketMainInsecure\.swf(\?.*)?$/) &&
WEB_SOCKET_SWF_LOCATION.match(/^\w+:\/\/([^\/]+)/)) {
var swfHost = RegExp.$1;
if (location.host != swfHost) {
logger.error(
"[WebSocket] You must host HTML and WebSocketMain.swf in the same host " +
"('" + location.host + "' != '" + swfHost + "'). " +
"See also 'How to host HTML file and SWF file in different domains' section " +
"in README.md. If you use WebSocketMainInsecure.swf, you can suppress this message " +
"by WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR = true;");
}
}
var container = document.createElement("div"); var container = document.createElement("div");
container.id = "webSocketContainer"; container.id = "webSocketContainer";
// Hides Flash box. We cannot use display: none or visibility: hidden because it prevents // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
...@@ -250,9 +301,11 @@ ...@@ -250,9 +301,11 @@
null, null,
function(e) { function(e) {
if (!e.success) { if (!e.success) {
console.error("[WebSocket] swfobject.embedSWF failed"); logger.error("[WebSocket] swfobject.embedSWF failed");
} }
}); }
);
}; };
/** /**
...@@ -287,7 +340,7 @@ ...@@ -287,7 +340,7 @@
WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]); WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]);
} }
} catch (e) { } catch (e) {
console.error(e); logger.error(e);
} }
}, 0); }, 0);
return true; return true;
...@@ -295,12 +348,12 @@ ...@@ -295,12 +348,12 @@
// Called by Flash. // Called by Flash.
WebSocket.__log = function(message) { WebSocket.__log = function(message) {
console.log(decodeURIComponent(message)); logger.log(decodeURIComponent(message));
}; };
// Called by Flash. // Called by Flash.
WebSocket.__error = function(message) { WebSocket.__error = function(message) {
console.error(decodeURIComponent(message)); logger.error(decodeURIComponent(message));
}; };
WebSocket.__addTask = function(task) { WebSocket.__addTask = function(task) {
...@@ -327,15 +380,12 @@ ...@@ -327,15 +380,12 @@
}; };
if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) { if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
if (window.addEventListener) { // NOTE:
window.addEventListener("load", function(){ // This fires immediately if web_socket.js is dynamically loaded after
WebSocket.__initialize(); // the document is loaded.
}, false); swfobject.addDomLoadEvent(function() {
} else {
window.attachEvent("onload", function(){
WebSocket.__initialize(); WebSocket.__initialize();
}); });
} }
}
})(); })();
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment