[ganeti/ganeti_webmgr] 67ce1e5 fix merge conflicts (4944 commits)

94 views
Skip to first unread message

g...@osuosl.org

unread,
Mar 24, 2014, 5:42:45 PM3/24/14
to ganeti-web...@googlegroups.com
The branch, enhancement/13785 has been updated

Old revision: 7e2f80e4838000f1d2dd2ebe4f6a0298a1be1158, new revision: 67ce1e50a6f938c1611cbc66fb74d73d24b14e12.
via 67ce1e50a6f938c1611cbc66fb74d73d24b14e12 (commit)
via 3837a551c5755ae6e72c932355027b2a7a65f1f3 (commit)
via 242e37456881b51939d9dee3b5c3d89971107a80 (commit)
via 4b3b0c25a358144cdaa9d6df4c6515face5b4072 (commit)
via a2f1be38fc27a17d52b46eabbc34d5f3f3dd7a62 (commit)
via 3c631d92b63cadc6db8d9c93caba820d3c1025b4 (commit)
via 30ffe48d536979dd53fd5dbae916e8ed21613e45 (commit)
via ff5899bc01b375607c8e1618fe1341e9e45cac29 (commit)
via b2496cf2235942cc7a500f38d14a130767b15a90 (commit)
via 1936c2c910a0f0ba41c60fc0aeb35f901a698ea2 (commit)
via 2dee5a2863ae58100d196f4e54e5c87bfdb01ee7 (commit)
via fe67a56bef5370fcea7ff872d2e8efe31fc8cad9 (commit)
via c9665e8a594648c2da61ffb5d89c7dfab81c07a4 (commit)
via 6ee0c3e6374c3629a6f632b7801f32a7d785ee4c (commit)
via 52794b50e80f63330e29cd620ab2970eedc9b43c (commit)
via ada5dd780166b046bab702941fe67cce501e5fc4 (commit)
via 309165e0f93b66307890a21aef4606691b9ef7d4 (commit)
via 3a3da1f8144a1f151bb704d42d0bb59c6ce0228f (commit)
via b8f6ce955d6204f6d3bdd1d114943cd503e9b67d (commit)
via 74993cf45667e042fe433c9ccdc0f12df09e51fd (commit)
via 8c315373181ee5af67f1e30a0ec6caa116e74293 (commit)
via 5bedd87c55f02bf0e817fc80718a23124f6dcfe5 (commit)
via 05f296a5c2370f86c4e137250caa5cebb5d68900 (commit)
via 98b7cc178ec0ef62601495b58bf57f4ffba5b5bc (commit)
via 0c03c5c778a716585bfb545e8ce8e725f2af17c5 (commit)
via f0b0fee510d4f55d3e23caf2607b1b93bd92ebdb (commit)
via fe209a9ce4760308c717297d001d388ed23ae85f (commit)
via 3467203c17a2cdcf6a10b5b20686703c20f276c8 (commit)
via 0ebd380b046282ce89bff4d50cbeee13d24322d9 (commit)
via 99ae03a6e4aaa2d7f57d0cb7e631e91dc921b605 (commit)
via dc82ea2084d3e0c2d2d74d616120e604e17d4839 (commit)
via 6f590655476b19546454ed33d72359c7a2bb8cad (commit)
via 13a0a35320997e0b5c508bcbdeadf4a12c3968cd (commit)
via e5f6c6c8d056740490bb0663f7b4825eab8aa989 (commit)
via 32821b61ee3a3127a024b7ddab91bd3a1bf853dc (commit)
via 2055115569b7acc1d853ff916d5fddabbff5b913 (commit)
via 27763a32b5e37976651db239a4a42c9de4ffd85f (commit)
via bc1b2232d7086fe846ef2670483e83e1f9f188d6 (commit)
via 31f993c45f8331b427e4c8e1da9525313f4b8077 (commit)
via 68c94d4e587160a35d6fec3f498720468cc784eb (commit)
via 55c14e7c81d9fda798be1d02ab007c9f5efd33d9 (commit)
via dcf12cdce3634f6d5bfb27468a3a149f7d9d803c (commit)
via f17d634321c0263cf105db3458079c946cdd3e87 (commit)
via 50bd9994014bbd6751cc3ef40a9b0b44392d4662 (commit)
via 239e9f9b721efae0f3f867792931cf2609849f7a (commit)
via e0ec54d23446a02be929ae3273e6ceab65eb765a (commit)
via 3e58436feac1622a18085c590379b11078023af4 (commit)
via 205eceb36b9fd467729b6bb5b17d1e4f6d1069a9 (commit)
via e7bdd7f5626aebb8e8e6a4783122d90918052ff6 (commit)
via 5ba2cd989f1d2359a659ea0710e02c98e143b8e3 (commit)
via 5e02398ae5189d5ae4826379138ea2135c72812f (commit)
via 9510c93ea87dcc7e0a6e8e7fb2ab860cf9c0a9e1 (commit)
via 4fda8aa53f2bfce6c5801614e0b864c9c1df4fa3 (commit)
via 52a1f46832d9b517fe4b55e39e3b7eea56fdbf68 (commit)
via 1b969d5ca1cff59a8eb7079751ef12806e7a1557 (commit)
via 424872a4405055097c721491c840db1e82b20e36 (commit)
via 987cb4203c6b69df9c8236bf021c135021197fc9 (commit)
via adfb97c4da80a52ca99ae92ea9b3205e0d699633 (commit)
via e441979853bb8f653b62661dc703e2e6828bc298 (commit)
via ccb414aeef43a3ed9699eb80b1ecb683efb57ee8 (commit)
via 6404c8a146f333fbe6b1582723a5104236e8ffb4 (commit)
via 37f193250023dababfb529e90bf582608a31d9c7 (commit)
via d21239efd36feda8940c2cf7c49612b1d31c2522 (commit)
via 6ded666362346acc53e8c9b754b242b2e6ba079b (commit)
via bbe7199788fc4c15cf9985b72e3c98d67e40f1bf (commit)
via 7ce78c0d47bf2777f27bbca1e16e8e7472a86a40 (commit)
via 1083a9ebc043c44f0e891acaf87ed993ac79787f (commit)
via 74ec7884ae541a1e7160c2437e6382199dbde0a4 (commit)
via 919f3878732288aab994d61bf0e10dde166fd612 (commit)
via ac2d5433ba0510a6f6c0d47cae6348e9df7f7830 (commit)
via b80a8e0a3051def46d839b45de52e14419b72040 (commit)
via 78559adf17efaf20e18867cc6eb11f0112fff1be (commit)
via dd5e04b21f5c02088d034f1fd08012640d2d875e (commit)
via a419d13840fef330d973967df8b8b81ca2701898 (commit)
via 51dc355ca244584bbd7727d2a851d6c9fc8fa819 (commit)
via fb52ccdd4f344b6bb1f57643ef276afbd42f8916 (commit)
via b063b691f50d51f95b6a02b7108cb6aeb4441283 (commit)
via 406c78301547eef5c30ee3cb844183e6b8b57091 (commit)
via 2c81a780c240e17b896520b29cd85a645ca59cce (commit)
via 4da6acfce7663a0b93a7e450811488814844d6f9 (commit)
via bdd424f3fa50874a6d1d94959d1da739093e298e (commit)
via b2409f417b9d7be320e43347c256c2d72e55df78 (commit)
via 53640160edea2a3f10ee8a6f96d794bcd0a0d154 (commit)
via 39a6dcdcb26601fc7ceeb5b9b0a3372420ffe548 (commit)
from 7e2f80e4838000f1d2dd2ebe4f6a0298a1be1158 (commit)

- Log -----------------------------------------------------------------
commit 67ce1e50a6f938c1611cbc66fb74d73d24b14e12
Merge: 3837a55 7e2f80e
Author: Ken Lett <ken...@osuosl.org>
Date: Mon Mar 24 12:33:01 2014 -0700

fix merge conflicts

commit 3837a551c5755ae6e72c932355027b2a7a65f1f3
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 12:21:46 2013 -0800

Fix explicit vagrant references

refs #13785

commit 242e37456881b51939d9dee3b5c3d89971107a80
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 12:09:44 2013 -0800

Fix minor typos and duplicate reference error

refs #13785

commit 4b3b0c25a358144cdaa9d6df4c6515face5b4072
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:21:38 2013 -0800

Remove 'armstrong' theme setting

refs #13785

commit a2f1be38fc27a17d52b46eabbc34d5f3f3dd7a62
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit 3c631d92b63cadc6db8d9c93caba820d3c1025b4
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit 30ffe48d536979dd53fd5dbae916e8ed21613e45
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit ff5899bc01b375607c8e1618fe1341e9e45cac29
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 11:38:01 2013 -0800

resolve conflicts in rebase

refs #13785

commit b2496cf2235942cc7a500f38d14a130767b15a90
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit 1936c2c910a0f0ba41c60fc0aeb35f901a698ea2
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:26:58 2013 -0800

Point to correct version of 'issues' file

refs #13785

commit 2dee5a2863ae58100d196f4e54e5c87bfdb01ee7
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:21:38 2013 -0800

Remove 'armstrong' theme setting

refs #13785

commit fe67a56bef5370fcea7ff872d2e8efe31fc8cad9
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit c9665e8a594648c2da61ffb5d89c7dfab81c07a4
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:10:49 2013 -0700

re-arrange docs structure, add process docs

Major additions to:
- dev guide
- process docs

commit 6ee0c3e6374c3629a6f632b7801f32a7d785ee4c
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit 52794b50e80f63330e29cd620ab2970eedc9b43c
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Oct 24 09:59:59 2013 -0700

fix misc typos and mis-spellings

refs #13785

commit ada5dd780166b046bab702941fe67cce501e5fc4
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit 309165e0f93b66307890a21aef4606691b9ef7d4
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:10:49 2013 -0700

re-arrange docs structure, add process docs

Major additions to:
- dev guide
- process docs

commit 3a3da1f8144a1f151bb704d42d0bb59c6ce0228f
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit b8f6ce955d6204f6d3bdd1d114943cd503e9b67d
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 12:21:46 2013 -0800

Fix explicit vagrant references

refs #13785

commit 74993cf45667e042fe433c9ccdc0f12df09e51fd
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 12:09:44 2013 -0800

Fix minor typos and duplicate reference error

refs #13785

commit 8c315373181ee5af67f1e30a0ec6caa116e74293
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:26:58 2013 -0800

Point to correct version of 'issues' file

refs #13785

commit 5bedd87c55f02bf0e817fc80718a23124f6dcfe5
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:21:38 2013 -0800

Remove 'armstrong' theme setting

refs #13785

commit 05f296a5c2370f86c4e137250caa5cebb5d68900
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit 98b7cc178ec0ef62601495b58bf57f4ffba5b5bc
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit 0c03c5c778a716585bfb545e8ce8e725f2af17c5
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Oct 24 09:59:59 2013 -0700

fix misc typos and mis-spellings

refs #13785

commit f0b0fee510d4f55d3e23caf2607b1b93bd92ebdb
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit fe209a9ce4760308c717297d001d388ed23ae85f
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Nov 12 11:38:01 2013 -0800

resolve conflicts in rebase

refs #13785

commit 3467203c17a2cdcf6a10b5b20686703c20f276c8
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure

commit 0ebd380b046282ce89bff4d50cbeee13d24322d9
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:26:58 2013 -0800

Point to correct version of 'issues' file

refs #13785

commit 99ae03a6e4aaa2d7f57d0cb7e631e91dc921b605
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Nov 7 14:21:38 2013 -0800

Remove 'armstrong' theme setting

refs #13785

commit dc82ea2084d3e0c2d2d74d616120e604e17d4839
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit 6f590655476b19546454ed33d72359c7a2bb8cad
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:10:49 2013 -0700

re-arrange docs structure, add process docs

Major additions to:
- dev guide
- process docs

commit 13a0a35320997e0b5c508bcbdeadf4a12c3968cd
Author: Ken Lett <ken...@osuosl.org>
Date: Thu Oct 24 09:59:59 2013 -0700

fix misc typos and mis-spellings

refs #13785

commit e5f6c6c8d056740490bb0663f7b4825eab8aa989
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:12:26 2013 -0700

remove some un-used empty files

commit 32821b61ee3a3127a024b7ddab91bd3a1bf853dc
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:10:49 2013 -0700

re-arrange docs structure, add process docs

Major additions to:
- dev guide
- process docs

commit 2055115569b7acc1d853ff916d5fddabbff5b913
Author: Ken Lett <ken...@osuosl.org>
Date: Tue Oct 22 16:09:57 2013 -0700

re-arrange document structure


Summary of changes:
.gitignore | 2 -
README.rst | 514 +-----
Vagrantfile | 4 +-
chef/Berksfile.lock | 35 +-
chef/environments/vagrant.json | 6 +
docs/source/conf.py | 2 +-
docs/source/deployment/apache.conf | 18 +
docs/source/deployment/apache.rst | 48 +
docs/source/deployment/intro.rst | 52 +
docs/source/deployment/nginx.rst | 35 +
docs/source/deployment/nginx_site.conf | 19 +
docs/source/deployment/uwsgi.ini | 14 +
docs/source/deprecated/old_installing.rst | 30 +-
docs/source/dev/developers.rst | 11 +-
docs/source/dev/test_cluster.rst | 62 +
docs/source/dev/vagrant.rst | 35 +-
docs/source/features/vnc.rst | 11 +
docs/source/getting_started/deploying.rst | 77 -
docs/source/getting_started/installing.rst | 4 +-
docs/source/index.rst | 7 +-
ganeti_webmgr/clusters/models.py | 2 +-
ganeti_webmgr/clusters/views.py | 13 +-
ganeti_webmgr/ganeti_web/settings/base.py | 1 +
ganeti_webmgr/ganeti_web/settings/settings.py.dist | 3 -
ganeti_webmgr/ganeti_web/urls.py | 21 +-
ganeti_webmgr/ganeti_web/views/tables.py | 2 +-
.../cytoscape-lib/jquery.cytoscape-navigator.css | 61 +
.../js/cytoscape-lib/jquery.cytoscape-navigator.js | 628 +++++++
.../jquery.cytoscape-navigator.min.js | 38 +
ganeti_webmgr/static/css/help_tips.css | 6 +-
ganeti_webmgr/static/css/vm_wizard/base.css | 12 +
ganeti_webmgr/static/css/vm_wizard/summary.css | 15 +
ganeti_webmgr/static/js/helpTips.js | 32 +-
ganeti_webmgr/static/js/noVNC.js | 2 +-
ganeti_webmgr/templates/base.html | 9 +
ganeti_webmgr/templates/ganeti/cluster/detail.html | 4 -
ganeti_webmgr/templates/ganeti/cluster/edit.html | 8 +-
.../templates/ganeti/forms/create_choice.html | 18 +-
ganeti_webmgr/templates/ganeti/forms/helptips.html | 14 +
.../templates/ganeti/forms/step_controls.html | 20 +
ganeti_webmgr/templates/ganeti/forms/summary.html | 222 +++
.../templates/ganeti/forms/vm_wizard_base.html | 59 +
.../ganeti/forms/vm_wizard_generic_table.html | 24 +
.../ganeti/virtual_machine/edit_base.html | 8 +-
.../templates/ganeti/virtual_machine/novnc.html | 2 +-
.../templates/ganeti/virtual_machine/rename.html | 6 +-
.../templates/ganeti/virtual_machine/reparent.html | 4 +-
ganeti_webmgr/virtualmachines/forms.py | 16 +-
noVNC/LICENSE.txt | 78 +
noVNC/README.md | 130 ++
noVNC/debian/changelog | 35 +
noVNC/debian/compat | 1 +
noVNC/debian/control | 13 +
noVNC/debian/copyright | 36 +
noVNC/debian/novnc.install | 30 +
noVNC/debian/rules | 14 +
noVNC/docs/LICENSE.BSD-2-Clause | 22 +
noVNC/docs/LICENSE.BSD-3-Clause | 24 +
noVNC/docs/LICENSE.GPL-3 | 621 +++++++
noVNC/docs/LICENSE.LGPL-3 | 165 ++
noVNC/docs/LICENSE.MPL-2.0 | 373 ++++
noVNC/docs/LICENSE.OFL-1.1 | 91 +
noVNC/docs/LICENSE.zlib | 27 +
noVNC/docs/VERSION | 1 +
noVNC/docs/flash_policy.txt | 4 +
noVNC/docs/links | 76 +
noVNC/docs/notes | 17 +
noVNC/docs/packaging.txt | 23 +
noVNC/docs/release.txt | 8 +
noVNC/docs/rfb_notes | 147 ++
noVNC/docs/rfbproto-3.3.pdf | Bin 0 -> 110778 bytes
noVNC/docs/rfbproto-3.7.pdf | Bin 0 -> 165552 bytes
noVNC/docs/rfbproto-3.8.pdf | Bin 0 -> 143840 bytes
noVNC/favicon.ico | 1 +
noVNC/images/clipboard.png | Bin 0 -> 501 bytes
noVNC/images/connect.png | Bin 0 -> 404 bytes
noVNC/images/ctrlaltdel.png | Bin 0 -> 317 bytes
noVNC/images/disconnect.png | Bin 0 -> 1378 bytes
noVNC/images/drag.png | Bin 0 -> 963 bytes
noVNC/images/favicon.ico | Bin 0 -> 1150 bytes
noVNC/images/favicon.png | Bin 0 -> 453 bytes
noVNC/images/keyboard.png | Bin 0 -> 1283 bytes
noVNC/images/mouse_left.png | Bin 0 -> 511 bytes
noVNC/images/mouse_middle.png | Bin 0 -> 517 bytes
noVNC/images/mouse_none.png | Bin 0 -> 497 bytes
noVNC/images/mouse_right.png | Bin 0 -> 513 bytes
noVNC/images/screen_320x460.png | Bin 0 -> 12778 bytes
noVNC/images/screen_57x57.png | Bin 0 -> 1807 bytes
noVNC/images/screen_700x700.png | Bin 0 -> 17930 bytes
noVNC/images/settings.png | Bin 0 -> 2495 bytes
noVNC/include/Orbitron700.ttf | Bin 0 -> 38580 bytes
noVNC/include/Orbitron700.woff | Bin 0 -> 17472 bytes
noVNC/include/base.css | 405 +++++
noVNC/include/base64.js | 147 ++
noVNC/include/black.css | 52 +
noVNC/include/blue.css | 33 +
noVNC/include/des.js | 273 +++
noVNC/include/display.js | 757 ++++++++
noVNC/include/input.js | 1911 ++++++++++++++++++++
noVNC/include/jsunzip.js | 668 +++++++
noVNC/include/logo.js | 1 +
noVNC/include/playback.js | 90 +
noVNC/include/rfb.js | 1849 +++++++++++++++++++
noVNC/include/ui.js | 659 +++++++
noVNC/include/util.js | 320 ++++
noVNC/include/vnc.js | 43 +
noVNC/include/web-socket-js/README.txt | 109 ++
noVNC/include/web-socket-js/WebSocketMain.swf | Bin 0 -> 175746 bytes
noVNC/include/web-socket-js/swfobject.js | 4 +
noVNC/include/web-socket-js/web_socket.js | 341 ++++
noVNC/include/websock.js | 360 ++++
noVNC/include/webutil.js | 148 ++
noVNC/tests/arrays.html | 39 +
noVNC/tests/arrays.js | 375 ++++
noVNC/tests/base64.html | 91 +
noVNC/tests/base64.js | 12 +
noVNC/tests/browser.js | 134 ++
noVNC/tests/canvas.html | 148 ++
noVNC/tests/cursor.html | 135 ++
noVNC/tests/face.png | Bin 0 -> 2303 bytes
noVNC/tests/face.png.js | 1 +
noVNC/tests/input.html | 118 ++
noVNC/tests/stats.js | 53 +
noVNC/tests/viewport.css | 43 +
noVNC/tests/viewport.html | 202 ++
noVNC/tests/vnc_perf.html | 203 +++
noVNC/tests/vnc_playback.html | 134 ++
noVNC/utils/Makefile | 11 +
noVNC/utils/README.md | 11 +
noVNC/utils/img2js.py | 40 +
noVNC/utils/json2graph.py | 206 +++
noVNC/utils/launch.sh | 108 ++
noVNC/utils/nova-novncproxy | 152 ++
noVNC/utils/rebind | 18 +
noVNC/utils/rebind.c | 94 +
noVNC/utils/u2x11 | 28 +
noVNC/utils/web.py | 55 +
noVNC/utils/websocket.py | 930 ++++++++++
noVNC/utils/websockify | 285 +++
noVNC/utils/websockify.py | 1 +
noVNC/utils/wsproxy.py | 1 +
noVNC/vnc.html | 200 ++
noVNC/vnc_auto.html | 130 ++
requirements/dev.txt | 5 +-
requirements/{dev.txt => docs.txt} | 0
145 files changed, 15615 insertions(+), 691 deletions(-)
create mode 100644 docs/source/deployment/apache.conf
create mode 100644 docs/source/deployment/apache.rst
create mode 100644 docs/source/deployment/intro.rst
create mode 100644 docs/source/deployment/nginx.rst
create mode 100644 docs/source/deployment/nginx_site.conf
create mode 100644 docs/source/deployment/uwsgi.ini
create mode 100644 docs/source/dev/test_cluster.rst
delete mode 100644 docs/source/getting_started/deploying.rst
create mode 100644 ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.css
create mode 100644 ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.js
create mode 100644 ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.min.js
create mode 100644 ganeti_webmgr/static/css/vm_wizard/summary.css
create mode 100644 ganeti_webmgr/templates/ganeti/forms/helptips.html
create mode 100644 ganeti_webmgr/templates/ganeti/forms/step_controls.html
create mode 100644 ganeti_webmgr/templates/ganeti/forms/summary.html
create mode 100644 ganeti_webmgr/templates/ganeti/forms/vm_wizard_base.html
create mode 100644 ganeti_webmgr/templates/ganeti/forms/vm_wizard_generic_table.html
create mode 100644 noVNC/LICENSE.txt
create mode 100644 noVNC/README.md
create mode 100644 noVNC/debian/changelog
create mode 100644 noVNC/debian/compat
create mode 100644 noVNC/debian/control
create mode 100644 noVNC/debian/copyright
create mode 100644 noVNC/debian/novnc.install
create mode 100644 noVNC/debian/rules
create mode 100644 noVNC/docs/LICENSE.BSD-2-Clause
create mode 100644 noVNC/docs/LICENSE.BSD-3-Clause
create mode 100644 noVNC/docs/LICENSE.GPL-3
create mode 100644 noVNC/docs/LICENSE.LGPL-3
create mode 100644 noVNC/docs/LICENSE.MPL-2.0
create mode 100644 noVNC/docs/LICENSE.OFL-1.1
create mode 100644 noVNC/docs/LICENSE.zlib
create mode 100644 noVNC/docs/VERSION
create mode 100644 noVNC/docs/flash_policy.txt
create mode 100644 noVNC/docs/links
create mode 100644 noVNC/docs/notes
create mode 100644 noVNC/docs/packaging.txt
create mode 100644 noVNC/docs/release.txt
create mode 100644 noVNC/docs/rfb_notes
create mode 100644 noVNC/docs/rfbproto-3.3.pdf
create mode 100644 noVNC/docs/rfbproto-3.7.pdf
create mode 100644 noVNC/docs/rfbproto-3.8.pdf
create mode 120000 noVNC/favicon.ico
create mode 100644 noVNC/images/clipboard.png
create mode 100644 noVNC/images/connect.png
create mode 100644 noVNC/images/ctrlaltdel.png
create mode 100644 noVNC/images/disconnect.png
create mode 100644 noVNC/images/drag.png
create mode 100644 noVNC/images/favicon.ico
create mode 100644 noVNC/images/favicon.png
create mode 100644 noVNC/images/keyboard.png
create mode 100644 noVNC/images/mouse_left.png
create mode 100644 noVNC/images/mouse_middle.png
create mode 100644 noVNC/images/mouse_none.png
create mode 100644 noVNC/images/mouse_right.png
create mode 100644 noVNC/images/screen_320x460.png
create mode 100644 noVNC/images/screen_57x57.png
create mode 100644 noVNC/images/screen_700x700.png
create mode 100644 noVNC/images/settings.png
create mode 100644 noVNC/include/Orbitron700.ttf
create mode 100644 noVNC/include/Orbitron700.woff
create mode 100644 noVNC/include/base.css
create mode 100644 noVNC/include/base64.js
create mode 100644 noVNC/include/black.css
create mode 100644 noVNC/include/blue.css
create mode 100644 noVNC/include/des.js
create mode 100644 noVNC/include/display.js
create mode 100644 noVNC/include/input.js
create mode 100644 noVNC/include/jsunzip.js
create mode 100644 noVNC/include/logo.js
create mode 100644 noVNC/include/playback.js
create mode 100644 noVNC/include/rfb.js
create mode 100644 noVNC/include/ui.js
create mode 100644 noVNC/include/util.js
create mode 100644 noVNC/include/vnc.js
create mode 100644 noVNC/include/web-socket-js/README.txt
create mode 100644 noVNC/include/web-socket-js/WebSocketMain.swf
create mode 100644 noVNC/include/web-socket-js/swfobject.js
create mode 100644 noVNC/include/web-socket-js/web_socket.js
create mode 100644 noVNC/include/websock.js
create mode 100644 noVNC/include/webutil.js
create mode 100644 noVNC/tests/arrays.html
create mode 100644 noVNC/tests/arrays.js
create mode 100644 noVNC/tests/base64.html
create mode 100644 noVNC/tests/base64.js
create mode 100644 noVNC/tests/browser.js
create mode 100644 noVNC/tests/canvas.html
create mode 100644 noVNC/tests/cursor.html
create mode 100644 noVNC/tests/face.png
create mode 100644 noVNC/tests/face.png.js
create mode 100644 noVNC/tests/input.html
create mode 100644 noVNC/tests/stats.js
create mode 100644 noVNC/tests/viewport.css
create mode 100644 noVNC/tests/viewport.html
create mode 100644 noVNC/tests/vnc_perf.html
create mode 100644 noVNC/tests/vnc_playback.html
create mode 100644 noVNC/utils/Makefile
create mode 100644 noVNC/utils/README.md
create mode 100644 noVNC/utils/img2js.py
create mode 100644 noVNC/utils/json2graph.py
create mode 100644 noVNC/utils/launch.sh
create mode 100644 noVNC/utils/nova-novncproxy
create mode 100644 noVNC/utils/rebind
create mode 100644 noVNC/utils/rebind.c
create mode 100644 noVNC/utils/u2x11
create mode 100644 noVNC/utils/web.py
create mode 100644 noVNC/utils/websocket.py
create mode 100644 noVNC/utils/websockify
create mode 120000 noVNC/utils/websockify.py
create mode 120000 noVNC/utils/wsproxy.py
create mode 100644 noVNC/vnc.html
create mode 100644 noVNC/vnc_auto.html
copy requirements/{dev.txt => docs.txt} (100%)

diff --git a/.gitignore b/.gitignore
index be0c0ef..6058b8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,7 +51,6 @@ django
ganeti_web_layout
object_log
object_permissions
-noVNC
haystack
twisted_vncauthproxy

@@ -60,7 +59,6 @@ venv
env
bin
dependencies
-include
lib
local
pysqlite2-doc

diff --git a/README.rst b/README.rst
index 07ff05d..2a383f7 100644
--- a/README.rst
+++ b/README.rst
@@ -5,507 +5,61 @@ Ganeti Web Manager
Ganeti Web Manager is a Django-based web application that allows administrators
and clients access to their ganeti clusters.

-Ganeti compatibility:
+Documentation
+=============

-* >=2.4.x - supported
-* 2.2.2 - mostly supported
-* 2.3.1 - mostly supported
-* 2.1.x - mostly supported
-* 2.0.x - unsupported but may work
-* 1.x - unsupported
+Documentation_ for |gwm| is hosted by `Read the Docs <http://readthedocs.org>`_.
+You can find up to date documentation for current and previous releases at
+http://ganeti-webmgr.readthedocs.org/en/latest.

-Browser compatibility:
+Building the Documentation
+--------------------------

-* Mozilla Firefox >= 3.x
-* Chrome / Chromium
+Our documentation is written in ReStructuredText and built using Sphinx. First
+you will need to install the dependencies to a virtualenv or to your system's
+python installation::

-The VNC console requires WebSockets or flash support and HTML5 support in the
-browser.
+ pip install -r requirements/docs.txt

-Links
-=====
+Then you will need to run the following commands to build the documentation::

-* `Project page <http://code.osuosl.org/projects/ganeti-webmgr>`_
-* `Documentation <http://ganeti-webmgr.readthedocs.org/en/latest/>`_
-* `Mailing List <http://groups.google.com/group/ganeti-webmgr>`_
-* `Twitter <http://twitter.com/ganetiwebmgr>`_
-* IRC: ``#ganeti-webmgr`` on freenode.net
+ cd docs/
+ make html
+
+The documentation will be located at ``docs/build/html/`` as html files.
+If you open ``index.html`` with your web browser, it will take you to the
+table of contents.


Installation
============

-.. NOTE::
- Installing via the ``setup.sh`` script is now the preferred method. That
- script does everything for you. However it's still possible to install GWM
- in not-that-much automatic way.
-
-Installation script
--------------------
-
-Get ``setup.sh`` from https://github.com/pbanaszkiewicz/ganeti_webmgr-setup.
-Make it executable, run ``./setup.sh -h`` to get help message and then install
-GWM. Notice, that this script can upgrade your installation in future.
-
-For development
----------------
-
-Get yourself the ``virtualenvwrapper``. For your sanity. Then proceed with
-installation:
-
-.. code-block:: console
-
- $ mkvirtualenv gwm
- (gwm)$ git clone git://git.osuosl.org/gitolite/ganeti/ganeti_webmgr
- (gwm)$ cd ganeti_webmgr
- (gwm)$ python setup.py develop
-
-And that's it, you can now safely work on GWM.
-
-Manual installation
--------------------
-
-#) Install dependencies: Python, Pip, Virtualenv
-
-#) Get the Ganeti Web Manager code: Clone from the repository or download
- a release tarball
-
-#) Create a virtual environment in your desired location and install GWM in
- there by issuing ``python setup.py install`` in GWM directory (after you
- unzipped the tarball or cloned the repository)
-
-#) Configure settings: in directory ``ganeti_webmgr/ganeti_web/settings`` copy
- ``end_user.py.dist`` to ``end_user.py`` and make any modifications
-
-#) Sync database, then run the server: ``./ganeti_webmgr/manage.py syncdb --migrate``, then
- ``./ganeti_webmgr/manage.py runserver``
-
-Related Topics
---------------
-
-* `Troubleshoot <https://code.osuosl.org/projects/ganeti-webmgr/wiki/Fabric-troubleshooting>`_ an installation using Fabric
+For installation instructions please refer to our installation_ documentation.

-* `More on manual installation <https://code.osuosl.org/projects/ganeti-webmgr/wiki/Manual-installation>`_

Compatibility
--------------
-
-Ganeti Web Manager is compatible with the following:
-
-`Ganeti`_
- Ganeti >= v2.2.x is supported. v2.1.x and v2.0.x are unsupported and
- sometimes work but can cause problems (see `#8973`_). Lower versions are
- **not** supported.
-
-Browsers
- `Mozilla Firefox`_ >= v3.x, `Google Chrome`_ or `Chromium`_.
-
- Other contemporary browsers may also work, but are not supported. (The
- web-based VNC console requires browser support of `WebSockets`_ and `HTML5`_.
-
-Databases
- MySQL or SQLite. SQLite is not recommended in production environments.
-
-Operating systems
- GWM has been tested on Debian 7, Ubuntu 11.10, 12.04 and CentOs 5 and 6.
- Debian 6 is supported, provided the Pip, Virtualenv and Fabric packages are
- updated to the versions listed below.
-
-.. _#8973: https://code.osuosl.org/issues/8973
-.. _Ganeti: http://code.google.com/p/ganeti/
-.. _Mozilla Firefox: http://mozilla.com/firefox
-.. _Google Chrome: http://www.google.com/chrome/
-.. _Chromium: http://code.google.com/chromium/
-.. _WebSockets: http://en.wikipedia.org/wiki/WebSockets
-.. _HTML5: http://en.wikipedia.org/wiki/Html5
-
-Dependencies
-------------
-
-* `Python`_ >=2.5, Python >=2.6 recommended
-
-* `Virtualenv`_ >= 1.6.1
-
-.. _Python: http://python.org/
-.. _Virtualenv: http://pypi.python.org/pypi/virtualenv
-
-Other requirements are either `Virtualenv`_ dependencies or will get installed
-by setup script.
-
-* install Virtualenv:
-
-.. code-block:: console
-
- $ sudo apt-get install python-virtualenv
-
-
-Configuration
=============

-In the ``ganeti_webmgr/ganeti_web/settings`` directory, you'll find a default
-settings file called ``end_user.py.dist``. Copy it to ``end_user.py``:
-
-.. code-block:: console
-
- $ cp end_user.py.dist end_user.py
-
-If you want to use another database engine besides the default SQLite (not
-recommended for production), then in settings edit the following lines to
-reflect your wishes:
-
-.. code-block:: python
-
- DATABASE_ENGINE = '' # <-- Change this to 'mysql', 'postgresql',
- # 'postgresql_psycopg2' or 'sqlite3'
- DATABASE_NAME = '' # <-- Change this to a database name, or a file for
- # SQLite
- DATABASE_USER = '' # <-- Change this (not needed for SQLite)
- DATABASE_PASSWORD = '' # <-- Change this (not needed for SQLite)
- DATABASE_HOST = '' # <-- Change this (not needed if database is
- # localhost)
- DATABASE_PORT = '' # <-- Change this (not needed if database is
- # localhost)
-
-.. WARNING::
- PostgreSQL support was fixed just recenly, check if your GWM version has
- it. See issue `#3237`_.
-
-.. _#3237: https://code.osuosl.org/issues/3237
-
-Initialize Database:
-
-.. code-block:: console
-
- $ ./ganeti_webmgr/manage.py syncdb --migrate
-
-Build the search indexes:
-
-.. code-block:: console
-
- $ ./ganeti_webmgr/manage.py rebuild_index
-
-.. NOTE::
- Running ``./ganeti_webmgr/manage.py update_index`` on a regular basis
- ensures that the search indexes stay up-to-date when models change in
- Ganeti Web Manager.
-
-Everything should be all set up! Run the development server with:
-
-.. code-block:: console
-
- $ ./ganeti_webmgr/manage.py runserver
-
-Additional configuration for production servers
------------------------------------------------
-
-Deploying a production server requires additional setup steps.
-
-1. Change the ownership of the ``whoosh_index`` directory to apache
-
-.. code-block:: console
-
- $ chown apache:apache whoosh_index/
-
-2. Change your ``SECRET_KEY`` and ``WEB_MGR_API_KEY`` to unique (and hopefully
- unguessable) strings in your ``end_user.py`` settings file.
-
-3. Configure the `Django Cache Framework`_ to use a production capable backend
- in ``end_user.py``. By default Ganeti Web Manager is configured to use the
- ``LocMemCache`` but it is not recommended for production. Use Memcached or
- a similar backend.
-
-.. code-block:: python
-
- CACHES = {
- 'default': {
- 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
- }
- }
-
-4. For versions >= 0.5 you may need to add the full filesystem path to your
- templates directory to ``TEMPLATE_DIRS`` and remove the relative reference
- to 'templates'. We've had issues using wsgi not working correctly unless
- this change has been made.
-
-5. Ensure the server has the ability to send emails or you have access to an
- SMTP server. Set ``EMAIL_HOST``, ``EMAIL_PORT``, and ``DEFAULT_FROM_EMAIL``
- in ``end_user.py``. For more complicated outgoing mail setups, please refer to the `Django Email documentation`_.
-
-6. Follow the `Django guide <http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/>`_ to deploy with apache.
- Here is an example mod_wsgi file:
-
-.. code-block:: python
-
- import os
- import sys
-
- path = '/var/lib/django/ganeti_webmgr'
-
- # activate virtualenv
- activate_this = '%s/venv/bin/activate_this.py' % path
- execfile(activate_this, dict(__file__=activate_this))
-
- # add project to path
- if path not in sys.path:
- sys.path.append(path)
-
- # configure django environment
- os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
- import django.core.handlers.wsgi
- application = django.core.handlers.wsgi.WSGIHandler()
-
-7. Set ``VNC_PROXY`` to the hostname of your VNC AuthProxy server in
- ``end_user.py``. The VNC AuthProxy does not need to run on the same server as Ganeti Web Manager.
-
-.. code-block:: python
-
- VNC_PROXY = 'my.server.org:8888'
-
-Also see the `Install documentation <https://gwm.readthedocs.org/en/latest/deployment.html>`_.
-
-.. _Django Cache Framework: http://docs.djangoproject.com/en/dev/topics/cache/
-.. _Django Email documentation: http://docs.djangoproject.com/en/1.2/topics/email/
-
-
-Ganeti RAPI users and passwords
-===============================
-
-Before you can start using Ganeti Web Manager, you will need to create a user
-and password on the Ganeti cluster.
-
-Here is an example with user "jack" and password "abc123":
-
-.. code-block:: console
-
- $ echo -n 'jack:Ganeti Remote API:abc123' | openssl md5
-
-Add the hash to the RAPI users file and restart ganeti-rapi. Depending on the
-version of Ganeti you are running, you will need to either use
-``/var/lib/ganeti/rapi_users`` (Ganeti <=2.3.x ) or
-``/var/lib/ganeti/rapi/users`` (Ganeti >=2.4.x ).
-
-An example hash entry might look like the following:
-
-.. code-block:: console
-
- # Hashed password for jack
- jack {HA1}54c12257ee9be413f2f3182435514aae write
+For a list of versions and browsers supported by |gwm| check our compatibility_ documentation.

-Also see `managing clusters documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Managing_Clusters#Ganeti-RAPI-users-and-passwords>`_.

-
-Importing a Cluster
-===================
-
-#) Use the admin user created during syncdb to log in.
-
-#) Import a cluster: Clusters -> Add Cluster
-
-#) Fill out properties and click save
-
-When the cluster is created it will automatically synchronize the list of
-Virtual Machines with information from the Ganeti cluster.
-
-Also see `importing cluster documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Importing_a_Cluster>`_.
-
-
-Users, Groups and Permissions
-=============================
-
-Permissions may be granted to both clusters and virtual machines. The
-permissions system is intended to allow users to manage themselves. Any object
-that can have its permissions edited will have a Users tab.
-
-
-Adding users to objects:
-
-#) Navigate to Group, Cluster, or Virtual Machine detail page
-
-#) Click Add New User
-
-#) Select user or group
-
-#) Select permissions
-
-#) Save
-
-
-Updating permissions:
-
-#) Navigate to Group, Cluster, or Virtual Machine detail page
-
-#) Click Users tab
-
-#) Click permissions column
-
-#) Select permissions and save
-
-
-Deleting permissions:
-
-#) Navigate to Group, Cluster, or Virtual Machine detail page
-
-#) Click Users tab
-
-#) Click the delete icon
-
-Deleting a user will remove all permissions, and other properties associated
-with the user such as cluster quotas.
-
-Users may belong to any number of user groups. User groups can be assigned
-permissions and quotas just like users. Users inherit permissions from groups
-and may act on their behalf to create virtual machines.
-
-Also see `permissions documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Permissions>`_.
-
-
-Assigning Quotas
-================
-
-Quotas restrict the usage of cluster resources by users and groups. Default
-quotas can be set by editing clusters, if no quota is set unlimited access is
-allowed. This will affect all users and groups.
-
-
-The default quota can be overridden on the cluster users page:
-
-#) Clusters -> Cluster -> Users
-
-#) Click on the quota
-
-#) Edit values
-
-
-Leaving a value empty specifies unlimited access for that resource.
-
-Also see `quotas documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Permissions#Quotas>`_.
-
-
-Orphaned Virtual Machines
-=========================
-
-You can find Virtual Machines with no permissions via Admin -> Orphaned VMs.
-This will force a synchronization of all clusters and display Virtual Machines
-that do not have any permissions assigned.
-
-You only need to grant permissions directly on virtual machines if you are
-granting access to non-admin users.
-
-Also see `the documentation page about orphaned virtual machines <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Managing_Clusters#Orphaned-Virtual-Machines>`_.
-
-
-Cache System
+Dependencies
============

-Ganeti Web Manager uses a cache system that stores information about Ganeti
-clusters in the database. This allows the following:
-
-.. code-block:: console
-
- --- Ganeti ---
- / \
- / \
- Cluster -> <- Bulk
- Model <- cache <- Updater
-
-* Permissions are stored in the database and are associated to the cached
- objects
-
-* The cached data can be searched and or filtered
-
-* Limits the amount of traffic between the web server and Ganeti cluster.
-
-The cache system is transparent and will load cached data automatically when
-the object is initialized.
-
-Also see `cache system documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/Cache_System>`_.
-
-
-VNC
-===
-
-Ganeti Web Manager provides an in browser console using `noVNC`_, an HTML5
-client. noVNC requires WebSockets to function. Support for older browsers is
-provided through a flash applet that is used transparently in the absence of
-WebSockets.
-
-.. _noVNC: https://github.com/kanaka/noVNC
-
-Also see `the VNC documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/VNC>`_.
-
-
-VNC AuthProxy
-=============
-
-`VNC Auth proxy`_ is required for the console tab to function. VNC servers do
-not speak websockets and our proxy allows your ganeti cluster to sit behind a
-firewall, VPN, or NAT.
-
-Enabling in settings file
--------------------------
-
-Set the host and port that the proxy will be running at with the ``VNC_PROXY``
-setting. For development this is typically ``"localhost:8888"`` but for
-production you would use the name of the server its running on. See the
-instructions in ``end_user.py`` for more details.
-
-Starting the Daemon
--------------------
-
-Twisted VNC Authproxy is started with twistd, the twisted daemon. Eventually
-we will include ``init.d`` scripts for better managing the daemon. You may
-want to open port 8888 in your firewall for production systems.
+A list of dependencies can be found in our requirements_ documentation.

-.. code-block:: console
-
- $ twistd --pidfile=/tmp/proxy.pid -n vncap
-
-Starting Flash Policy Server
-----------------------------
-
-Browsers that do not support WebSockets natively are supported through the use
-of a flash applet. Flash applets that make use of sockets must retrieve
-a policy file from the server they are connecting to. Twisted VNCAuthProxy
-includes a policy server. It must be run separately since it requires a root
-port. You may want to open port 843 in your firewall for production systems.
-
-Start the policy server with twistd:
-
-.. code-block:: console
-
- $ sudo twistd --pidfile=/tmp/policy.pid -n flashpolicy
-
-
-Possible issues
----------------
-
-You may encounter an issue where twisted fails to start and gives you an error.
-This is usually caused by the environment variable ``PYTHONPATH`` not being
-exported correctly if you sudo up to root. To fix it type:
-
-.. code-block:: console
-
- $ export PYTHONPATH="."
-
-Try executing Twisted again and it should work.
-
-.. _VNC Auth Proxy: http://code.osuosl.org/projects/twisted-vncauthproxy
-
-Also see `the VNC AuthProxy documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/VNC#VNC-Authproxy>`_.
-
-
-SSH Keys
-========
+Links
+=====

-Ganeti Web Manager allows users to store SSH Keys. Each virtual machine has a
-view that will return SSH keys for users with access. This can be used as a
-Ganeti post-install hook to deploy user's keys on the VMs.
+* `Project page <http://code.osuosl.org/projects/ganeti-webmgr>`_
+* Documentation_
+* `Mailing List <http://groups.google.com/group/ganeti-webmgr>`_
+* `Twitter <http://twitter.com/ganetiwebmgr>`_
+* IRC: ``#ganeti-webmgr`` on freenode.net

-To allow VMs to copy keys, copy ``util/hooks/sshkeys.sh`` to the instance
-definition hooks directory on every node in the cluster and make the file
-executable. Next, add the required variables to the variant config file
-or main instance definition config file. The config file can be found in
-``util/hooks/sshkeys.conf`` and includes documentation for each variable.
+.. _installation: http://ganeti-webmgr.readthedocs.org/en/latest/getting_started/installing.html
+.. _compatibility: http://ganeti-webmgr.readthedocs.org/en/latest/project_info/compatibility.html
+.. _requirements: http://ganeti-webmgr.readthedocs.org/en/latest/getting_started/requirements.html
+.. _Documentation: http://ganeti-webmgr.readthedocs.org/en/latest

-Also see `the SSH Keys documentation page <http://code.osuosl.org/projects/ganeti-webmgr/wiki/PermissionsSSHKeys>`_.
+.. |gwm| replace:: Ganeti Web Manager

diff --git a/Vagrantfile b/Vagrantfile
index 68cf87b..d5fd440 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -4,11 +4,11 @@
MOUNT_POINT = '/home/vagrant/ganeti_webmgr'

Vagrant.configure("2") do |config|
- config.vm.hostname = "gwm"
+ config.vm.hostname = "gwm.example.org"
config.vm.box = "Berkshelf-CentOS-6.3-x86_64-minimal"
config.vm.box_url = "https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box"

- config.vm.network :private_network, ip: "33.33.33.10"
+ config.vm.network :private_network, ip: "33.33.33.100"

config.berkshelf.berksfile_path = "chef/Berksfile"
config.berkshelf.enabled = true

diff --git a/chef/Berksfile.lock b/chef/Berksfile.lock
index b5b8383..11e76f1 100644
--- a/chef/Berksfile.lock
+++ b/chef/Berksfile.lock
@@ -1,54 +1,52 @@
{
"sources": {
"ganeti_webmgr": {
- "locked_version": "0.2.0",
- "git": "git://github.com/osuosl-cookbooks/ganeti_webmgr.git",
- "ref": "a132faca9280f9574a454931dcc84080f84a77f6"
+ "path": "../../cookbooks/ganeti_webmgr"
},
"python": {
- "locked_version": "1.4.0"
+ "locked_version": "1.3.6"
},
"build-essential": {
- "locked_version": "1.4.2"
+ "locked_version": "1.4.0"
},
"yum": {
- "locked_version": "2.3.2"
+ "locked_version": "2.3.0"
},
"git": {
- "locked_version": "2.7.0"
+ "locked_version": "2.6.0"
},
"dmg": {
- "locked_version": "2.0.4"
+ "locked_version": "2.0.0"
},
"windows": {
- "locked_version": "1.11.0"
+ "locked_version": "1.10.0"
},
"chef_handler": {
"locked_version": "1.1.4"
},
"runit": {
- "locked_version": "1.2.0"
+ "locked_version": "1.1.6"
},
"supervisor": {
- "locked_version": "0.4.8"
+ "locked_version": "0.4.4"
},
"gunicorn": {
- "locked_version": "1.1.2"
+ "locked_version": "1.1.0"
},
"nginx": {
- "locked_version": "1.8.0"
+ "locked_version": "1.7.0"
},
"apt": {
- "locked_version": "2.1.1"
+ "locked_version": "2.1.0"
},
"ohai": {
- "locked_version": "1.1.12"
+ "locked_version": "1.1.10"
},
"mysql": {
- "locked_version": "3.0.4"
+ "locked_version": "3.0.2"
},
"openssl": {
- "locked_version": "1.1.0"
+ "locked_version": "1.0.2"
},
"sqlite": {
"locked_version": "1.0.0"
@@ -64,6 +62,9 @@
},
"xfs": {
"locked_version": "1.1.0"
+ },
+ "hostsfile": {
+ "locked_version": "2.4.2"
}
}
}

diff --git a/chef/environments/vagrant.json b/chef/environments/vagrant.json
index 8342929..00d17fd 100644
--- a/chef/environments/vagrant.json
+++ b/chef/environments/vagrant.json
@@ -19,6 +19,12 @@
"password": "vagrant",
"host": "localhost",
"port": 3306
+ },
+ "hostsfile": {
+ "33.33.33.10": "ganeti.example.org",
+ "33.33.33.11": "node1.example.org",
+ "33.33.33.12": "node2.example.org",
+ "33.33.33.13": "node3.example.org"
}
}
},

diff --git a/docs/source/conf.py b/docs/source/conf.py
index cf602ec..7395009 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -46,7 +46,7 @@ master_doc = 'index'

# General information about the project.
project = u'Ganeti Web Manager'
-copyright = u'2012, Oregon State University Open Source Lab'
+copyright = u'2013, Oregon State University Open Source Lab'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the

diff --git a/docs/source/deployment/apache.conf b/docs/source/deployment/apache.conf
new file mode 100644
index 0000000..3ddefdd
--- /dev/null
+++ b/docs/source/deployment/apache.conf
@@ -0,0 +1,18 @@
+WSGIDaemonProcess ganeti_web processes=4 threads=1 \
+ python-path=/path/to/ganeti_webmgr/ganeti_web:/path/to/ganeti_webmgr/venv/lib/python2.7/site-packages
+WSGIProcessGroup ganeti_web
+WSGIScriptAlias / /path/to/ganeti_webmgr/ganeti_web/ganeti_web/wsgi.py
+
+Alias /static/ /path/to/ganeti_webmgr/collected_static/
+
+<Directory /path/to/ganeti_webmgr/collected_static>
+ Order deny,allow
+ Allow from all
+</Directory>
+
+<Directory /path/to/ganeti_webmgr>
+<Files wsgi.py>
+ Order allow,deny
+ Allow from all
+</Files>
+</Directory>
\ No newline at end of file

diff --git a/docs/source/deployment/apache.rst b/docs/source/deployment/apache.rst
new file mode 100644
index 0000000..7986ff1
--- /dev/null
+++ b/docs/source/deployment/apache.rst
@@ -0,0 +1,48 @@
+.. _apache:
+
+=================
+Apache + mod_wsgi
+=================
+
+Overview
+========
+
+Before beginning deploying |gwm| using Apache, read the following Django article
+on `deploying Django with apache and mod_wsgi <https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/>`_.
+
+To get |gwm| installed there are a few steps.
+
+* Install Apache
+* Configure/install ``mod_wsgi`` and other Apache modules
+* Create the |gwm| VirtualHost
+
+Configuration
+-------------
+Make sure you have mod_wsgi installed and enabled in Apache before beginning.
+
+Next you want to create a vhost which will contain the Apache settings
+that will point to our Django app. In the Apache config or ``<VirualHost>``
+you will need at least the following:
+
+.. _apache_conf:
+
+.. literalinclude:: apache.conf
+ :language: apache
+
+``WSGIDaemonProcess``:
+ ``processes`` should be set to the number of CPU cores available.
+ ``threads`` is fine to be left at 1.
+ ``python-path`` is adding our virtualenv's site packages and |gwm| to the
+ python path before executing the wsgi app.
+ More info on this particular directive can be found on the `mod_wsgi docs
+ <https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process>`_.
+
+``WSGIScriptAlias``:
+ This is the base URL path that |gwm| will be served at. In this case its at
+ ``/`` (the root url).
+
+``Alias``:
+ Defines where to find the static assets (css, js, images) for |gwm|. This
+ lets Apache serve the static files instead of having Django do it.
+ You can leave this as is unless you modified the ``end_user.py`` settings.
+

diff --git a/docs/source/deployment/intro.rst b/docs/source/deployment/intro.rst
new file mode 100644
index 0000000..2eb0481
--- /dev/null
+++ b/docs/source/deployment/intro.rst
@@ -0,0 +1,52 @@
+.. _deployment:
+
+===========
+Development
+===========
+
+|gwm| supports various methods of deployment. By default Django ships with a
+simple python web server for development purposes. If your just trying to get
+|gwm| up and running, or you simply want to contribute to the project then using
+the :ref:`development-server` is probably your best bet. Otherwise check out
+:ref:`static-files`.
+
+.. _development-server:
+
+Development Server
+----------------------
+
+If you are just testing |gwm| out, run::
+
+ $ python ganeti_webmgr/manage.py runserver
+
+Then open a web browser, and navigate to
+`http://localhost:8000`::
+
+ firefox http://localhost:8000
+
+.. Note:: This should only be used to *test*. This should never be used in a
+ *production* environment.
+
+
+.. _static-files:
+
+============
+Static Files
+============
+
+Django is not very good at serving static files like CSS and Javascript.
+This is why we use web servers like Apache or Nginx. So we need to collect all
+of our static files into a single directory. To do this from the project root
+edit `ganeti_web/ganeti_web/settings/end_user.py` and update the `STATIC_ROOT`
+value to be the full absolute path to a where you would like to collect all
+the static assets at. After this run the following commands from the project root
+
+::
+
+ source venv/bin/activate
+ python ganeti_webmgr/manage.py collectstatic
+
+Once you've done that, you can move on to deploying using your prefered web server.
+
+* :ref:`Apache <apache>`
+* :ref:`Nginx <nginx>`
\ No newline at end of file

diff --git a/docs/source/deployment/nginx.rst b/docs/source/deployment/nginx.rst
new file mode 100644
index 0000000..c909d9b
--- /dev/null
+++ b/docs/source/deployment/nginx.rst
@@ -0,0 +1,35 @@
+.. _nginx:
+
+=====
+Nginx
+=====
+
+uWSGI
+=====
+
+Before you begin, it is adviced you read over the following uWSGI article on
+`setting up Django with uWSGI and Nginx <https://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html>`_
+
+Configuration
+-------------
+
+First you will want to install uWSGI to the virtualenv which is easily done
+with the following commands::
+
+ cd /path/to/ganeti_webmgr
+ source venv/bin/activate
+ pip install uwsgi
+
+Once uWSGI is installed you should configure Nginx to handle serving our static
+assets and proxy the rest to uWSGI. Here is a sample nginx virtual host:
+
+
+.. _nginx_conf:
+
+.. literalinclude:: nginx_site.conf
+ :language: nginx
+
+Finally you will want to configure uWSGI. Here is a sample uWSGI configuration
+file that should properly work with GWM:
+
+.. literalinclude:: uwsgi.ini

diff --git a/docs/source/deployment/nginx_site.conf b/docs/source/deployment/nginx_site.conf
new file mode 100644
index 0000000..cc53160
--- /dev/null
+++ b/docs/source/deployment/nginx_site.conf
@@ -0,0 +1,19 @@
+upstream gwm {
+ # server unix:///path/to/gwm_uwsgi.sock; # for a file socket
+ server 127.0.0.1:8001;
+}
+
+server {
+ listen 80;
+ server_name example.org;
+
+ location /static {
+ alias /path/to/ganeti_webmgr/collected_static;
+
+ }
+
+ location / {
+ uwsgi_pass gwm;
+ include uwsgi_params;
+ }
+}
\ No newline at end of file

diff --git a/docs/source/deployment/uwsgi.ini b/docs/source/deployment/uwsgi.ini
new file mode 100644
index 0000000..fc74df1
--- /dev/null
+++ b/docs/source/deployment/uwsgi.ini
@@ -0,0 +1,14 @@
+[uwsgi]
+
+# GWM-related settings
+chdir = /path/to/ganeti_webmgr/ganeti_web
+# GWM's wsgi file
+module = ganeti_web.wsgi
+# the virtualenv (full path)
+home = /path/to/ganeti_webmgr/venv/
+
+# Configure based on needs
+master = true
+processes = 2
+socket = 127.0.0.1:8001
+vacuum = true

diff --git a/docs/source/deprecated/old_installing.rst b/docs/source/deprecated/old_installing.rst
index c1f75a5..bc62e61 100644
--- a/docs/source/deprecated/old_installing.rst
+++ b/docs/source/deprecated/old_installing.rst
@@ -95,37 +95,29 @@ Initializing

#. Initialize Database:

- MySQL/SQLite:
-
- ::
+ **Existing** Database::

# Create new tables and migrate all apps using southdb
./manage.py syncdb --migrate

- Postgres:
-
- .. Note:: This assumes your doing a fresh install of |gwm| on a new Postgres database.
-
- ::
+ **New** Database::

./manage.py syncdb --all
./manage.py migrate --fake

-#. Build the search indexes
-
- ::
+#. Build the search indexes::

- ./manage.py rebuild_index
+ ./manage.py rebuild_index

- .. Note:: Running **./manage.py update\_index** on a regular basis
- ensures that the search indexes stay up-to-date when models change in
- Ganeti Web Manager.
+ .. Note:: Running **./manage.py update\_index** on a regular basis
+ ensures that the search indexes stay up-to-date when models change in
+ Ganeti Web Manager.

Next Steps
----------

-Congratulations! |gwm| is now installed and initialized. Next, you'll want
-to look into :ref:`configuring` and :ref:`deploying`, if you are going
-to be setting up a production instance. Otherwise, if you just want to
+Congradulations! |gwm| is now installed and initialized. Next, you'll want
+to look into :ref:`configuring` and :ref:`deployment <deployment>`, if you are
+going to be setting up a production instance. Otherwise, if you just want to
play around with |gwm|, or are :ref:`developing <development>`, take a look at
-:ref:`test-server`.
+:ref:`development-server`.

diff --git a/docs/source/dev/developers.rst b/docs/source/dev/developers.rst
index 449d2f1..5f28ca2 100644
--- a/docs/source/dev/developers.rst
+++ b/docs/source/dev/developers.rst
@@ -62,6 +62,7 @@ When working on new code, be sure to create a new branch from the appropriate pl
- **develop** - if this is a new feature
- **release/<version>** - if this is a bug fix on an existing release

+
Code Standards
--------------

@@ -153,7 +154,7 @@ To test new code in |gwm| it is often necessary to have a Ganeti cluster to mana

- clone https://github.com/ramereth/vagrant-ganeti.git
- add the following to your hosts file :
-
+
::

33.33.33.10 ganeti.example.org
@@ -163,7 +164,7 @@ To test new code in |gwm| it is often necessary to have a Ganeti cluster to mana

- enter the vagrant-ganeti directory and type

-::
+ ::

vagrant up node1

@@ -203,10 +204,8 @@ Ganeti Web Manager is designed to support translation to other languages using D
fit well in a single line
{% endblocktrans %}

-
`Django's i18n page`_ has more information about this.

-
Fixing Bugs
-----------

@@ -313,7 +312,6 @@ Submitting Code

Please read :ref:`process` for details on how we triage, review and merge contributed code.

-
Patches
'''''''

@@ -361,7 +359,4 @@ Translations should be submitted via patches, a pull request, or by attaching a

For details on how to write translation strings and how to make use of them, please see `Django's i18n page`_

-
.. _`Django's i18n page`: https://docs.djangoproject.com/en/dev/topics/i18n/
-
-

diff --git a/docs/source/dev/test_cluster.rst b/docs/source/dev/test_cluster.rst
new file mode 100644
index 0000000..d95794a
--- /dev/null
+++ b/docs/source/dev/test_cluster.rst
@@ -0,0 +1,62 @@
+.. test_cluster:
+
+Vagrant Test Cluster
+====================
+
+For development we use Vagrant to set up a Ganeti Cluster to test on.
+
+Setup
+~~~~~
+
+The Vagrant Test cluster is not included with |gwm| and is a separate
+repository, that must be cloned::
+
+ git clone https://github.com/osuosl/vagrant-ganeti
+
+Once you've cloned the repository you can refer to its `README
+<https://github.com/osuosl/vagrant-ganeti>`_ for more details on how to use it.
+
+Updating
+~~~~~~~~
+
+If you already have the repository, you should also always make sure you are
+running the most up to date version of the code. There are two ways to do this::
+
+ git pull
+ git submodule update --init
+
+Or you can simply use the update script in the repo which does the previous
+two commands::
+
+ ./update
+
+Either way will work, but make sure that both the repository **and** the
+submodules are updated.
+
+Basic Usage
+~~~~~~~~~~~
+
+The vagrant-ganeti project comes with 3 Ganeti nodes which can be used for
+testing deployment of VMs. You typically only need **1 node** unless you are
+testing multi-node operations.
+
+- You can bring up the first node by typing ``vagrant up node1``.
+
+- The other nodes can be brought up the same way, just swap out ``node1`` with
+ ``node2`` or ``node3``.
+
+You can also bring up every node by using just ``vagrant up``, however if you
+do not have much RAM or you are already running memory intensive programs, this
+should be avoided.
+
+
+Using with |gwm|
+~~~~~~~~~~~~~~~~
+
+Once you have ``node1`` running, you can add it to |gwm| by using the `add
+cluster` button on the cluster page.
+
+The hostname field should be filled in with the IP Address for the given
+node, which can be found in the Vagrantfile. The *username* and *password* are
+both **vagrant**, which will let you communicate with the cluster.
+

diff --git a/docs/source/dev/vagrant.rst b/docs/source/dev/vagrant.rst
index 17009f0..91b3c46 100644
--- a/docs/source/dev/vagrant.rst
+++ b/docs/source/dev/vagrant.rst
@@ -1,9 +1,9 @@
.. _vagrant:

Vagrant
---------
+-------

-Vagrant is a tool to help automate the creation
+`Vagrant <http://www.vagrantup.com/>`__ is a tool to help automate the creation
and deployment of virtual machines for development purposes. It reduces the
amount of effort to make sure multiple developers are using the same set of
tools to reduce complaints of "but it worked on my machine".
@@ -16,11 +16,20 @@ within Vagrant.
What you get
~~~~~~~~~~~~

-If your using Vagrant to run |gwm| what you get is a symlink in the vagrant
-home directory of the project. You also get a MySQL Database configured and
-ready to use with |gwm|. You also will get a Django superuser who's credentials
-by default are `admin` and `password` as the username and password respectively.
-This can be configured by overriding the Chef attributes in the `Vagrantfile`.
+- In ``/home/vagrant/ganeti_webmgr`` you will have your project mounted.
+ All changes made to files in your project folder either in Vagrant, or on the
+ host will be seen on both systems.
+
+- You will have a Django Superuser created with the following credentials
+ (these can be changed in the ``Vagrantfile``):
+
+ **username**: admin
+
+ **password**: password
+
+- A MySQL Database and User pre-configured for |gwm|
+
+All of these values can be changed by overriding the Chef attributes in the ``Vagrantfile``.

Use
~~~
@@ -31,6 +40,7 @@ or greater and two vagrant plugins, `vagrant-berkshelf` and `vagrant-omnibus`.
`Installing Vagrant`_ is easy, you can install it to your system by downloading the appropriate package, and running it.

To install the `vagrant-berkshelf`_ and `vagrant-omnibus`_ plugins run the following command in your terminal
+
::

vagrant plugin install vagrant-berkshelf
@@ -49,15 +59,16 @@ Then you need to run the following command to have it reprovision the VM::

vagrant provision

-Once Vagrant has finished running, and provisioning, your Virtual Machine will be running and ready for use. You can get to the VM by using the ``vagrant ssh`` command to get to the VM. To run |gwm| you need to source your `virtualenv` and start the :ref:`test-server`
-
-::
+Once Vagrant has finished running, and provisioning, your Virtual Machine will
+be running and ready for use. You can get to the VM by using the ``vagrant ssh``
+command to get to the VM. To run |gwm| you need to source your `virtualenv` and
+start the :ref:`development-server`::

source ~/venv/bin/activate
cd ~/ganeti_webmgr
python ganeti_webmgr/manage.py runserver 0.0.0.0:8000

-From there you can visit |gwm| at (by default) 33.33.33.10:8000 in your web browser.
+From there you can visit |gwm| at (by default) 33.33.33.100:8000 in your web browser.

.. note:: The reason we runserver on 0.0.0.0 is because by default it runs on
127.0.0.1 which is only accessable from the VM.
@@ -77,4 +88,4 @@ the cookbook's github here: https://github.com/osuosl-cookbooks/ganeti_webmgr
.. _vagrant-berkshelf: https://github.com/riotgames/vagrant-berkshelf
.. _vagrant-omnibus: https://github.com/schisamo/vagrant-omnibus
.. _Chef: http://www.opscode.com/chef/
-.. _`Vagrant home page`: http://www.vagrantup.com/
\ No newline at end of file
+.. _`Vagrant home page`: http://www.vagrantup.com/

diff --git a/docs/source/features/vnc.rst b/docs/source/features/vnc.rst
index c657607..5f19977 100644
--- a/docs/source/features/vnc.rst
+++ b/docs/source/features/vnc.rst
@@ -6,6 +6,7 @@ client. noVNC requires WebSockets to function. Support for older
browsers is provided through a flash applet that is used transparently
in the absence of WebSockets.

+
.. _vnc-authproxy:

VNC AuthProxy
@@ -45,6 +46,9 @@ If the host is localhost then the proxy will only be accessible to
clients and browsers on the same machine as the proxy. Production
servers should use a public hostname or IP.

+.. note:: If using :ref:`vagrant`, you will need to add the VM's FQDN and IP address
+ to your ``/etc/hosts`` file.
+
::

# located in your settings file
@@ -110,3 +114,10 @@ If not using a virtualenv, then you must manually set the ``PYTHONPATH``
environment variable as root::

export set PYTHONPATH=.
+
+
+Known Issues
+------------
+
+While Chrome/Chromium supports websockets, currently VNC Auth Proxy does not
+work with Chrome/Chromium.
\ No newline at end of file

diff --git a/docs/source/getting_started/deploying.rst b/docs/source/getting_started/deploying.rst
deleted file mode 100644
index c5acbdb..0000000
--- a/docs/source/getting_started/deploying.rst
+++ /dev/null
@@ -1,77 +0,0 @@
-.. _deploying:
-
-Deployment
-==========
-
-If you haven't already :ref:`configured <configuring>` |gwm|, now would
-be a good time to do so.
-
-Now that you have a |gwm| instance setup and configured, you will want
-to deploy it to somewhere that can be accessed by a web browser.
-
-
-.. _test-server:
-
-Test Server
------------
-
-If you are just trying |gwm| out, run from your
-:ref:`virtual environment <virtual-environment>`::
-
- $ gwm-manage.py runserver
-
-Then open a web browser, and navigate to ``http://localhost:8000``::
-
- firefox http://localhost:8000
-
-
-Apache + mod_wsgi
------------------
-
-Follow the django guide to `deploy with apache
-<https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/>`_. Here
-is an example ``mod_wsgi`` file::
-
- import os
- import sys
-
- path = '/var/lib/django/ganeti_webmgr'
-
- # activate virtualenv
- activate_this = '%s/venv/bin/activate_this.py' % path
- execfile(activate_this, dict(__file__=activate_this))
-
- # add project to path
- if path not in sys.path:
- sys.path.append(path)
-
- # configure django environment
- os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
-
- import django.core.handlers.wsgi
- application = django.core.handlers.wsgi.WSGIHandler()
-
-
-Virtualenv
-~~~~~~~~~~
-
-The virtual environment must be activated for use with ``mod_wsgi``. This
-is done by executing the ``activate_this`` script generated when a virtualenv
-is created. The following code should be in the ``django.wsgi`` file apache
-is configured to use with::
-
- # activate virtual environment
- activate_this = '%s/venv/bin/activate_this.py' % "PATH_TO_GANETI_WEBMGR"
- execfile(activate_this, dict(__file__=activate_this))
-
-
-Nginx
------
-
-
-Gunicorn
---------
-
-
-uWSGI
------

diff --git a/docs/source/getting_started/installing.rst b/docs/source/getting_started/installing.rst
index 0c560c7..29cb964 100644
--- a/docs/source/getting_started/installing.rst
+++ b/docs/source/getting_started/installing.rst
@@ -93,7 +93,7 @@ Next Steps
----------

Congratulations! |gwm| is now installed and initialized. Next, you'll want
-to look into :ref:`configuring` and :ref:`deploying`, if you are going
+to look into :ref:`configuring` and :ref:`deployment`, if you are going
to be setting up a production instance. Otherwise, if you just want to
play around with |gwm|, or are :ref:`developing <development>`, take a look at
-:ref:`test-server`.
+:ref:`development-server`.

diff --git a/docs/source/index.rst b/docs/source/index.rst
index 7436c84..cef6ec8 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -28,11 +28,9 @@ Getting Started
---------------
.. toctree::
:maxdepth: 1
-
getting_started/requirements
getting_started/installing
getting_started/configuring
- getting_started/deploying
getting_started/importing

User Guide
@@ -89,6 +87,11 @@ Project Information
project_info/license
project_info/faq
project_info/contributors
+ usage/upgrading
+ usage/clusters
+ usage/virtualmachines
+ usage/nodes
+ usage/templates


References

diff --git a/ganeti_webmgr/clusters/models.py b/ganeti_webmgr/clusters/models.py
index aa34d9d..6d0a02a 100644
--- a/ganeti_webmgr/clusters/models.py
+++ b/ganeti_webmgr/clusters/models.py
@@ -173,7 +173,7 @@ class CachedClusterObject(models.Model):
self.error = msg
else:
msg = str(e)
- self.error = str(e)
+ self.error = msg
GanetiError.store_error(msg, obj=self, code=e.code)

else:

diff --git a/ganeti_webmgr/clusters/views.py b/ganeti_webmgr/clusters/views.py
index 9802241..96a9365 100644
--- a/ganeti_webmgr/clusters/views.py
+++ b/ganeti_webmgr/clusters/views.py
@@ -18,6 +18,7 @@


from django.conf import settings
+from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
@@ -274,10 +275,14 @@ def refresh(request, cluster_slug):
"""

cluster = get_object_or_404(Cluster, slug=cluster_slug)
- cluster.refresh()
- cluster.sync_nodes(remove=True)
- cluster.sync_virtual_machines(remove=True)
-
+ try:
+ cluster.refresh()
+ cluster.sync_nodes(remove=True)
+ cluster.sync_virtual_machines(remove=True)
+ except GanetiApiError as e:
+ msg = str(e)
+ msg = "<p>%s</p>" % msg
+ messages.error(request, msg)
url = reverse('cluster-detail', args=[cluster.slug])
return redirect(url)


diff --git a/ganeti_webmgr/ganeti_web/settings/base.py b/ganeti_webmgr/ganeti_web/settings/base.py
index 98d28ae..88514a1 100644
--- a/ganeti_webmgr/ganeti_web/settings/base.py
+++ b/ganeti_webmgr/ganeti_web/settings/base.py
@@ -243,6 +243,7 @@ STATICFILES_FINDERS = (

STATICFILES_DIRS = (
app_root('static'),
+ ("novnc", root('noVNC', 'include')),
)

STATIC_ROOT = root("collected_static")

diff --git a/ganeti_webmgr/ganeti_web/settings/settings.py.dist b/ganeti_webmgr/ganeti_web/settings/settings.py.dist
index a673aa4..513633d 100644
--- a/ganeti_webmgr/ganeti_web/settings/settings.py.dist
+++ b/ganeti_webmgr/ganeti_web/settings/settings.py.dist
@@ -175,6 +175,3 @@ SECRET_KEY = load_secret(env='GWM_SECRET_KEY', file=SECRET_KEY_LOC)
# WEB_MGR_API_KEY = "random_string_of_numbers_and_letters"
WEB_MGR_API_KEY = load_secret(env='GWM_API_KEY', file=GWM_API_KEY_LOC)

-STATICFILES_DIRS += (
- root('noVNC', 'include'),
-)

diff --git a/ganeti_webmgr/ganeti_web/urls.py b/ganeti_webmgr/ganeti_web/urls.py
index 703ead9..551b0d3 100644
--- a/ganeti_webmgr/ganeti_web/urls.py
+++ b/ganeti_webmgr/ganeti_web/urls.py
@@ -153,6 +153,7 @@ urlpatterns += patterns(

url(r'^search/detail_lookup', 'detail_lookup', name='search-detail-lookup')
)
+
urlpatterns += patterns(
'ganeti_web.views.user_search',

@@ -173,23 +174,3 @@ urlpatterns += patterns(
(r'^', include('muddle.urls')),
)

-
-
-
-# XXX: since Django 1.3 you don't actually have to include static urls here.
-# Everything is being served by Django development server.
-
-# -----------------------------------------------------------------------------
-# The following is used to serve up local static files like images
-# root = '%s/static' % os.path.dirname(os.path.realpath(__file__))
-# urlpatterns += patterns(
-# '',
-# (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
-# {'document_root': settings.STATIC_ROOT, "show_indexes": True}),
-# (r'^favicon.ico', 'django.views.static.serve',
-# {'document_root': settings.STATIC_ROOT, 'path': 'favicon.ico'}),
-
-# noVNC files
-# (r'^novnc/(?P<path>.*)', 'django.views.static.serve',
-# {'document_root': '%s/noVNC/include' % settings.DOC_ROOT}),
-# )

diff --git a/ganeti_webmgr/ganeti_web/views/tables.py b/ganeti_webmgr/ganeti_web/views/tables.py
index e47cb4d..9832daa 100644
--- a/ganeti_webmgr/ganeti_web/views/tables.py
+++ b/ganeti_webmgr/ganeti_web/views/tables.py
@@ -60,7 +60,7 @@ class BaseVMTable(BaseTable):

def render_owner(self, value):
url = value.get_absolute_url()
- url_str = '<a href="{}">{}</a>'
+ url_str = '<a href="{0}">{1}</a>'
return mark_safe(url_str.format(url, value))



diff --git a/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.css b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.css
new file mode 100644
index 0000000..52e8552
--- /dev/null
+++ b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.css
@@ -0,0 +1,61 @@
+
+/* jquery.cytoscape-navigator.css */
+
+/**
+ * This file is part of cytoscape.js 2.0.4.
+ *
+ * Cytoscape.js is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * Cytoscape.js is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * cytoscape.js. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+.cytoscape-navigator{
+ position: absolute;
+ border: 1px solid #000;
+ background: #fff;
+ z-index: 99999;
+ width: 200px;
+ height: 150px;
+ bottom: -1px;
+ right: -1px;
+ overflow: hidden;
+}
+
+.cytoscape-navigator > canvas{
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ z-index: 101;
+}
+
+.cytoscape-navigatorView{
+ position: absolute;
+ top: 0;
+ left: 0;
+ cursor: move;
+ background: #B7E1ED;
+ -moz-opacity: 0.50;
+ opacity: 0.50;
+ -ms-filter:"progid:DXImageTransform.Microsoft.Alpha"(Opacity=50);
+ z-index: 102;
+}
+
+.cytoscape-navigatorOverlay{
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ z-index: 103;
+}

diff --git a/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.js b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.js
new file mode 100644
index 0000000..2842446
--- /dev/null
+++ b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.js
@@ -0,0 +1,628 @@
+
+/* jquery.cytoscape-navigator.js */
+
+/**
+ * This file is part of cytoscape.js 2.0.4.
+ *
+ * Cytoscape.js is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * Cytoscape.js is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * cytoscape.js. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ The navigator plugin was written by Alexandr Truhin (aka bumbu)
+
+ Modifications tracked on Github
+*/
+
+!(function($){
+
+ "use strict";
+
+ var Navigator = function ( element, options ) {
+ this._init(element, options)
+ }
+
+ Navigator.prototype = {
+
+ constructor: Navigator
+
+ /****************************
+ Main functions
+ ****************************/
+
+ , _init: function ( element, options ) {
+ var that = this
+
+ this.$element = $(element)
+ this.options = $.extend(true, {}, $.fn.cytoscapeNavigator.defaults, options)
+ this.cy = this.$element.cytoscape('get')
+
+ // Cache sizes
+ this.width = this.$element.width()
+ this.height = this.$element.height()
+
+ // Cache bounding box
+ this.boundingBox = this.cy.elements().boundingBox()
+
+ // Init components
+ this._initPanel()
+ this._initThumbnail()
+ this._initView()
+ this._initOverlay()
+
+ // Hook element resize
+ this.$element.on('resize', $.proxy(this.resize, this))
+ }
+
+ , destroy: function () {
+ this.$panel.remove()
+ this.$element.removeData('navigator')
+ }
+
+ /****************************
+ Navigator elements functions
+ ****************************/
+
+ /*
+ * Used inner attributes
+ *
+ * w {number} width
+ * h {number} height
+ */
+ , _initPanel: function () {
+ var options = this.options
+
+ if( options.container ) {
+ if( options.container instanceof jQuery ){
+ if( options.container.length > 0 ){
+ this.$panel = options.container.first()
+ } else {
+ $.error("Container for jquery.cyNavigator is empty")
+ return
+ }
+ } else if ( $(options.container).length > 0 ) {
+ this.$panel = $(options.container).first()
+ } else {
+ $.error("There is no any element matching your selector for jquery.cyNavigator")
+ return
+ }
+ } else {
+ this.$panel = $('<div class="cytoscape-navigator"/>')
+ this.$element.append(this.$panel)
+ }
+
+ this._setupPanel()
+ }
+
+ , _setupPanel: function () {
+ var options = this.options
+
+ // Cache sizes
+ this.$panel.w = this.$panel.width()
+ this.$panel.h = this.$panel.height()
+ }
+
+ /*
+ * Used inner attributes
+ *
+ * zoom {number}
+ * pan {object} - {x: 0, y: 0}
+ */
+ , _initThumbnail: function () {
+ // Create thumbnail
+ this.$thumbnail = $('<canvas/>')
+
+ // Add thumbnail canvas to the DOM
+ this.$panel.append(this.$thumbnail)
+
+ // Setup thumbnail
+ this._setupThumbnailSizes()
+ this._setupThumbnail()
+
+ // Repopulate thumbnail after graph render
+ this.cy.on('initrender', $.proxy(this._checkThumbnailSizesAndUpdate, this))
+
+ // Thumbnail updates
+ if (this.options.thumbnailLiveFramerate === false) {
+ this._hookGraphUpdates()
+ } else {
+ this._setGraphUpdatesTimer()
+ }
+ }
+
+ , _setupThumbnail: function () {
+ // Setup Canvas
+ this.$thumbnail.attr('width', this.$panel.w)
+ this.$thumbnail.attr('height', this.$panel.h)
+
+ this._updateThumbnailImage()
+ }
+
+ , _setupThumbnailSizes: function () {
+ // Update bounding box cache
+ this.boundingBox = this.cy.elements().boundingBox()
+
+ this.$thumbnail.zoom = Math.min(this.$panel.h / this.boundingBox.h, this.$panel.w / this.boundingBox.w)
+
+ // Used on thumbnail generation
+ this.$thumbnail.pan = {
+ x: (this.$panel.w - this.$thumbnail.zoom * (this.boundingBox.x1 + this.boundingBox.x2))/2
+ , y: (this.$panel.h - this.$thumbnail.zoom * (this.boundingBox.y1 + this.boundingBox.y2))/2
+ }
+ }
+
+ // If bounding box has changed then update sizes
+ // Otherwise just update the thumbnail
+ , _checkThumbnailSizesAndUpdate: function () {
+ // Cache previous values
+ var _zoom = this.$thumbnail.zoom
+ , _pan_x = this.$thumbnail.pan.x
+ , _pan_y = this.$thumbnail.pan.y
+
+ this._setupThumbnailSizes()
+
+ if (_zoom != this.$thumbnail.zoom || _pan_x != this.$thumbnail.pan.x || _pan_y != this.$thumbnail.pan.y) {
+ this._setupThumbnail()
+ this._setupView()
+ } else {
+ this._updateThumbnailImage()
+ }
+ }
+
+ /*
+ * Used inner attributes
+ *
+ * w {number} width
+ * h {number} height
+ * x {number}
+ * y {number}
+ * borderWidth {number}
+ * locked {boolean}
+ */
+ , _initView: function () {
+ var that = this
+
+ this.$view = $('<div class="cytoscape-navigatorView"/>')
+ this.$panel.append(this.$view)
+
+ // Compute borders
+ this.$view.borderTop = parseInt(this.$view.css('border-top-width'), 10)
+ this.$view.borderRight = parseInt(this.$view.css('border-right-width'), 10)
+ this.$view.borderBottom = parseInt(this.$view.css('border-bottom-width'), 10)
+ this.$view.borderLeft = parseInt(this.$view.css('border-left-width'), 10)
+
+ // Abstract borders
+ this.$view.borderHorizontal = this.$view.borderLeft + this.$view.borderRight
+ this.$view.borderVertical = this.$view.borderTop + this.$view.borderBottom
+
+ this._setupView()
+
+ // Hook graph zoom and pan
+ this.cy.on('zoom pan', $.proxy(this._setupView, this))
+ }
+
+ , _setupView: function () {
+ if (this.$view.locked)
+ return
+
+ var cyZoom = this.cy.zoom()
+ , cyPan = this.cy.pan()
+
+ // Horizontal computation
+ this.$view.w = this.width / cyZoom * this.$thumbnail.zoom
+ this.$view.x = -cyPan.x * this.$view.w / this.width + this.$thumbnail.pan.x - this.$view.borderLeft
+
+ // Vertical computation
+ this.$view.h = this.height / cyZoom * this.$thumbnail.zoom
+ this.$view.y = -cyPan.y * this.$view.h / this.height + this.$thumbnail.pan.y - this.$view.borderTop
+
+ // CSS view
+ this.$view
+ .width(this.$view.w)
+ .height(this.$view.h)
+ .css({
+ left: this.$view.x
+ , top: this.$view.y
+ })
+ }
+
+ /*
+ * Used inner attributes
+ *
+ * timeout {number} used to keep stable frame rate
+ * lastMoveStartTime {number}
+ * inMovement {boolean}
+ * hookPoint {object} {x: 0, y: 0}
+ */
+ , _initOverlay: function () {
+ // Used to capture mouse events
+ this.$overlay = $('<div class="cytoscape-navigatorOverlay"/>')
+
+ // Add overlay to the DOM
+ this.$panel.append(this.$overlay)
+
+ // Init some attributes
+ this.$overlay.hookPoint = {x: 0, y: 0}
+
+ // Listen for events
+ this._initEventsHandling()
+ }
+
+ /****************************
+ Event handling functions
+ ****************************/
+
+ , resize: function () {
+ // Cache sizes
+ this.width = this.$element.width()
+ this.height = this.$element.height()
+
+ this._setupPanel()
+ this._checkThumbnailSizesAndUpdate()
+ this._setupView()
+ }
+
+ , _initEventsHandling: function () {
+ var that = this
+ , eventsLocal = [
+ // Mouse events
+ 'mousedown'
+ , 'mousewheel'
+ , 'DOMMouseScroll' // Mozilla specific event
+ // Touch events
+ , 'touchstart'
+ ]
+ , eventsGlobal = [
+ 'mouseup'
+ , 'mouseout'
+ , 'mousemove'
+ // Touch events
+ , 'touchmove'
+ , 'touchend'
+ ]
+
+ // handle events and stop their propagation
+ this.$overlay.on(eventsLocal.join(' '), function (ev) {
+ // Touch events
+ if (ev.type == 'touchstart') {
+ // Will count as middle of View
+ ev.offsetX = that.$view.x + that.$view.w / 2
+ ev.offsetY = that.$view.y + that.$view.h / 2
+ }
+
+ // Normalize offset for browsers which do not provide that value
+ if (ev.offsetX === undefined || ev.offsetY === undefined) {
+ var targetOffset = $(ev.target).offset()
+ ev.offsetX = ev.pageX - targetOffset.left
+ ev.offsetY = ev.pageY - targetOffset.top
+ }
+
+ if (ev.type == 'mousedown' || ev.type == 'touchstart') {
+ that._eventMoveStart(ev)
+ } else if (ev.type == 'mousewheel' || ev.type == 'DOMMouseScroll') {
+ that._eventZoom(ev)
+ }
+
+ // Prevent default and propagation
+ // Don't use peventPropagation as it breaks mouse events
+ return false;
+ })
+
+ // Hook global events
+ $('body').on(eventsGlobal.join(' '), function (ev) {
+ // Do not make any computations if it is has no effect on Navigator
+ if (!that.$overlay.inMovement)
+ return;
+
+ // Touch events
+ if (ev.type == 'touchend') {
+ // Will count as middle of View
+ ev.offsetX = that.$view.x + that.$view.w / 2
+ ev.offsetY = that.$view.y + that.$view.h / 2
+ } else if (ev.type == 'touchmove') {
+ // Hack - we take in account only first touch
+ ev.pageX = ev.originalEvent.touches[0].pageX
+ ev.pageY = ev.originalEvent.touches[0].pageY
+ }
+
+ // Normalize offset for browsers which do not provide that value
+ if (ev.offsetX === undefined || ev.offsetY === undefined) {
+ var targetOffset = $(ev.target).offset()
+ ev.offsetX = ev.pageX - targetOffset.left
+ ev.offsetY = ev.pageY - targetOffset.top
+ }
+
+ // Translate global events into local coordinates
+ if (ev.target !== that.$overlay[0]) {
+ var targetOffset = $(ev.target).offset()
+ , overlayOffset = that.$overlay.offset()
+
+ ev.offsetX = ev.offsetX - overlayOffset.left + targetOffset.left
+ ev.offsetY = ev.offsetY - overlayOffset.top + targetOffset.top
+ }
+
+ if (ev.type == 'mousemove' || ev.type == 'touchmove') {
+ that._eventMove(ev)
+ } else if (ev.type == 'mouseup' || ev.type == 'touchend') {
+ that._eventMoveEnd(ev)
+ }
+
+ // Prevent default and propagation
+ // Don't use peventPropagation as it breaks mouse events
+ return false;
+ })
+ }
+
+ , _eventMoveStart: function (ev) {
+ var now = new Date().getTime()
+
+ // Check if it was double click
+ if (this.$overlay.lastMoveStartTime
+ && this.$overlay.lastMoveStartTime + this.options.dblClickDelay > now) {
+ // Reset lastMoveStartTime
+ this.$overlay.lastMoveStartTime = 0
+ // Enable View in order to move it to the center
+ this.$overlay.inMovement = true
+
+ // Set hook point as View center
+ this.$overlay.hookPoint.x = this.$view.w / 2
+ this.$overlay.hookPoint.y = this.$view.h / 2
+
+ // Move View to start point
+ if (this.options.viewLiveFramerate !== false) {
+ this._eventMove({
+ offsetX: this.$panel.w / 2
+ , offsetY: this.$panel.h / 2
+ })
+ } else {
+ this._eventMoveEnd({
+ offsetX: this.$panel.w / 2
+ , offsetY: this.$panel.h / 2
+ })
+ }
+
+ // View should be inactive as we don't want to move it right after double click
+ this.$overlay.inMovement = false
+ }
+ // This is a single click
+ // Take care as single click happens before double click 2 times
+ else {
+ this.$overlay.lastMoveStartTime = now
+ this.$overlay.inMovement = true
+ // Lock view moving caused by cy events
+ this.$view.locked = true
+
+ // if event started in View
+ if (ev.offsetX >= this.$view.x && ev.offsetX <= this.$view.x + this.$view.w
+ && ev.offsetY >= this.$view.y && ev.offsetY <= this.$view.y + this.$view.h
+ ) {
+ this.$overlay.hookPoint.x = ev.offsetX - this.$view.x
+ this.$overlay.hookPoint.y = ev.offsetY - this.$view.y
+ }
+ // if event started in Thumbnail (outside of View)
+ else {
+ // Set hook point as View center
+ this.$overlay.hookPoint.x = this.$view.w / 2
+ this.$overlay.hookPoint.y = this.$view.h / 2
+
+ // Move View to start point
+ this._eventMove(ev)
+ }
+ }
+ }
+
+ , _eventMove: function (ev) {
+ var that = this
+
+ this._checkMousePosition(ev)
+
+ // break if it is useless event
+ if (!this.$overlay.inMovement) {
+ return;
+ }
+
+ // Update cache
+ this.$view.x = ev.offsetX - this.$overlay.hookPoint.x
+ this.$view.y = ev.offsetY - this.$overlay.hookPoint.y
+
+ // Update view position
+ this.$view.css('left', this.$view.x)
+ this.$view.css('top', this.$view.y)
+
+ // Move Cy
+ if (this.options.viewLiveFramerate !== false) {
+ // trigger instantly
+ if (this.options.viewLiveFramerate == 0) {
+ this._moveCy()
+ }
+ // trigger less often than frame rate
+ else if (!this.$overlay.timeout) {
+ // Set a timeout for graph movement
+ this.$overlay.timeout = setTimeout(function () {
+ that._moveCy()
+ that.$overlay.timeout = false
+ }, 1000/this.options.viewLiveFramerate)
+ }
+ }
+ }
+
+ , _checkMousePosition: function (ev) {
+ // If mouse in over View
+ if(ev.offsetX > this.$view.x && ev.offsetX < this.$view.x + this.$view.borderHorizontal + this.$view.w
+ && ev.offsetY > this.$view.y && ev.offsetY < this.$view.y + this.$view.borderVertical + this.$view.h) {
+ this.$panel.addClass('mouseover-view')
+ } else {
+ this.$panel.removeClass('mouseover-view')
+ }
+ }
+
+ , _eventMoveEnd: function (ev) {
+ // Unlock view changing caused by graph events
+ this.$view.locked = false
+
+ // Remove class when mouse is not over Navigator
+ this.$panel.removeClass('mouseover-view')
+
+ if (!this.$overlay.inMovement) {
+ return;
+ }
+
+ // Trigger one last move
+ this._eventMove(ev)
+
+ // If mode is not live then move graph on drag end
+ if (this.options.viewLiveFramerate === false) {
+ this._moveCy()
+ }
+
+ // Stop movement permission
+ this.$overlay.inMovement = false
+ }
+
+ , _eventZoom: function (ev) {
+ var zoomRate = Math.pow(10, ev.originalEvent.wheelDeltaY / 1000 || ev.originalEvent.wheelDelta / 1000 || ev.originalEvent.detail / -32)
+ , mousePosition = {
+ left: ev.offsetX
+ , top: ev.offsetY
+ }
+
+ if (this.cy.zoomingEnabled()) {
+ this._zoomCy(zoomRate, mousePosition)
+ }
+ }
+
+ , _hookGraphUpdates: function () {
+ this.cy.on('position add remove data', $.proxy(this._checkThumbnailSizesAndUpdate, this, false))
+ }
+
+ , _setGraphUpdatesTimer: function () {
+ var delay = 1000.0 / this.options.thumbnailLiveFramerate
+ , that = this
+ , updateFunction = function () {
+ // Use timeout instead of interval as it is not accumulating events if events pool is not processed fast enough
+ setTimeout(function (){
+ that._checkThumbnailSizesAndUpdate(true)
+ updateFunction()
+ }, delay)
+ }
+
+ // Init infinite loop
+ updateFunction()
+ }
+
+ , _updateThumbnailImage: function (force_refresh) {
+ var that = this
+ , timeout = 0 // will remain 0 if force_refresh is true
+
+ // Set thumbnail update frame rate
+ if (!force_refresh && this.options.thumbnailEventFramerate > 0) {
+ timeout = ~~(1000 / this.options.thumbnailEventFramerate)
+ }
+
+ if (this._thumbnailUpdateTimeout === undefined || this._thumbnailUpdateTimeout === null) {
+ this._thumbnailUpdateTimeout = setTimeout(function(){
+ // Copy scaled thumbnail to buffer
+ that.cy.renderTo(that.$thumbnail[0].getContext('2d'), that.$thumbnail.zoom, that.$thumbnail.pan)
+
+ // Reset flag
+ that._thumbnailUpdateTimeout = null
+ }, timeout)
+ }
+ }
+
+ /****************************
+ Navigator view moving
+ ****************************/
+
+ , _moveCy: function () {
+ this.cy.pan({
+ x: -(this.$view.x + this.$view.borderLeft - this.$thumbnail.pan.x) * this.width / this.$view.w
+ , y: -(this.$view.y + this.$view.borderLeft - this.$thumbnail.pan.y) * this.height / this.$view.h
+ })
+ }
+
+ /**
+ * Zooms graph.
+ *
+ * @this {cytoscapeNavigator}
+ * @param {number} zoomRate The zoom rate value. 1 is 100%.
+ */
+ , _zoomCy: function (zoomRate, zoomCenterRaw) {
+ var zoomCenter
+ , isZoomCenterInView = false
+
+ if (zoomCenterRaw) {
+ isZoomCenterInView = (zoomCenterRaw.left > this.$view.x) && (zoomCenterRaw.left < this.$view.x + this.$view.w + this.$view.borderHorizontal)
+ && (zoomCenterRaw.top > this.$view.y) && (zoomCenterRaw.top < this.$view.y + this.$view.h + this.$view.borderVertical)
+ }
+
+ if (zoomCenterRaw && isZoomCenterInView) {
+ // Zoom about mouse position
+ zoomCenter = {
+ x: (zoomCenterRaw.left - this.$view.x - this.$view.borderLeft) * this.width / this.$view.w
+ , y: (zoomCenterRaw.top - this.$view.y - this.$view.borderTop) * this.height / this.$view.h
+ }
+ } else {
+ // Zoom abount View center
+ zoomCenter = {
+ x: this.width / 2
+ , y: this.height / 2
+ }
+ }
+
+ this.cy.zoom({
+ level: this.cy.zoom() * zoomRate
+ , position: zoomCenter
+ })
+ }
+ }
+
+ $.fn.cytoscapeNavigator = function ( option ) {
+ var _arguments = arguments
+
+ return this.each(function () {
+ var $this = $(this)
+ , data = $this.data('navigator')
+ , options = typeof option == 'object' && option
+
+ if (!data) {
+ $this.data('navigator', (data = new Navigator(this, options)))
+ }
+
+ if (typeof option == 'string') {
+ if (data[option] === undefined) {
+ $.error("cyNavigator has no such method")
+ } else if (typeof data[option] !== typeof function(){}) {
+ $.error("cyNavigator."+option+" is not a function")
+ } else if (option.charAt(0) == '_') {
+ $.error("cyNavigator."+option+" is a private function")
+ } else {
+ data[option].call(data, Array.prototype.slice.call(_arguments, 1))
+ }
+ }
+ })
+ }
+
+ $.fn.cytoscapeNavigator.Constructor = Navigator
+
+ $.fn.cytoscapeNavigator.defaults = {
+ container: false // can be a HTML or jQuery element or jQuery selector
+ , viewLiveFramerate: 0 // set false to update graph pan only on drag end; set 0 to do it instantly; set a number (frames per second) to update not more than N times per second
+ , thumbnailEventFramerate: 10 // max thumbnail's updates per second triggered by graph updates
+ , thumbnailLiveFramerate: false // max thumbnail's updates per second. Set false to disable
+ , dblClickDelay: 200 // milliseconds
+ }
+
+ $.fn.cyNavigator = $.fn.cytoscapeNavigator
+
+})(jQuery)

diff --git a/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.min.js b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.min.js
new file mode 100644
index 0000000..a1ceb65
--- /dev/null
+++ b/ganeti_webmgr/ganetiviz/static/js/cytoscape-lib/jquery.cytoscape-navigator.min.js
@@ -0,0 +1,38 @@
+
+/* jquery.cytoscape-navigator.min.js */
+
+/**
+ * This file is part of cytoscape.js 2.0.4.
+ *
+ * Cytoscape.js is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation, either version 3 of the License, or (at your option) any
+ * later version.
+ *
+ * Cytoscape.js is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along with
+ * cytoscape.js. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+!(function(b){var a=function(d,c){this._init(d,c)};a.prototype={constructor:a,_init:function(d,c){var e=this;this.$element=b(d);this.options=b.extend(true,{},b.fn.cytoscapeNavigator.defaults,c);this.cy=this.$element.cytoscape("get");this.width=this.$element.width();this.height=this.$element.height();this.boundingBox=this.cy.elements().boundingBox();this._initPanel();this._initThumbnail();this._initView();this._initOverlay();this.$element.on("resize",b.proxy(this.resize,this))},destroy:function(){this.$panel.remove();
+this.$element.removeData("navigator")},_initPanel:function(){var c=this.options;if(c.container){if(c.container instanceof jQuery){if(c.container.length>0){this.$panel=c.container.first()}else{b.error("Container for jquery.cyNavigator is empty");return}}else{if(b(c.container).length>0){this.$panel=b(c.container).first()}else{b.error("There is no any element matching your selector for jquery.cyNavigator");return}}}else{this.$panel=b('<div class="cytoscape-navigator"/>');this.$element.append(this.$panel)
+}this._setupPanel()},_setupPanel:function(){var c=this.options;this.$panel.w=this.$panel.width();this.$panel.h=this.$panel.height()},_initThumbnail:function(){this.$thumbnail=b("<canvas/>");this.$panel.append(this.$thumbnail);this._setupThumbnailSizes();this._setupThumbnail();this.cy.on("initrender",b.proxy(this._checkThumbnailSizesAndUpdate,this));if(this.options.thumbnailLiveFramerate===false){this._hookGraphUpdates()}else{this._setGraphUpdatesTimer()}},_setupThumbnail:function(){this.$thumbnail.attr("width",this.$panel.w);
+this.$thumbnail.attr("height",this.$panel.h);this._updateThumbnailImage()},_setupThumbnailSizes:function(){this.boundingBox=this.cy.elements().boundingBox();this.$thumbnail.zoom=Math.min(this.$panel.h/this.boundingBox.h,this.$panel.w/this.boundingBox.w);this.$thumbnail.pan={x:(this.$panel.w-this.$thumbnail.zoom*(this.boundingBox.x1+this.boundingBox.x2))/2,y:(this.$panel.h-this.$thumbnail.zoom*(this.boundingBox.y1+this.boundingBox.y2))/2}},_checkThumbnailSizesAndUpdate:function(){var d=this.$thumbnail.zoom,e=this.$thumbnail.pan.x,c=this.$thumbnail.pan.y;
+this._setupThumbnailSizes();if(d!=this.$thumbnail.zoom||e!=this.$thumbnail.pan.x||c!=this.$thumbnail.pan.y){this._setupThumbnail();this._setupView()}else{this._updateThumbnailImage()}},_initView:function(){var c=this;this.$view=b('<div class="cytoscape-navigatorView"/>');this.$panel.append(this.$view);this.$view.borderTop=parseInt(this.$view.css("border-top-width"),10);this.$view.borderRight=parseInt(this.$view.css("border-right-width"),10);this.$view.borderBottom=parseInt(this.$view.css("border-bottom-width"),10);
+this.$view.borderLeft=parseInt(this.$view.css("border-left-width"),10);this.$view.borderHorizontal=this.$view.borderLeft+this.$view.borderRight;this.$view.borderVertical=this.$view.borderTop+this.$view.borderBottom;this._setupView();this.cy.on("zoom pan",b.proxy(this._setupView,this))},_setupView:function(){if(this.$view.locked){return}var d=this.cy.zoom(),c=this.cy.pan();this.$view.w=this.width/d*this.$thumbnail.zoom;this.$view.x=-c.x*this.$view.w/this.width+this.$thumbnail.pan.x-this.$view.borderLeft;
+this.$view.h=this.height/d*this.$thumbnail.zoom;this.$view.y=-c.y*this.$view.h/this.height+this.$thumbnail.pan.y-this.$view.borderTop;this.$view.width(this.$view.w).height(this.$view.h).css({left:this.$view.x,top:this.$view.y})},_initOverlay:function(){this.$overlay=b('<div class="cytoscape-navigatorOverlay"/>');this.$panel.append(this.$overlay);this.$overlay.hookPoint={x:0,y:0};this._initEventsHandling()},resize:function(){this.width=this.$element.width();this.height=this.$element.height();this._setupPanel();
+this._checkThumbnailSizesAndUpdate();this._setupView()},_initEventsHandling:function(){var d=this,e=["mousedown","mousewheel","DOMMouseScroll","touchstart"],c=["mouseup","mouseout","mousemove","touchmove","touchend"];this.$overlay.on(e.join(" "),function(f){if(f.type=="touchstart"){f.offsetX=d.$view.x+d.$view.w/2;f.offsetY=d.$view.y+d.$view.h/2}if(f.offsetX===undefined||f.offsetY===undefined){var g=b(f.target).offset();f.offsetX=f.pageX-g.left;f.offsetY=f.pageY-g.top}if(f.type=="mousedown"||f.type=="touchstart"){d._eventMoveStart(f)
+}else{if(f.type=="mousewheel"||f.type=="DOMMouseScroll"){d._eventZoom(f)}}return false});b("body").on(c.join(" "),function(f){if(!d.$overlay.inMovement){return}if(f.type=="touchend"){f.offsetX=d.$view.x+d.$view.w/2;f.offsetY=d.$view.y+d.$view.h/2}else{if(f.type=="touchmove"){f.pageX=f.originalEvent.touches[0].pageX;f.pageY=f.originalEvent.touches[0].pageY}}if(f.offsetX===undefined||f.offsetY===undefined){var h=b(f.target).offset();f.offsetX=f.pageX-h.left;f.offsetY=f.pageY-h.top}if(f.target!==d.$overlay[0]){var h=b(f.target).offset(),g=d.$overlay.offset();
+f.offsetX=f.offsetX-g.left+h.left;f.offsetY=f.offsetY-g.top+h.top}if(f.type=="mousemove"||f.type=="touchmove"){d._eventMove(f)}else{if(f.type=="mouseup"||f.type=="touchend"){d._eventMoveEnd(f)}}return false})},_eventMoveStart:function(d){var c=new Date().getTime();if(this.$overlay.lastMoveStartTime&&this.$overlay.lastMoveStartTime+this.options.dblClickDelay>c){this.$overlay.lastMoveStartTime=0;this.$overlay.inMovement=true;this.$overlay.hookPoint.x=this.$view.w/2;this.$overlay.hookPoint.y=this.$view.h/2;
+if(this.options.viewLiveFramerate!==false){this._eventMove({offsetX:this.$panel.w/2,offsetY:this.$panel.h/2})}else{this._eventMoveEnd({offsetX:this.$panel.w/2,offsetY:this.$panel.h/2})}this.$overlay.inMovement=false}else{this.$overlay.lastMoveStartTime=c;this.$overlay.inMovement=true;this.$view.locked=true;if(d.offsetX>=this.$view.x&&d.offsetX<=this.$view.x+this.$view.w&&d.offsetY>=this.$view.y&&d.offsetY<=this.$view.y+this.$view.h){this.$overlay.hookPoint.x=d.offsetX-this.$view.x;this.$overlay.hookPoint.y=d.offsetY-this.$view.y
+}else{this.$overlay.hookPoint.x=this.$view.w/2;this.$overlay.hookPoint.y=this.$view.h/2;this._eventMove(d)}}},_eventMove:function(d){var c=this;this._checkMousePosition(d);if(!this.$overlay.inMovement){return}this.$view.x=d.offsetX-this.$overlay.hookPoint.x;this.$view.y=d.offsetY-this.$overlay.hookPoint.y;this.$view.css("left",this.$view.x);this.$view.css("top",this.$view.y);if(this.options.viewLiveFramerate!==false){if(this.options.viewLiveFramerate==0){this._moveCy()}else{if(!this.$overlay.timeout){this.$overlay.timeout=setTimeout(function(){c._moveCy();
+c.$overlay.timeout=false},1000/this.options.viewLiveFramerate)}}}},_checkMousePosition:function(c){if(c.offsetX>this.$view.x&&c.offsetX<this.$view.x+this.$view.borderHorizontal+this.$view.w&&c.offsetY>this.$view.y&&c.offsetY<this.$view.y+this.$view.borderVertical+this.$view.h){this.$panel.addClass("mouseover-view")}else{this.$panel.removeClass("mouseover-view")}},_eventMoveEnd:function(c){this.$view.locked=false;this.$panel.removeClass("mouseover-view");if(!this.$overlay.inMovement){return}this._eventMove(c);
+if(this.options.viewLiveFramerate===false){this._moveCy()}this.$overlay.inMovement=false},_eventZoom:function(d){var c=Math.pow(10,d.originalEvent.wheelDeltaY/1000||d.originalEvent.wheelDelta/1000||d.originalEvent.detail/-32),e={left:d.offsetX,top:d.offsetY};if(this.cy.zoomingEnabled()){this._zoomCy(c,e)}},_hookGraphUpdates:function(){this.cy.on("position add remove data",b.proxy(this._checkThumbnailSizesAndUpdate,this,false))},_setGraphUpdatesTimer:function(){var c=1000/this.options.thumbnailLiveFramerate,d=this,e=function(){setTimeout(function(){d._checkThumbnailSizesAndUpdate(true);
+e()},c)};e()},_updateThumbnailImage:function(e){var c=this,d=0;if(!e&&this.options.thumbnailEventFramerate>0){d=~~(1000/this.options.thumbnailEventFramerate)}if(this._thumbnailUpdateTimeout===undefined||this._thumbnailUpdateTimeout===null){this._thumbnailUpdateTimeout=setTimeout(function(){c.cy.renderTo(c.$thumbnail[0].getContext("2d"),c.$thumbnail.zoom,c.$thumbnail.pan);c._thumbnailUpdateTimeout=null},d)}},_moveCy:function(){this.cy.pan({x:-(this.$view.x+this.$view.borderLeft-this.$thumbnail.pan.x)*this.width/this.$view.w,y:-(this.$view.y+this.$view.borderLeft-this.$thumbnail.pan.y)*this.height/this.$view.h})
+},_zoomCy:function(d,c){var e,f=false;if(c){f=(c.left>this.$view.x)&&(c.left<this.$view.x+this.$view.w+this.$view.borderHorizontal)&&(c.top>this.$view.y)&&(c.top<this.$view.y+this.$view.h+this.$view.borderVertical)}if(c&&f){e={x:(c.left-this.$view.x-this.$view.borderLeft)*this.width/this.$view.w,y:(c.top-this.$view.y-this.$view.borderTop)*this.height/this.$view.h}}else{e={x:this.width/2,y:this.height/2}}this.cy.zoom({level:this.cy.zoom()*d,position:e})}};b.fn.cytoscapeNavigator=function(c){var d=arguments;
+return this.each(function(){var g=b(this),f=g.data("navigator"),e=typeof c=="object"&&c;if(!f){g.data("navigator",(f=new a(this,e)))}if(typeof c=="string"){if(f[c]===undefined){b.error("cyNavigator has no such method")}else{if(typeof f[c]!==typeof function(){}){b.error("cyNavigator."+c+" is not a function")}else{if(c.charAt(0)=="_"){b.error("cyNavigator."+c+" is a private function")}else{f[c].call(f,Array.prototype.slice.call(d,1))}}}}})};b.fn.cytoscapeNavigator.Constructor=a;b.fn.cytoscapeNavigator.defaults={container:false,viewLiveFramerate:0,thumbnailEventFramerate:10,thumbnailLiveFramerate:false,dblClickDelay:200};
+b.fn.cyNavigator=b.fn.cytoscapeNavigator})(jQuery);
\ No newline at end of file

diff --git a/ganeti_webmgr/static/css/help_tips.css b/ganeti_webmgr/static/css/help_tips.css
index 13b6a13..aa498bd 100644
--- a/ganeti_webmgr/static/css/help_tips.css
+++ b/ganeti_webmgr/static/css/help_tips.css
@@ -1,8 +1,7 @@
-.help_tip {
+div[id^="help-"] {
background-color:#eee;
border:1px solid #888;
border-radius:5px;
- display:none;
float:left;
margin:20px 0 0 0;
width:390px;
@@ -11,7 +10,7 @@
-webkit-border-radius:5px;
}

-.help_tip h3 {
+div[id^="help-"] h3 {
background-color:#c2e192;
border-bottom:1px solid #888;
color:#444;
@@ -27,4 +26,3 @@
#help div p {margin: 0 0 10px 0;}
#help div ul {margin:10px 0 10px 30px;}
#help div li {list-style:disc; }
-#help-contents {display:none}

diff --git a/ganeti_webmgr/static/css/vm_wizard/base.css b/ganeti_webmgr/static/css/vm_wizard/base.css
index a6d45bf..b3a30ba 100644
--- a/ganeti_webmgr/static/css/vm_wizard/base.css
+++ b/ganeti_webmgr/static/css/vm_wizard/base.css
@@ -7,3 +7,15 @@
.multi {
display: inline-block;
}
+
+button.edit_step {
+ background:none!important;
+ border:none;
+ padding:0!important;
+ cursor: pointer;
+ font-weight: bold;
+}
+
+button.edit_step:hover{
+ text-decoration:underline;
+}

diff --git a/ganeti_webmgr/static/css/vm_wizard/summary.css b/ganeti_webmgr/static/css/vm_wizard/summary.css
new file mode 100644
index 0000000..98b50ec
--- /dev/null
+++ b/ganeti_webmgr/static/css/vm_wizard/summary.css
@@ -0,0 +1,15 @@
+#summary table {
+ width: 63%;
+ height: 70%;
+ margin: 0 auto;
+}
+
+#step_controls {
+ display: table;
+ margin: 0 auto;
+}
+
+#summary td {
+ text-align: left;
+ text-indent: 26px;
+}

diff --git a/ganeti_webmgr/static/js/helpTips.js b/ganeti_webmgr/static/js/helpTips.js
index e394a75..38652a3 100644
--- a/ganeti_webmgr/static/js/helpTips.js
+++ b/ganeti_webmgr/static/js/helpTips.js
@@ -1,3 +1,31 @@
+function helpTips(selector) {
+ // Inputs which have a help tip.
+ var $form_fields = $('input, select', selector);
+ var $tips = $('div[id^="help-"]');
+ // Hide help tips with javascript by default.
+ // With no js, the tips will still be there.
+ $tips.hide()
+ /* Binds the event to our inputs,
+ passing the focused element to the handler. */
+ $form_fields.live('focus', this, getHelpTips);
+
+ function getHelpTips(event) {
+ // The name of the input corresponds to the help tip's data-help attribute.
+ var help_name = this.name;
+ var $tip = $('#help-'+help_name);
+ // Fix for old helptip labels
+ if ($tip.children('h3').length == 0) {
+ var id = $(this).attr('id');
+ var label = $("label[for='" + id + "']").html();
+ $tip.prepend($("<h3>").html(label));
+ }
+ // Hide all tips.
+ $tips.hide()
+ // Show the tip.
+ $tip.show();
+ }
+}
+
function initHelpTips(selector){
/* initialize the help tips for each item on the create VM template */

@@ -6,7 +34,7 @@ function initHelpTips(selector){
.end()
.find('input[type="checkbox"]')
.live('click', helpTip);
-
+
function helpTip(){
var name = this.name;
var label = $(this).prev('label').html();
@@ -20,7 +48,7 @@ function initHelpTips(selector){
/* Strip all digits and underscores from end of name.
Makes things work with unknown number of disks/nics. */
var content = $('#help-'+name.replace(/[0-9_]*$/,''));
-
+
if(content.length != 0){
$('#help')
.show();

diff --git a/ganeti_webmgr/static/js/noVNC.js b/ganeti_webmgr/static/js/noVNC.js
index dce43ec..5274126 100644
--- a/ganeti_webmgr/static/js/noVNC.js
+++ b/ganeti_webmgr/static/js/noVNC.js
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2010 Oregon State University et al.
- *
+ *
* Javascript for custom noVNC interface.
*/


diff --git a/ganeti_webmgr/templates/base.html b/ganeti_webmgr/templates/base.html
index 15df152..d15a589 100644
--- a/ganeti_webmgr/templates/base.html
+++ b/ganeti_webmgr/templates/base.html
@@ -46,6 +46,15 @@
<div id="content_column">
{% block navigation %}{% endblock %}
<div id="content">
+ {% block messages %}
+ <ul id="messages">
+ {% if messages %}
+ {% for message in messages %}
+ <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{% trans "Error" %}: {{ message|safe }}</li>
+ {% endfor %}
+ {% endif %}
+ </ul>
+ {% endblock %}
{% block content %}{% endblock %}
</div>
<div class="floatfix"></div>

diff --git a/ganeti_webmgr/templates/ganeti/cluster/detail.html b/ganeti_webmgr/templates/ganeti/cluster/detail.html
index bbd5e6b..b449a72 100644
--- a/ganeti_webmgr/templates/ganeti/cluster/detail.html
+++ b/ganeti_webmgr/templates/ganeti/cluster/detail.html
@@ -120,12 +120,8 @@
{% if not cluster.username %}
{% trans " - READ ONLY" %}
{% endif %}
-
</h1>

-<ul id="messages">
- {%if cluster.error%}<li class="error">{% trans "Error in Ganeti API" %}:<p>{{cluster.error}}</p></li>{%endif%}
-</ul>
<div id="tabs">
<ul>
<li><a href="#overview"><span>{% trans "Overview" %}</span></a></li>

diff --git a/ganeti_webmgr/templates/ganeti/cluster/edit.html b/ganeti_webmgr/templates/ganeti/cluster/edit.html
index d83cd0a..5949737 100644
--- a/ganeti_webmgr/templates/ganeti/cluster/edit.html
+++ b/ganeti_webmgr/templates/ganeti/cluster/edit.html
@@ -22,7 +22,7 @@
$(document).ready(function() {
/* run when document is fully loaded */
// init the help tips for the individ. form objects
- initHelpTips('#clusterform');
+ helpTips("#clusterform");
});

</script>
@@ -74,11 +74,7 @@
</form>
</div>

-<div id="help" class="help_tip">
- <h3></h3>
- <div></div>
-</div>
-<div id="help-contents">
+<div id="help">
{% include "ganeti/helptips/cluster_edit.html" %}
</div>


diff --git a/ganeti_webmgr/templates/ganeti/forms/create_choice.html b/ganeti_webmgr/templates/ganeti/forms/create_choice.html
index b58f817..3289c78 100644
--- a/ganeti_webmgr/templates/ganeti/forms/create_choice.html
+++ b/ganeti_webmgr/templates/ganeti/forms/create_choice.html
@@ -1,14 +1,16 @@
{% load i18n %}
{% spaceless %}
-{% with vm|default:"Virtual Machine" as vm %}
- {% if choices|length == 2 %}
- {% blocktrans %}{{vm}} and Template {% endblocktrans %}
- {% elif 'hostname' in choices %}
- {% trans vm %}
- {% elif 'template_name' in choices %}
- {% trans "Template" %}
+{% with vm=vm|default:"Virtual Machine" owner=summary.owner_form %}
+ {% if wizard.steps.step0 < 2%}
+ {% blocktrans %}Template and/or {{vm}} {% endblocktrans %}
{% else %}
- {% blocktrans %}Template and/or {{vm}} {% endblocktrans %}
+ {% if owner.template_name and owner.hostname %}
+ {% blocktrans %}{{vm}} and Template {% endblocktrans %}
+ {% elif owner.hostname %}
+ {% trans vm %}
+ {% elif owner.template_name %}
+ {% trans "Template" %}
+ {% endif %}
{% endif %}
{% endwith %}
{% endspaceless %}

diff --git a/ganeti_webmgr/templates/ganeti/forms/helptips.html b/ganeti_webmgr/templates/ganeti/forms/helptips.html
new file mode 100644
index 0000000..cf56b38
--- /dev/null
+++ b/ganeti_webmgr/templates/ganeti/forms/helptips.html
@@ -0,0 +1,14 @@
+{% load i18n %}
+
+{% block helptips %}
+ <div id="help">
+ {% for field in form %}
+ {% if field.help_text %}
+ <div id='help-{{ field.html_name }}'>
+ <h3>{{ field.label }}</h3>
+ <div>{{ field.help_text|safe }}</div>
+ </div>
+ {% endif %}
+ {% endfor %}
+ </div>
+{% endblock helptips %}

diff --git a/ganeti_webmgr/templates/ganeti/forms/step_controls.html b/ganeti_webmgr/templates/ganeti/forms/step_controls.html
new file mode 100644
index 0000000..811543b
--- /dev/null
+++ b/ganeti_webmgr/templates/ganeti/forms/step_controls.html
@@ -0,0 +1,20 @@
+{% load i18n %}
+{% load include_strip %}
+
+{% if wizard.steps.prev %}
+ <button class="select" name="wizard_goto_step" type="submit"
+ value="{{ wizard.steps.first }}">
+ {% trans "Start Over" %}
+ </button>
+ <button class="select" name="wizard_goto_step" type="submit"
+ value="{{ wizard.steps.prev }}">
+ {% trans "Previous" %}
+ </button>
+{% endif %}
+{% if wizard.steps.next %}
+ <input class="select" type="submit"
+ value="{% trans "Next"%} "/>
+{% else %}
+ <input class="select" type="submit"
+ value="{% trans "Create" %} {% include_strip "ganeti/forms/create_choice.html" with vm="VM" %}" />
+{% endif %}

diff --git a/ganeti_webmgr/templates/ganeti/forms/summary.html b/ganeti_webmgr/templates/ganeti/forms/summary.html
new file mode 100644
index 0000000..965533f
--- /dev/null
+++ b/ganeti_webmgr/templates/ganeti/forms/summary.html
@@ -0,0 +1,222 @@
+{% extends "ganeti/forms/vm_wizard_base.html" %}
+{% load i18n %}
+{% load webmgr_tags %}
+
+
+{% block header %}
+Summary
+{% endblock header %}
+
+
+{% block form_content %}
+
+<div id="summary">
+
+<table>
+ {% with owner=summary.owner_form advanced=summary.advanced_form basics=summary.basics_form hv=summary.hv_form %}
+
+ <tbody>
+
+ <!-- Step 1 -->
+
+ <tr><th colspan="2">
+ <button class="edit_step" name="wizard_goto_step" type="submit" value="0">{% trans "Step 1 (Edit)" %}</button>
+ </th></tr>
+
+ <tr>
+ <td>{% trans "Cluster" %}:</td>
+ <td>{{ summary.cluster_form.cluster }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Template or VM:" %}</td>
+ {% if owner.hostname and owner.template_name %}
+ <td>{% trans "Both" %}</td>
+ {% elif owner.hostname %}
+ <td>{% trans "Virtual Machine" %}</td>
+ {% else %}
+ <td>{% trans "Template" %}</td>
+ {% endif %}
+ </tr>
+ <tr><td><!-- spacer row for readability --></td></tr>
+
+ <!-- Step 2 -->
+
+ <tr><th colspan="2">
+ <button class="edit_step" name="wizard_goto_step" type="submit" value="1">{% trans "Step 2 (Edit)" %}</button>
+ </th></tr>
+
+ <tr>
+ <td>{% trans "Owner" %}:</td>
+ <td>{{ summary.owner_form.owner }}</td>
+ </tr>
+
+ {% if owner.template_name %}
+ <tr>
+ <td>{% trans "Template Name" %}</td>
+ <td>{{ owner.template_name }}</td>
+ </tr>
+ {% endif %}
+ {% if owner.hostname %}
+ <tr>
+ <td>{% trans "Host Name" %}</td>
+ <td>{{ owner.hostname }}</td>
+ </tr>
+ {% endif %}
+ <tr><td><!-- spacer row for readability --></td></tr>
+
+ <!-- Step 3 -->
+
+ <tr><th colspan="2">
+ <button class="edit_step" name="wizard_goto_step" type="submit" value="2">{% trans "Step 3 (Edit)" %}</button>
+ </th></tr>
+
+ <tr>
+ <td>{% trans "Hypervisor" %}</td>
+ <td>{{ basics.hv }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Operating System" %}</td>
+ <td>{% if not basics.no_install %}
+ {{ basics.os }}
+ {% else %}
+ Don't install
+
+ {% endif %} </td></tr>
+ <tr>
+ <td>Automatic Allocation</td>
+ <td>
+ {% if basics.iallocator %}
+ <img src="/static/images/icons/check.png" />
+ {% else %}
+ <img src="/static/images/icons/cross.png" />
+ {% endif %}
+ </td>
+ </tr>
+ <tr>
+ <td>{% trans "Virtual CPU Count" %}</td>
+ <td>{{ basics.vcpus }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Memory (RAM)" %}</td>
+ <td>{{ basics.memory|render_storage }}</td>
+ </tr>
+ <!-- Disks -->
+ <tr>
+ <td>{% trans "Disk Template" %}</td>
+ <td>{{ basics.disk_template }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Disk Type" %}</td>
+ <td>{{ hv.disk_type }}</td>
+ </tr>
+ {% for disk in basics.disks %}
+ <tr>
+ <td>{% trans "Disk" %}/{{ forloop.counter0 }}</td>
+ <td>{{ disk.size|render_storage }}</td>
+ </tr>
+ {% endfor %}
+
+ <tr><td><!-- spacer row for readability --></td></tr>
+
+ <!-- Step 4 -->
+
+ <tr><th colspan="2">
+ <button class="edit_step" name="wizard_goto_step" type="submit" value="3">{% trans "Step 4 (Edit)" %}</button>
+ </th></tr>
+
+ <tr>
+ <td>{% trans "Check IP" %}?</td>
+ <td>
+ {% if advanced.ip_check %}
+ <img src="/static/images/icons/check.png" />
+ {% else %}
+ <img src="/static/images/icons/cross.png" />
+ {% endif %}
+ </td>
+ </tr>
+ <tr>
+ <td>{% trans "Check Hostname" %}?</td>
+ <td>
+ {% if advanced.name_check %}
+ <img src="/static/images/icons/check.png" />
+ {% else %}
+ <img src="/static/images/icons/cross.png" />
+ {% endif %}
+ </td>
+ </tr>
+ <tr>
+ <td>{% trans "Boot VM" %}?</td>
+ <td>
+ {% if advanced.no_start %}
+ <img src="/static/images/icons/cross.png" />
+ {% else %}
+ <img src="/static/images/icons/check.png" />
+ {% endif %}
+ </td>
+ </tr>
+ <tr><td><!-- spacer row for readability --></td></tr>
+
+ <!-- Step 5 -->
+ <tr><th colspan="2">
+ <button class="edit_step" name="wizard_goto_step" type="submit" value="4">{% trans "Step 5 (Edit)" %}</button>
+ </th></tr>
+
+ <tr>
+ <td>{% trans "Kernel Path" %}</td>
+ <td>{{ hv.kernel_path|default:"Not Set" }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Root Path" %}</td>
+ <td>{{ hv.root_path|default:"Not Set" }}</td>
+ </tr>
+ <tr>
+ <td>{% trans "Enable Serial Console" %}?</td>
+ <td>
+ {% if hv.serial_console %}
+ <img src="/static/images/icons/check.png" />
+ {% else %}
+ <img src="/static/images/icons/cross.png" />
+ {% endif %}
+ </td>
+ </tr>
+ <tr>
+ <td>{% trans "Boot Device" %}</td>
+ <td>{{ hv.boot_order|default:"Not Set" }}</td>
+ </tr>
+ <!-- CD drive -->
+ {% if hv.cdrom_image_path %}
+ <tr>
+ <td>{% trans "CDROM Image Path" %}</td>
+ <td>{{ hv.cdrom_image_path }}</td>
+ </tr>
+ {% endif %}
+ {% if hv.cdrom2_image_path %}
+ <tr>
+ <td>{% trans "CDROM2 Image Path" %}</td>
+ <td>{{ hv.cdrom2_image_path }}</td>
+ </tr>
+ {% endif %}
+ {% if hv.cdrom_disk_type %}
+ <tr>
+ <td>{% trans "CDROM Disk Type" %}</td>
+ <td>{{ hv.cdrom_disk_type }}</td>
+ </tr>
+ {% endif %}
+ <tr>
+ <td>{% trans "NIC Type" %}</td>
+ <td>{{ hv.nic_type }}</td>
+ </tr>
+
+ <tr><td><!-- spacer row for readability --></td></tr>
+
+ </tbody>
+
+ {% endwith %}
+</table>
+
+<div id="step_controls">
+ {% include "ganeti/forms/step_controls.html" %}
+</div>
+
+</div>
+{% endblock form_content %}

diff --git a/ganeti_webmgr/templates/ganeti/forms/vm_wizard_base.html b/ganeti_webmgr/templates/ganeti/forms/vm_wizard_base.html
new file mode 100644
index 0000000..142a6e4
--- /dev/null
+++ b/ganeti_webmgr/templates/ganeti/forms/vm_wizard_base.html
@@ -0,0 +1,59 @@
+{% extends "menu_base.html" %}
+{% load i18n %}
+{% load webmgr_tags %}
+{% load include_strip %}
+
+
+{% block title %}{%trans "Create a Virtual Machine" %}{% endblock %}
+
+{% block head %}
+{{ wizard.form.media }}
+<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/vm_wizard/base.css"/>
+<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/help_tips.css"/>
+
+<script src="{{STATIC_URL}}/js/helpTips.js"></script>
+<script src="{{STATIC_URL}}/js/disableSingletonDropdown.js" type="text/javascript"></script>
+<script src="{{STATIC_URL}}/js/multiInputHide.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ helpTips("#wizard");
+ multi_input('.disk');
+ multi_input('.nic');
+});
+</script>
+{% endblock %}
+
+{% block content %}
+<h1>{% block header %}
+Create {% include_strip "ganeti/forms/create_choice.html" with choices=summary.cluster_form.choices %} :
+{% endblock header %}</h1>
+
+<h2>Step {{ wizard.steps.step1 }} of {{ wizard.steps.count }}</h2>
+
+<div class="vm-summary">
+ <ul>
+ {% if summary.cluster_form.cluster %}
+ <li>Cluster: {{ summary.cluster_form.cluster }}</li>
+ {% endif %}
+ {% if summary.owner_form %}
+ <li>Owner: {{ summary.owner_form.owner }}</li>
+ {% endif %}
+ </ul>
+</div>
+
+<form action="" id='wizard' method="POST">{% csrf_token %} {{ wizard.management_form }}
+{% block form_content %}
+
+{% comment %} Including the step_controls by default. {% endcomment %}
+{% include "ganeti/forms/step_controls.html" %}
+{% endblock form_content %}
+</form>
+
+{% comment %}
+ All this does is render each fields help_text
+ and puts it into a help_tip div for styling
+{% endcomment %}
+{% include "ganeti/forms/helptips.html" with form=wizard.form only %}
+
+{% endblock content %}

diff --git a/ganeti_webmgr/templates/ganeti/forms/vm_wizard_generic_table.html b/ganeti_webmgr/templates/ganeti/forms/vm_wizard_generic_table.html
new file mode 100644
index 0000000..186a9f5
--- /dev/null
+++ b/ganeti_webmgr/templates/ganeti/forms/vm_wizard_generic_table.html
@@ -0,0 +1,24 @@
+{% extends "ganeti/forms/vm_wizard_base.html" %}
+
+{% block form_content %}
+ <table>
+ {{ wizard.form.non_field_errors }}
+
+ {% for hidden in wizard.forms.invisible_fields %}
+ {{ hidden }}
+ {% endfor %}
+
+ {% for field in wizard.form.visible_fields %}
+ <tr>
+ <th>{{ field.label_tag }}</th>
+ <td>{{ field.errors }} {{ field }}</td>
+ </tr>
+ {% endfor %}
+ <tr >
+ <td></td>
+ <td id="step_controls">
+ {% include "ganeti/forms/step_controls.html" %}
+ </td>
+ </tr>
+ </table>
+{% endblock form_content %}

diff --git a/ganeti_webmgr/templates/ganeti/virtual_machine/edit_base.html b/ganeti_webmgr/templates/ganeti/virtual_machine/edit_base.html
index dabc392..dbe5593 100644
--- a/ganeti_webmgr/templates/ganeti/virtual_machine/edit_base.html
+++ b/ganeti_webmgr/templates/ganeti/virtual_machine/edit_base.html
@@ -10,7 +10,7 @@
$(document).ready(function() {
var formUpdate = new modifyFormUpdater({{ form.nics }});
formUpdate.init();
- initHelpTips("#vmeditform");
+ helpTips("#vmeditform");
});
</script>
{% endblock %}
@@ -59,11 +59,7 @@
<input class="submit" type="submit" value="{% trans "Continue" %}" />
</form>
</div>
-<div id="help" class="help_tip">
- <h3></h3>
- <div></div>
-</div>
-<div id="help-contents">
+<div id="help">
{% include "ganeti/helptips/vm.html" %}
{% include "ganeti/helptips/vm_edit.html" %}
{% block helptips %}{% endblock %}

diff --git a/ganeti_webmgr/templates/ganeti/virtual_machine/novnc.html b/ganeti_webmgr/templates/ganeti/virtual_machine/novnc.html
index 1fc47ae..eeca635 100644
--- a/ganeti_webmgr/templates/ganeti/virtual_machine/novnc.html
+++ b/ganeti_webmgr/templates/ganeti/virtual_machine/novnc.html
@@ -4,7 +4,7 @@
</style>
<script type="text/javascript">
// Set include path for noVNC scripts
- var INCLUDE_URI = "{{SITE_ROOT}}/novnc/";
+ var INCLUDE_URI = "{{STATIC_URL}}/novnc/";
// Set path for proxy requests
var PROXY_REQUEST_URI = "{% url instance-vnc-proxy cluster_slug instance.hostname %}";
{% if not popout %}

diff --git a/ganeti_webmgr/templates/ganeti/virtual_machine/rename.html b/ganeti_webmgr/templates/ganeti/virtual_machine/rename.html
index 4e5c50e..6c00707 100644
--- a/ganeti_webmgr/templates/ganeti/virtual_machine/rename.html
+++ b/ganeti_webmgr/templates/ganeti/virtual_machine/rename.html
@@ -9,7 +9,9 @@
<link rel="stylesheet" type="text/css"
href="{{STATIC_URL}}/css/help_tips.css"/>
<script src="{{STATIC_URL}}/js/helpTips.js"></script>
- <script type="text/javascript">initHelpTips('#virtualmachineform');</script>
+ <script type="text/javascript">
+ helpTips('#virtualmachineform');
+ </script>
<script type="text/javascript">
// Make sure that if IP Check is selected, so is DNS Name Check
$(document).ready(function() {
@@ -62,7 +64,7 @@
<div></div>
</div>

- <div id="help-contents">
+ <div id="help">
{% include "ganeti/helptips/vm_rename.html" %}
</div>
{% endblock %}

diff --git a/ganeti_webmgr/templates/ganeti/virtual_machine/reparent.html b/ganeti_webmgr/templates/ganeti/virtual_machine/reparent.html
index 7747950..58d6e18 100644
--- a/ganeti_webmgr/templates/ganeti/virtual_machine/reparent.html
+++ b/ganeti_webmgr/templates/ganeti/virtual_machine/reparent.html
@@ -13,7 +13,7 @@
<script type="text/javascript" src="{{SITE_ROOT}}/object_permissions_media/js/autocomplete_user_search.js"></script>
<script type="text/javascript">
$(document).ready(function() {
- initHelpTips("#virtualmachineform");
+ helpTips("#virtualmachineform");
autocomplete_user_search($("#id_owner"),'{% url owner-search %}');
});
</script>
@@ -44,7 +44,7 @@
<div></div>
</div>

- <div id="help-contents">
+ <div id="help">
{% include "ganeti/helptips/vm_create.html" %}
</div>
{% endblock %}

diff --git a/ganeti_webmgr/virtualmachines/forms.py b/ganeti_webmgr/virtualmachines/forms.py
index 5e2236a..867a2f2 100644
--- a/ganeti_webmgr/virtualmachines/forms.py
+++ b/ganeti_webmgr/virtualmachines/forms.py
@@ -1117,10 +1117,15 @@ class VMWizardKVMForm(Form):

return data

+class VMWizardSummaryForm(Form):
+ class Media:
+ css = {
+ 'all': ('/static/css/vm_wizard/summary.css',)
+ }

class VMWizardView(LoginRequiredMixin, PermissionRequiredMixin,
CookieWizardView):
- template_name = "ganeti/forms/vm_wizard.html"
+ template_name = "ganeti/forms/vm_wizard_generic_table.html"
permission_required = ["admin", "create_vm"]
no_perms_msg = ("You do not have admin or create vm "
"privledges to any clusters.")
@@ -1175,6 +1180,12 @@ class VMWizardView(LoginRequiredMixin, PermissionRequiredMixin,
return data.get("iallocator", False)
return False

+ def get_template_names(self):
+ template = self.template_name
+ if self.steps.current == '5':
+ template = 'ganeti/forms/summary.html'
+ return template
+
def get_form(self, step=None, data=None, files=None):
s = int(self.steps.current) if step is None else int(step)
initial = self.get_form_initial(s)
@@ -1223,6 +1234,8 @@ class VMWizardView(LoginRequiredMixin, PermissionRequiredMixin,
form._configure_for_template(self._get_template())
else:
form = Form()
+ elif s == 5:
+ form = VMWizardSummaryForm(data=data)
else:
form = super(VMWizardView, self).get_form(step, data, files)

@@ -1345,6 +1358,7 @@ def vm_wizard(*args, **kwargs):
VMWizardOwnerForm,
VMWizardBasicsForm,
VMWizardAdvancedForm,
+ VMWizardSummaryForm,
Form,
)
initial = kwargs.get('initial_dict', None)

diff --git a/noVNC/LICENSE.txt b/noVNC/LICENSE.txt
new file mode 100644
index 0000000..67cdca5
--- /dev/null
+++ b/noVNC/LICENSE.txt
@@ -0,0 +1,78 @@
+noVNC is Copyright (C) 2011 Joel Martin <git...@martintribe.org>
+
+The noVNC core library is licensed under the LGPLv3 (GNU Lesser
+General Public License). The noVNC core library is composed of the
+Javascript code necessary for full noVNC operation. This includes (but
+is not limited to):
+
+ include/base64.js
+ include/des.js
+ include/display.js
+ include/input.js
+ include/jsunzip.js
+ include/logo.js
+ include/rfb.js
+ include/ui.js
+ include/util.js
+ include/vnc.js
+ include/websock.js
+ include/webutil.js
+
+The HTML, CSS, font and images files that included with the noVNC
+source distibution (or repository) are not considered part of the
+noVNC core library and are licensed under more permissive licenses.
+The intent is to allow easy integration of noVNC into existing web
+sites and web applications.
+
+The HTML, CSS, font and image files are licensed as follows:
+
+ *.html : 2-Clause BSD license
+
+ include/*.css : 2-Clause BSD license
+
+ include/Orbitron* : SIL Open Font License 1.1
+ (Copyright 2009 Matt McInerney)
+
+ images/ : Creative Commons Attribution-ShareAlike
+ 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.
+Please refer to the individual source files and/or to the noVNC commit
+history: https://github.com/kanaka/noVNC/commits/master
+
+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
+licenses (all LGPL-3 compatible):
+
+ include/base64.js : MPL 1.1, GPL-2 or LGPL-2.1
+
+ include/des.js : Various BSD style licenses
+
+ include/jsunzip.js : zlib/libpng license
+
+ include/web-socket-js/ : New BSD license (3-clause). Source code at
+ http://github.com/gimite/web-socket-js
+
+The following license texts are included:
+
+ docs/LICENSE.LGPL-3 and
+ docs/LICENSE.GPL-3
+ docs/LICENSE.OFL-1.1
+ docs/LICENSE.BSD-3-Clause (New BSD)
+ docs/LICENSE.BSD-2-Clause (Simplified BSD / FreeBSD)
+ docs/LICENSE.zlib
+ docs/LICENSE.MPL-2.0
+
+Or alternatively the license texts may be found here:
+
+ http://www.gnu.org/licenses/lgpl.html and
+ http://www.gnu.org/licenses/gpl.html
+ http://scripts.sil.org/OFL
+ http://www.mozilla.org/MPL/1.1/
+ http://www.mozilla.org/MPL/2.0/

diff --git a/noVNC/README.md b/noVNC/README.md
new file mode 100644
index 0000000..cfdac8f
--- /dev/null
+++ b/noVNC/README.md
@@ -0,0 +1,130 @@
+## noVNC: HTML5 VNC Client
+
+
+### Description
+
+noVNC is a HTML5 VNC client that runs well in any modern browser
+including mobile browsers (iPhone/iPad and Android).
+
+More than 16 companies/projects have integrated noVNC into their
+products including [Ganeti Web
+Manager](http://code.osuosl.org/projects/ganeti-webmgr),
+[OpenStack](http://www.openstack.org), and
+[OpenNebula](http://opennebula.org/). See [the Projects and Companies
+wiki page](https://github.com/kanaka/noVNC/wiki/ProjectsCompanies-using-noVNC)
+for more complete list.
+
+### News/help/contact
+
+Notable commits, announcements and news are posted to
+@<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 I have marked as
+["patchwelcome"](https://github.com/kanaka/noVNC/issues?labels=patchwelcome).
+
+If you want to show appreciation for noVNC you could buy something off
+my [Amazon wishlist](http://www.amazon.com/registry/wishlist/XTXFXK39IA8C/?reveal=unpurchased&sort=priority&layout=compact) or you could donate to a great 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.
+
+
+### Features
+
+* Supports all modern browsers including mobile (iOS, Android)
+* Supported VNC encodings: raw, copyrect, rre, hextile, tight, tightPNG
+* WebSocket SSL/TLS encryption (i.e. "wss://") support
+* 24-bit true color and 8 bit colour mapped
+* Supports desktop resize notification/pseudo-encoding
+* Local or remote cursor
+* Clipboard copy/paste
+* Clipping or scolling modes for large remote screens
+* Easy site integration and theming (3 example themes included)
+* Licensed under the [LGPLv3](http://www.gnu.org/licenses/lgpl.html)
+
+### Screenshots
+
+Running in Chrome before and after connecting:
+
+<img src="http://kanaka.github.com/noVNC/img/noVNC-5.png" width=400>&nbsp;<img src="http://kanaka.github.com/noVNC/img/noVNC-7.jpg" width=400>
+
+See more screenshots <a href="http://kanaka.github.com/noVNC/screenshots.html">here</a>.
+
+
+### Browser Requirements
+
+* HTML5 Canvas (with createImageData): Chrome, Firefox 3.6+, iOS
+ Safari, Opera 11+, Internet Explorer 9+, etc.
+
+* HTML5 WebSockets: For browsers that do not have builtin
+ WebSockets support, the project includes
+ <a href="http://github.com/gimite/web-socket-js">web-socket-js</a>,
+ a WebSockets emulator using Adobe Flash. iOS 4.2+ has built-in
+ WebSocket support.
+
+* Fast Javascript Engine: this is not strictly a requirement, but
+ without a fast Javascript engine, noVNC might be painfully slow.
+
+* I maintain a more detailed browser compatibility list <a
+ href="https://github.com/kanaka/noVNC/wiki/Browser-support">here</a>.
+
+
+### Server Requirements
+
+Unless you are using a VNC server with support for WebSockets
+connections (such as [x11vnc/libvncserver](http://libvncserver.sourceforge.net/) or
+[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
+
+* Use the launch script to start a mini-webserver and the WebSockets
+ proxy (websockify). The `--vnc` option is used to specify the location of
+ a running VNC server:
+
+ `./utils/launch.sh --vnc localhost:5901`
+
+* Point your browser to the cut-and-paste URL that is output by the
+ launch script. Enter a password if the VNC server has one
+ configured. Hit the Connect button and enjoy!
+
+
+### Other Pages
+
+* [Encrypted Connections](https://github.com/kanaka/websockify/wiki/Encrypted-Connections). How to setup websockify so that you can use encrypted connections from noVNC.
+
+* [Advanced Usage](https://github.com/kanaka/noVNC/wiki/Advanced-usage). Starting a VNC server, advanced websockify usage, etc.
+
+* [Integrating noVNC](https://github.com/kanaka/noVNC/wiki/Integration) into existing projects.
+
+* [Troubleshooting noVNC](https://github.com/kanaka/noVNC/wiki/Troubleshooting) problems.
+
+
+### Authors/Contributors
+
+* noVNC : Joel Martin (github.com/kanaka)
+ * UI and Icons : Chris Gordon
+ * Original Logo : Michael Sersen
+ * tight encoding : Michael Tinglof (Mercuri.ca)
+
+* Included libraries:
+ * web-socket-js : Hiroshi Ichikawa (github.com/gimite/web-socket-js)
+ * as3crypto : Henri Torgemane (code.google.com/p/as3crypto)
+ * base64 : Martijn Pieters (Digital Creations 2), Samuel Sieb (sieb.net)
+ * jsunzip : Erik Moller (github.com/operasoftware/jsunzip),
+ * tinflate : Joergen Ibsen (ibsensoftware.com)
+ * DES : Dave Zimmerman (Widget Workshop), Jef Poskanzer (ACME Labs)
+
+

diff --git a/noVNC/debian/changelog b/noVNC/debian/changelog
new file mode 100644
index 0000000..4d30742
--- /dev/null
+++ b/noVNC/debian/changelog
@@ -0,0 +1,35 @@
+novnc (0.4) maverick; urgency=low
+
+ * Clarify permissive licenses of HTML, CSS, images.
+ * Use render queue and requestAnimationFrame
+ * UltraVNC repeater support
+
+ -- Joel Martin <git...@martintribe.org> Fri, 14 Sep 2012 05:00:00 -0600
+
+novnc (0.3) maverick; urgency=low
+
+ * add tight encoding support
+ * release pressed key when focus lost (fixes locked Alt key)
+ * Support Apple Remote Desktop
+ * Add nova/openstack proxy wrapper
+ * Better connection close handling/reporting
+
+ -- Joel Martin <git...@martintribe.org> Fri, 11 May 2012 03:00:00 -0600
+
+novnc (0.2) maverick; urgency=low
+
+ * Mobile device support with viewport clipping
+ * Much better styling that also works on mobile devices well
+ * Update websockify to support latest WebSocket protocol HyBi 13
+ (i.e. support IETF 6455)
+ * Better support in websockify for python 2.4 through 3.2
+ * Support VMWare ESX and Intel AMT KVM
+ * View only mode
+
+ -- Joel Martin <git...@martintribe.org> Tue, 05 Jul 2011 01:00:00 -0600
+
+novnc (0.1) maverick; urgency=low
+
+ * First upstream release
+
+ -- Joel Martin <git...@martintribe.org> Tue, 05 Jul 2011 01:00:00 -0600

diff --git a/noVNC/debian/compat b/noVNC/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/noVNC/debian/compat
@@ -0,0 +1 @@
+7

diff --git a/noVNC/debian/control b/noVNC/debian/control
new file mode 100644
index 0000000..f7b92d5
--- /dev/null
+++ b/noVNC/debian/control
@@ -0,0 +1,13 @@
+Source: novnc
+Section: web
+Priority: optional
+Maintainer: Joel Martin <git...@martintribe.org>
+Build-Depends: debhelper (>= 7.0.0~)
+Standards-Version: 3.8.3
+Homepage: https://github.com/kanaka/noVNC/
+
+Package: novnc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, python (>= 2.4)
+Description: HTML5 VNC client
+ VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support.

diff --git a/noVNC/debian/copyright b/noVNC/debian/copyright
new file mode 100644
index 0000000..79444eb
--- /dev/null
+++ b/noVNC/debian/copyright
@@ -0,0 +1,36 @@
+Upstream Project: https://github.com/kanaka/noVNC/
+
+--------------------- Original LICENSE.txt ---------------------------
+
+noVNC is Copyright (C) 2011 Joel Martin <git...@martintribe.org>
+
+Some portions of noVNC are copyright to their individual authors.
+Please refer to the individual source files and/or to the noVNC commit
+history: https://github.com/kanaka/noVNC/commits/master
+
+noVNC is licensed under the LGPL (GNU Lesser General Public License)
+version 3 with the following exceptions:
+
+ include/input.js : LGPL-2 or any later version
+
+ include/base64.js : Dual GPL-2 or LGPL-2.1
+
+ incluee/des.js : Various BSD style licenses
+
+ include/web-socket-js/ : New BSD license. Source code at
+ http://github.com/gimite/web-socket-js
+
+ images/ : Creative Commons Attribution-ShareAlike
+ http://creativecommons.org/licenses/by-sa/3.0/
+ Uses of the work must be attributed
+ to the noVNC project.
+
+----------------------------------------------------------------------
+
+The LGPL-3 license text is located at:
+ /usr/share/common-licenses/LGPL-3 and
+ /usr/share/common-licenses/GPL-3
+
+Or alternatively the LGPL-3 license text may be found here:
+ http://www.gnu.org/licenses/lgpl.html and
+ http://www.gnu.org/licenses/gpl.html

diff --git a/noVNC/debian/novnc.install b/noVNC/debian/novnc.install
new file mode 100644
index 0000000..128692f
--- /dev/null
+++ b/noVNC/debian/novnc.install
@@ -0,0 +1,30 @@
+vnc.html /usr/share/novnc
+vnc_auto.html /usr/share/novnc
+README.md /usr/share/doc/novnc
+LICENSE.txt /usr/share/doc/novnc
+utils/Makefile /usr/share/novnc/utils
+utils/launch.sh /usr/share/novnc/utils
+utils/websocket.py /usr/share/novnc/utils
+utils/websockify /usr/share/novnc/utils
+utils/wsproxy.py /usr/share/novnc/utils
+utils/rebind.c /usr/share/novnc/utils
+utils/rebind.so /usr/share/novnc/utils
+images /usr/share/novnc
+images/favicon.ico /usr/share/novnc
+include/base64.js /usr/share/novnc/include
+include/des.js /usr/share/novnc/include
+include/display.js /usr/share/novnc/include
+include/input.js /usr/share/novnc/include
+include/logo.js /usr/share/novnc/include
+include/base.css /usr/share/novnc/include
+include/blue.css /usr/share/novnc/include
+include/black.css /usr/share/novnc/include
+include/playback.js /usr/share/novnc/include
+include/rfb.js /usr/share/novnc/include
+include/ui.js /usr/share/novnc/include
+include/util.js /usr/share/novnc/include
+include/vnc.js /usr/share/novnc/include
+include/websock.js /usr/share/novnc/include
+include/webutil.js /usr/share/novnc/include
+include/jsunzip.js /usr/share/novnc/include
+include/web-socket-js/* /usr/share/novnc/include/web-socket-js

diff --git a/noVNC/debian/rules b/noVNC/debian/rules
new file mode 100644
index 0000000..25b0812
--- /dev/null
+++ b/noVNC/debian/rules
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+clean:
+ make -C utils clean
+ dh clean
+
+build:
+ make -C utils rebind.so
+
+%:
+ dh ${@}

diff --git a/noVNC/docs/LICENSE.BSD-2-Clause b/noVNC/docs/LICENSE.BSD-2-Clause
new file mode 100644
index 0000000..9d66ec9
--- /dev/null
+++ b/noVNC/docs/LICENSE.BSD-2-Clause
@@ -0,0 +1,22 @@
+Copyright (c) <year>, <copyright holder>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

diff --git a/noVNC/docs/LICENSE.BSD-3-Clause b/noVNC/docs/LICENSE.BSD-3-Clause
new file mode 100644
index 0000000..e160466
--- /dev/null
+++ b/noVNC/docs/LICENSE.BSD-3-Clause
@@ -0,0 +1,24 @@
+Copyright (c) <year>, <copyright holder>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the <organization> nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

diff --git a/noVNC/docs/LICENSE.GPL-3 b/noVNC/docs/LICENSE.GPL-3
new file mode 100644
index 0000000..94a0453
--- /dev/null
+++ b/noVNC/docs/LICENSE.GPL-3
@@ -0,0 +1,621 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS

diff --git a/noVNC/docs/LICENSE.LGPL-3 b/noVNC/docs/LICENSE.LGPL-3
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/noVNC/docs/LICENSE.LGPL-3
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.

diff --git a/noVNC/docs/LICENSE.MPL-2.0 b/noVNC/docs/LICENSE.MPL-2.0
new file mode 100644
index 0000000..14e2f77
--- /dev/null
+++ b/noVNC/docs/LICENSE.MPL-2.0
@@ -0,0 +1,373 @@
+Mozilla Public License Version 2.0
+==================================
+
+1. Definitions
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ 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/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.

diff --git a/noVNC/docs/LICENSE.OFL-1.1 b/noVNC/docs/LICENSE.OFL-1.1
new file mode 100644
index 0000000..075d1ae
--- /dev/null
+++ b/noVNC/docs/LICENSE.OFL-1.1
@@ -0,0 +1,91 @@
+This Font Software is licensed under the SIL Open Font License, Version 1.1.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of collaborative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide a free and
+open framework in which fonts may be shared and improved in partnership
+with others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and/or sold with any software provided that any reserved
+names are not used by derivative works. The fonts and derivatives,
+however, cannot be released under any other type of license. The
+requirement for fonts to remain under this license does not apply
+to any document created using the fonts or their derivatives.
+
+DEFINITIONS
+"Font Software" refers to the set of files released by the Copyright
+Holder(s) under this license and clearly marked as such. This may
+include source files, build scripts and documentation.
+
+"Reserved Font Name" refers to any names specified as such after the
+copyright statement(s).
+
+"Original Version" refers to the collection of Font Software components as
+distributed by the Copyright Holder(s).
+
+"Modified Version" refers to any derivative made by adding to, deleting,
+or substituting -- in part or in whole -- any of the components of the
+Original Version, by changing formats or by porting the Font Software to a
+new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Original or Modified Versions, may be sold by itself.
+
+2) Original or Modified Versions of the Font Software may be bundled,
+redistributed and/or sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s) unless explicit written permission is granted by the corresponding
+Copyright Holder. This restriction only applies to the primary font name as
+presented to the users.
+
+4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder(s) and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed entirely under this license, and must not be
+distributed under any other license. The requirement for fonts to
+remain under this license does not apply to any document created
+using the Font Software.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.

diff --git a/noVNC/docs/LICENSE.zlib b/noVNC/docs/LICENSE.zlib
new file mode 100644
index 0000000..ca15168
--- /dev/null
+++ b/noVNC/docs/LICENSE.zlib
@@ -0,0 +1,27 @@
+Copyright (c) <year>, <copyright holder>
+All rights reserved.
+
+This software is provided 'as-is', without any express
+or implied warranty. In no event will the authors be
+held liable for any damages arising from the use of
+this software.
+
+Permission is granted to anyone to use this software
+for any purpose, including commercial applications,
+and to alter it and redistribute it freely, subject to
+the following restrictions:
+
+1. The origin of this software must not be
+ misrepresented; you must not claim that you
+ wrote the original software. If you use this
+ software in a product, an acknowledgment in
+ the product documentation would be appreciated
+ but is not required.
+
+2. Altered source versions must be plainly marked
+ as such, and must not be misrepresented as
+ being the original software.
+
+3. This notice may not be removed or altered from
+ any source distribution.
+

diff --git a/noVNC/docs/VERSION b/noVNC/docs/VERSION
new file mode 100644
index 0000000..bd73f47
--- /dev/null
+++ b/noVNC/docs/VERSION
@@ -0,0 +1 @@
+0.4

diff --git a/noVNC/docs/flash_policy.txt b/noVNC/docs/flash_policy.txt
new file mode 100644
index 0000000..df325c0
--- /dev/null
+++ b/noVNC/docs/flash_policy.txt
@@ -0,0 +1,4 @@
+Manual setup:
+
+DATA="echo \'<cross-domain-policy><allow-access-from domain=\\\"*\\\" to-ports=\\\"*\\\" /></cross-domain-policy>\'"
+/usr/bin/socat -T 1 TCP-L:843,reuseaddr,fork,crlf SYSTEM:"$DATA"

diff --git a/noVNC/docs/links b/noVNC/docs/links
new file mode 100644
index 0000000..31544ce
--- /dev/null
+++ b/noVNC/docs/links
@@ -0,0 +1,76 @@
+New tight PNG protocol:
+ http://wiki.qemu.org/VNC_Tight_PNG
+ http://xf.iksaif.net/blog/index.php?post/2010/06/14/QEMU:-Tight-PNG-and-some-profiling
+
+RFB protocol and extensions:
+ http://tigervnc.org/cgi-bin/rfbproto
+
+Canvas Browser Compatibility:
+ http://philip.html5.org/tests/canvas/suite/tests/results.html
+
+WebSockets API standard:
+ http://www.whatwg.org/specs/web-apps/current-work/complete.html#websocket
+ http://dev.w3.org/html5/websockets/
+ http://www.ietf.org/id/draft-ietf-hybi-thewebsocketprotocol-00.txt
+
+Browser Keyboard Events detailed:
+ http://unixpapa.com/js/key.html
+
+ActionScript (Flash) WebSocket implementation:
+ http://github.com/gimite/web-socket-js
+
+ActionScript (Flash) crypto/TLS library:
+ http://code.google.com/p/as3crypto
+ http://github.com/lyokato/as3crypto_patched
+
+TLS Protocol:
+ http://en.wikipedia.org/wiki/Transport_Layer_Security
+
+Generate self-signed certificate:
+ http://docs.python.org/dev/library/ssl.html#certificates
+
+Cursor appearance/style (for Cursor pseudo-encoding):
+ http://en.wikipedia.org/wiki/ICO_(file_format)
+ http://www.daubnet.com/en/file-format-cur
+ https://developer.mozilla.org/en/Using_URL_values_for_the_cursor_property
+ http://www.fileformat.info/format/bmp/egff.htm
+
+Icon/Cursor file format:
+ http://msdn.microsoft.com/en-us/library/ms997538
+ http://msdn.microsoft.com/en-us/library/aa921550.aspx
+ http://msdn.microsoft.com/en-us/library/aa930622.aspx
+
+
+RDP Protocol specification:
+ http://msdn.microsoft.com/en-us/library/cc240445(v=PROT.10).aspx
+
+
+Related projects:
+
+ guacamole: http://guacamole.sourceforge.net/
+
+ - Web client, but Java servlet does pre-processing
+
+ jsvnc: http://code.google.com/p/jsvnc/
+
+ - No releases
+
+ webvnc: http://code.google.com/p/webvnc/
+
+ - Jetty web server gateway, no updates since April 2008.
+
+ RealVNC Java applet: http://www.realvnc.com/support/javavncviewer.html
+
+ - Java applet
+
+ Flashlight-VNC: http://www.wizhelp.com/flashlight-vnc/
+
+ - Adobe Flash implementation
+
+ FVNC: http://osflash.org/fvnc
+
+ - Adbove Flash implementation
+
+ CanVNC: http://canvnc.sourceforge.net/
+
+ - HTML client with REST to VNC python proxy. Mostly vapor.

diff --git a/noVNC/docs/notes b/noVNC/docs/notes
new file mode 100644
index 0000000..b3cc0cf
--- /dev/null
+++ b/noVNC/docs/notes
@@ -0,0 +1,17 @@
+Some implementation notes:
+
+There is an included flash object (web-socket-js) that is used to
+emulate websocket support on browsers without websocket support
+(currently only Chrome has WebSocket support).
+
+Javascript doesn't have a bytearray type, so what you get out of
+a WebSocket object is just Javascript strings. Javascript has UTF-16
+unicode strings and anything sent through the WebSocket gets converted
+to UTF-8 and vice-versa. So, one additional (and necessary) function
+of wsproxy is base64 encoding/decoding what is sent to/from the
+browser.
+
+Building web-socket-js emulator:
+
+cd include/web-socket-js/flash-src
+mxmlc -static-link-runtime-shared-libraries WebSocketMain.as

diff --git a/noVNC/docs/packaging.txt b/noVNC/docs/packaging.txt
new file mode 100644
index 0000000..9552454
--- /dev/null
+++ b/noVNC/docs/packaging.txt
@@ -0,0 +1,23 @@
+noVNC packaging steps for Debian/Ubuntu:
+
+- Update the noVNC version in docs/VERSION and add a new entry for the
+ version in debian/changelog
+
+- Rename the novnc source directory to match the form "novnc-VERSION".
+
+- In the novnc source directory, run the packaging command:
+
+ debuild -I -uc -us
+
+ - The -I option ignores the .git directory when generating the
+ source tarball.
+ - the -uc and -us may be omitted in order to create a signed
+ package.
+
+ - Alternatively, use pbuilder instead of debuild in order to build
+ for other distributions and to guarantee a sanitized package.
+
+- Verify the package and then commit the changes to docs/VERSION and
+ debian/changelog.
+
+- Upload the new package file(s).

diff --git a/noVNC/docs/release.txt b/noVNC/docs/release.txt
new file mode 100644
index 0000000..0b816b3
--- /dev/null
+++ b/noVNC/docs/release.txt
@@ -0,0 +1,8 @@
+- Update and commit docs/VERSION and debian/changelog
+- Create version tag and tarball from tag
+ WVER=0.3
+ git tag v${WVER}
+ git push origin master v${WVER}
+ git archive --format=tar --prefix=novnc-${WVER}/ v${WVER} > novnc-${WVER}.tar
+ gzip novnc-${WVER}.tar
+- Upload tarball to repo

diff --git a/noVNC/docs/rfb_notes b/noVNC/docs/rfb_notes
new file mode 100644
index 0000000..643e16c
--- /dev/null
+++ b/noVNC/docs/rfb_notes
@@ -0,0 +1,147 @@
+5.1.1 ProtocolVersion: 12, 12 bytes
+
+ - Sent by server, max supported
+ 12 ascii - "RFB 003.008\n"
+ - Response by client, version to use
+ 12 ascii - "RFB 003.003\n"
+
+5.1.2 Authentication: >=4, [16, 4] bytes
+
+ - Sent by server
+ CARD32 - authentication-scheme
+ 0 - connection failed
+ CARD32 - length
+ length - reason
+ 1 - no authentication
+
+ 2 - VNC authentication
+ 16 CARD8 - challenge (random bytes)
+
+ - Response by client (if VNC authentication)
+ 16 CARD8 - client encrypts the challenge with DES, using user
+ password as key, sends resulting 16 byte response
+
+ - Response by server (if VNC authentication)
+ CARD32 - 0 - OK
+ 1 - failed
+ 2 - too-many
+
+5.1.3 ClientInitialisation: 1 byte
+ - Sent by client
+ CARD8 - shared-flag, 0 exclusive, non-zero shared
+
+5.1.4 ServerInitialisation: >=24 bytes
+ - Sent by server
+ CARD16 - framebuffer-width
+ CARD16 - framebuffer-height
+ 16 byte PIXEL_FORMAT - server-pixel-format
+ CARD8 - bits-per-pixel
+ CARD8 - depth
+ CARD8 - big-endian-flag, non-zero is big endian
+ CARD8 - true-color-flag, non-zero then next 6 apply
+ CARD16 - red-max
+ CARD16 - green-max
+ CARD16 - blue-max
+ CARD8 - red-shift
+ CARD8 - green-shift
+ CARD8 - blue-shift
+ 3 bytes - padding
+ CARD32 - name-length
+
+ CARD8[length] - name-string
+
+
+
+Client to Server Messages:
+
+5.2.1 SetPixelFormat: 20 bytes
+ CARD8: 0 - message-type
+ ...
+
+5.2.2 FixColourMapEntries: >=6 bytes
+ CARD8: 1 - message-type
+ ...
+
+5.2.3 SetEncodings: >=8 bytes
+ CARD8: 2 - message-type
+ CARD8 - padding
+ CARD16 - numer-of-encodings
+
+ CARD32 - encoding-type in preference order
+ 0 - raw
+ 1 - copy-rectangle
+ 2 - RRE
+ 4 - CoRRE
+ 5 - hextile
+
+5.2.4 FramebufferUpdateRequest (10 bytes)
+ CARD8: 3 - message-type
+ CARD8 - incremental (0 for full-update, non-zero for incremental)
+ CARD16 - x-position
+ CARD16 - y-position
+ CARD16 - width
+ CARD16 - height
+
+
+5.2.5 KeyEvent: 8 bytes
+ CARD8: 4 - message-type
+ CARD8 - down-flag
+ 2 bytes - padding
+ CARD32 - key (X-Windows keysym values)
+
+5.2.6 PointerEvent: 6 bytes
+ CARD8: 5 - message-type
+ CARD8 - button-mask
+ CARD16 - x-position
+ CARD16 - y-position
+
+5.2.7 ClientCutText: >=9 bytes
+ CARD8: 6 - message-type
+ ...
+
+
+Server to Client Messages:
+
+5.3.1 FramebufferUpdate
+ CARD8: 0 - message-type
+ 1 byte - padding
+ CARD16 - number-of-rectangles
+
+ CARD16 - x-position
+ CARD16 - y-position
+ CARD16 - width
+ CARD16 - height
+ CARD16 - encoding-type:
+ 0 - raw
+ 1 - copy rectangle
+ 2 - RRE
+ 4 - CoRRE
+ 5 - hextile
+
+ raw:
+ - width x height pixel values
+
+ copy rectangle:
+ CARD16 - src-x-position
+ CARD16 - src-y-position
+
+ RRE:
+ CARD32 - N number-of-subrectangles
+ Nxd bytes - background-pixel-value (d bits-per-pixel)
+
+ ...
+
+5.3.2 SetColourMapEntries (no support)
+ CARD8: 1 - message-type
+ ...
+
+5.3.3 Bell
+ CARD8: 2 - message-type
+
+5.3.4 ServerCutText
+ CARD8: 3 - message-type
+
+
+
+
+

diff --git a/noVNC/docs/rfbproto-3.3.pdf b/noVNC/docs/rfbproto-3.3.pdf
new file mode 100644
index 0000000..56b8764
Binary files /dev/null and b/noVNC/docs/rfbproto-3.3.pdf differ

diff --git a/noVNC/docs/rfbproto-3.7.pdf b/noVNC/docs/rfbproto-3.7.pdf
new file mode 100644
index 0000000..1ef5462
Binary files /dev/null and b/noVNC/docs/rfbproto-3.7.pdf differ

diff --git a/noVNC/docs/rfbproto-3.8.pdf b/noVNC/docs/rfbproto-3.8.pdf
new file mode 100644
index 0000000..8f0730f
Binary files /dev/null and b/noVNC/docs/rfbproto-3.8.pdf differ

diff --git a/noVNC/favicon.ico b/noVNC/favicon.ico
new file mode 120000
index 0000000..45399c8
--- /dev/null
+++ b/noVNC/favicon.ico
@@ -0,0 +1 @@
+images/favicon.ico
\ No newline at end of file

diff --git a/noVNC/images/clipboard.png b/noVNC/images/clipboard.png
new file mode 100644
index 0000000..24df33c
Binary files /dev/null and b/noVNC/images/clipboard.png differ

diff --git a/noVNC/images/connect.png b/noVNC/images/connect.png
new file mode 100644
index 0000000..79e71ad
Binary files /dev/null and b/noVNC/images/connect.png differ

diff --git a/noVNC/images/ctrlaltdel.png b/noVNC/images/ctrlaltdel.png
new file mode 100644
index 0000000..31922e5
Binary files /dev/null and b/noVNC/images/ctrlaltdel.png differ

diff --git a/noVNC/images/disconnect.png b/noVNC/images/disconnect.png
new file mode 100644
index 0000000..8832f5e
Binary files /dev/null and b/noVNC/images/disconnect.png differ

diff --git a/noVNC/images/drag.png b/noVNC/images/drag.png
new file mode 100644
index 0000000..433f896
Binary files /dev/null and b/noVNC/images/drag.png differ

diff --git a/noVNC/images/favicon.ico b/noVNC/images/favicon.ico
new file mode 100644
index 0000000..c999634
Binary files /dev/null and b/noVNC/images/favicon.ico differ

diff --git a/noVNC/images/favicon.png b/noVNC/images/favicon.png
new file mode 100644
index 0000000..e2bdb19
Binary files /dev/null and b/noVNC/images/favicon.png differ

diff --git a/noVNC/images/keyboard.png b/noVNC/images/keyboard.png
new file mode 100644
index 0000000..f797952
Binary files /dev/null and b/noVNC/images/keyboard.png differ

diff --git a/noVNC/images/mouse_left.png b/noVNC/images/mouse_left.png
new file mode 100644
index 0000000..1de7a48
Binary files /dev/null and b/noVNC/images/mouse_left.png differ

diff --git a/noVNC/images/mouse_middle.png b/noVNC/images/mouse_middle.png
new file mode 100644
index 0000000..81fbd9b
Binary files /dev/null and b/noVNC/images/mouse_middle.png differ

diff --git a/noVNC/images/mouse_none.png b/noVNC/images/mouse_none.png
new file mode 100644
index 0000000..93dbf57
Binary files /dev/null and b/noVNC/images/mouse_none.png differ

diff --git a/noVNC/images/mouse_right.png b/noVNC/images/mouse_right.png
new file mode 100644
index 0000000..355b25d
Binary files /dev/null and b/noVNC/images/mouse_right.png differ

diff --git a/noVNC/images/screen_320x460.png b/noVNC/images/screen_320x460.png
new file mode 100644
index 0000000..172ec55
Binary files /dev/null and b/noVNC/images/screen_320x460.png differ

diff --git a/noVNC/images/screen_57x57.png b/noVNC/images/screen_57x57.png
new file mode 100644
index 0000000..e2085f2
Binary files /dev/null and b/noVNC/images/screen_57x57.png differ

diff --git a/noVNC/images/screen_700x700.png b/noVNC/images/screen_700x700.png
new file mode 100644
index 0000000..ae67768
Binary files /dev/null and b/noVNC/images/screen_700x700.png differ

diff --git a/noVNC/images/settings.png b/noVNC/images/settings.png
new file mode 100644
index 0000000..a43f5e1
Binary files /dev/null and b/noVNC/images/settings.png differ

diff --git a/noVNC/include/Orbitron700.ttf b/noVNC/include/Orbitron700.ttf
new file mode 100644
index 0000000..e28729d
Binary files /dev/null and b/noVNC/include/Orbitron700.ttf differ

diff --git a/noVNC/include/Orbitron700.woff b/noVNC/include/Orbitron700.woff
new file mode 100644
index 0000000..61db630
Binary files /dev/null and b/noVNC/include/Orbitron700.woff differ

diff --git a/noVNC/include/base.css b/noVNC/include/base.css
new file mode 100644
index 0000000..3a2feb3
--- /dev/null
+++ b/noVNC/include/base.css
@@ -0,0 +1,405 @@
+/*
+ * noVNC base CSS
+ * Copyright (C) 2012 Joel Martin
+ * noVNC is licensed under the LGPL-3 (see LICENSE.txt)
+ * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
+ */
+
+body {
+ margin:0;
+ padding:0;
+ font-family: Helvetica;
+ /*Background image with light grey curve.*/
+ background-color:#494949;
+ background-repeat:no-repeat;
+ background-position:right bottom;
+ height:100%;
+}
+
+html {
+ height:100%;
+}
+
+#noVNC_controls ul {
+ list-style: none;
+ margin: 0px;
+ padding: 0px;
+}
+#noVNC_controls li {
+ padding-bottom:8px;
+}
+
+#noVNC_host {
+ width:150px;
+}
+#noVNC_port {
+ width: 80px;
+}
+#noVNC_password {
+ width: 150px;
+}
+#noVNC_encrypt {
+}
+#noVNC_connectTimeout {
+ width: 30px;
+}
+#noVNC_path {
+ width: 100px;
+}
+#noVNC_connect_button {
+ width: 110px;
+ float:right;
+}
+
+
+#noVNC_view_drag_button {
+ display: none;
+}
+#sendCtrlAltDelButton {
+ display: none;
+}
+#noVNC_mobile_buttons {
+ display: none;
+}
+
+.noVNC-buttons-left {
+ float: left;
+ padding-left:10px;
+ padding-top:4px;
+}
+
+.noVNC-buttons-right {
+ float:right;
+ right: 0px;
+ padding-right:10px;
+ padding-top:4px;
+}
+
+#noVNC_status_bar {
+ margin-top: 0px;
+ padding: 0px;
+}
+
+#noVNC_status_bar div {
+ font-size: 12px;
+ padding-top: 4px;
+ width:100%;
+}
+
+#noVNC_status {
+ height:20px;
+ text-align: center;
+}
+#noVNC_settings_menu {
+ margin: 3px;
+ text-align: left;
+}
+#noVNC_settings_menu ul {
+ list-style: none;
+ margin: 0px;
+ padding: 0px;
+}
+
+#noVNC_apply {
+ 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
+ * scaling will occur. Canvas resizes to remote VNC settings */
+#noVNC_screen_pad {
+ margin: 0px;
+ padding: 0px;
+ height: 44px;
+}
+#noVNC_screen {
+ text-align: center;
+ display: table;
+ width:100%;
+ height:100%;
+ background-color:#313131;
+ border-bottom-right-radius: 800px 600px;
+ /*border-top-left-radius: 800px 600px;*/
+}
+
+#noVNC_container, #noVNC_canvas {
+ margin: 0px;
+ padding: 0px;
+}
+
+#noVNC_canvas {
+ left: 0px;
+}
+
+#VNC_clipboard_clear_button {
+ float:right;
+}
+#VNC_clipboard_text {
+ font-size: 11px;
+}
+
+#noVNC_clipboard_clear_button {
+ float:right;
+}
+
+/*Bubble contents divs*/
+#noVNC_settings {
+ display:none;
+ margin-top:77px;
+ right:20px;
+ position:fixed;
+}
+
+#noVNC_controls {
+ display:none;
+ margin-top:77px;
+ right:12px;
+ position:fixed;
+}
+#noVNC_controls.top:after {
+ right:15px;
+}
+
+#noVNC_description {
+ display:none;
+ position:fixed;
+
+ margin-top:77px;
+ right:20px;
+ left:20px;
+ padding:15px;
+ color:#000;
+ background:#eee; /* default background for browsers without gradient support */
+
+ border:2px solid #E0E0E0;
+ -webkit-border-radius:10px;
+ -moz-border-radius:10px;
+ border-radius:10px;
+}
+
+#noVNC_clipboard {
+ display:none;
+ margin-top:77px;
+ right:30px;
+ position:fixed;
+}
+#noVNC_clipboard.top:after {
+ right:85px;
+}
+
+#keyboardinput {
+ width:1px;
+ height:1px;
+ background-color:#fff;
+ color:#fff;
+ border:0;
+ position: relative;
+ left: -40px;
+ z-index: -1;
+}
+
+.noVNC_status_warn {
+ background-color:yellow;
+}
+
+/*
+ * Advanced Styling
+ */
+
+/* Control bar */
+#noVNC-control-bar {
+ position:fixed;
+ background: #b2bdcd; /* Old browsers */
+ 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-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
+ 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: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
+
+ display:block;
+ height:44px;
+ left:0;
+ top:0;
+ width:100%;
+ z-index:200;
+}
+
+.noVNC_status_button {
+ padding: 4px 4px;
+ vertical-align: middle;
+ border:1px solid #869dbc;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ border-radius: 6px;
+ background: #b2bdcd; /* Old browsers */
+ 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-linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* Chrome10+,Safari5.1+ */
+ 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+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b2bdcd', endColorstr='#6e84a3',GradientType=0 ); /* IE6-9 */
+ background: linear-gradient(top, #b2bdcd 0%,#899cb3 49%,#7e93af 51%,#6e84a3 100%); /* W3C */
+ /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/
+}
+
+.noVNC_status_button_selected {
+ padding: 4px 4px;
+ vertical-align: middle;
+ border:1px solid #4366a9;
+ -webkit-border-radius: 6px;
+ -moz-border-radius: 6px;
+ background: #779ced; /* Old browsers */
+ background: -moz-linear-gradient(top, #779ced 0%, #3970e0 49%, #2160dd 51%, #2463df 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#779ced), color-stop(49%,#3970e0), color-stop(51%,#2160dd), color-stop(100%,#2463df)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* Opera11.10+ */
+ background: -ms-linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* IE10+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#779ced', endColorstr='#2463df',GradientType=0 ); /* IE6-9 */
+ background: linear-gradient(top, #779ced 0%,#3970e0 49%,#2160dd 51%,#2463df 100%); /* W3C */
+ /*box-shadow:inset 0.4px 0.4px 0.4px #000000;*/
+}
+
+
+/*Settings Bubble*/
+.triangle-right {
+ position:relative;
+ padding:15px;
+ margin:1em 0 3em;
+ color:#fff;
+ background:#fff; /* default background for browsers without gradient support */
+ /* css3 */
+ /*background:-webkit-gradient(linear, 0 0, 0 100%, from(#2e88c4), to(#075698));
+ background:-moz-linear-gradient(#2e88c4, #075698);
+ background:-o-linear-gradient(#2e88c4, #075698);
+ background:linear-gradient(#2e88c4, #075698);*/
+ -webkit-border-radius:10px;
+ -moz-border-radius:10px;
+ border-radius:10px;
+ color:#000;
+ border:2px solid #E0E0E0;
+}
+
+.triangle-right.top:after {
+ border-color: transparent #E0E0E0;
+ border-width: 20px 20px 0 0;
+ bottom: auto;
+ left: auto;
+ right: 50px;
+ top: -20px;
+}
+
+.triangle-right:after {
+ content:"";
+ position:absolute;
+ bottom:-20px; /* value = - border-top-width - border-bottom-width */
+ left:50px; /* controls horizontal position */
+ border-width:20px 0 0 20px; /* vary these values to change the angle of the vertex */
+ border-style:solid;
+ border-color:#E0E0E0 transparent;
+ /* reduce the damage in FF3.0 */
+ display:block;
+ width:0;
+}
+
+.triangle-right.top:after {
+ top:-40px; /* value = - border-top-width - border-bottom-width */
+ right:50px; /* controls horizontal position */
+ bottom:auto;
+ left:auto;
+ border-width:40px 40px 0 0; /* vary these values to change the angle of the vertex */
+ border-color:transparent #E0E0E0;
+}
+
+/*Default noVNC logo.*/
+/* From: http://fonts.googleapis.com/css?family=Orbitron:700 */
+@font-face {
+ font-family: 'Orbitron';
+ font-style: normal;
+ font-weight: 700;
+ src: local('?'), url('Orbitron700.woff') format('woff'),
+ url('Orbitron700.ttf') format('truetype');
+}
+
+#noVNC_logo {
+ margin-top: 170px;
+ margin-left: 10px;
+ color:yellow;
+ text-align:left;
+ font-family: 'Orbitron', 'OrbitronTTF', sans-serif;
+ line-height:90%;
+ text-shadow:
+ 5px 5px 0 #000,
+ -1px -1px 0 #000,
+ 1px -1px 0 #000,
+ -1px 1px 0 #000,
+ 1px 1px 0 #000;
+}
+
+
+#noVNC_logo span{
+ color:green;
+}
+
+/* ----------------------------------------
+ * Media sizing
+ * ----------------------------------------
+ */
+
+
+.noVNC_status_button {
+ font-size: 12px;
+}
+
+#noVNC_clipboard_text {
+ width: 500px;
+}
+
+#noVNC_logo {
+ font-size: 180px;
+}
+
+@media screen and (min-width: 481px) and (max-width: 640px) {
+ .noVNC_status_button {
+ font-size: 10px;
+ }
+ #noVNC_clipboard_text {
+ width: 410px;
+ }
+ #noVNC_logo {
+ font-size: 150px;
+ }
+}
+
+@media screen and (min-width: 321px) and (max-width: 480px) {
+ .noVNC_status_button {
+ font-size: 10px;
+ }
+ #noVNC_clipboard_text {
+ width: 250px;
+ }
+ #noVNC_logo {
+ font-size: 110px;
+ }
+}
+
+@media screen and (max-width: 320px) {
+ .noVNC_status_button {
+ font-size: 9px;
+ }
+ #noVNC_clipboard_text {
+ width: 220px;
+ }
+ #noVNC_logo {
+ font-size: 90px;
+ }
+}

diff --git a/noVNC/include/base64.js b/noVNC/include/base64.js
new file mode 100644
index 0000000..e9b3c52
--- /dev/null
+++ b/noVNC/include/base64.js
@@ -0,0 +1,147 @@
+/*
+ * Modified from:
+ * http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js#956
+ */
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * 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 <m...@digicool.com> (original author)
+ * Samuel Sieb <sam...@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 */
+
+var Base64 = {
+
+/* Convert data (an array of integers) to a Base64 string. */
+toBase64Table : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
+base64Pad : '=',
+
+encode: function (data) {
+ "use strict";
+ var result = '',
+ chrTable = Base64.toBase64Table.split(''),
+ pad = Base64.base64Pad,
+ length = data.length,
+ i;
+ // Convert every three bytes to 4 ascii characters.
+ for (i = 0; i < (length - 2); i += 3) {
+ result += chrTable[data[i] >> 2];
+ result += chrTable[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
+ result += chrTable[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)];
+ result += chrTable[data[i+2] & 0x3f];
+ }
+
+ // Convert the remaining 1 or 2 bytes, pad out to 4 characters.
+ if (length%3) {
+ i = length - (length%3);
+ result += chrTable[data[i] >> 2];
+ if ((length%3) === 2) {
+ result += chrTable[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
+ result += chrTable[(data[i+1] & 0x0f) << 2];
+ result += pad;
+ } else {
+ result += chrTable[(data[i] & 0x03) << 4];
+ result += pad + pad;
+ }
+ }
+
+ return result;
+},
+
+/* 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
+],
+
+decode: function (data, offset) {
+ "use strict";
+ offset = typeof(offset) !== 'undefined' ? offset : 0;
+ var binTable = Base64.toBinaryTable,
+ pad = Base64.base64Pad,
+ result, result_length, idx, i, c, padding,
+ leftbits = 0, // number of bits decoded, but yet to be appended
+ leftdata = 0, // bits decoded, but yet to be appended
+ data_length = data.indexOf('=') - offset;
+
+ if (data_length < 0) { data_length = data.length - offset; }
+
+ /* Every four characters is 3 resulting numbers */
+ result_length = (data_length >> 2) * 3 + Math.floor((data_length%4)/1.5);
+ result = new Array(result_length);
+
+ // Convert one by one.
+ for (idx = 0, i = offset; i < data.length; i++) {
+ c = binTable[data.charCodeAt(i) & 0x7f];
+ padding = (data.charAt(i) === pad);
+ // Skip illegal characters and whitespace
+ if (c === -1) {
+ console.error("Illegal character code " + data.charCodeAt(i) + " at position " + i);
+ continue;
+ }
+
+ // Collect data into leftdata, update bitcount
+ leftdata = (leftdata << 6) | c;
+ leftbits += 6;
+
+ // If we have 8 or more bits, append 8 bits to the result
+ if (leftbits >= 8) {
+ leftbits -= 8;
+ // Append if not padding.
+ if (!padding) {
+ result[idx++] = (leftdata >> leftbits) & 0xff;
+ }
+ leftdata &= (1 << leftbits) - 1;
+ }
+ }
+
+ // If there are any bits left, the base64 string was corrupted
+ if (leftbits) {
+ throw {name: 'Base64-Error',
+ message: 'Corrupted base64 string'};
+ }
+
+ return result;
+}
+
+}; /* End of Base64 namespace */

diff --git a/noVNC/include/black.css b/noVNC/include/black.css
new file mode 100644
index 0000000..e958ee3
--- /dev/null
+++ b/noVNC/include/black.css
@@ -0,0 +1,52 @@
+/*
+ * noVNC base CSS
+ * Copyright (C) 2012 Joel Martin
+ * noVNC is licensed under the LGPL-3 (see LICENSE.txt)
+ * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
+ */
+
+#keyboardinput {
+ background-color:#000;
+}
+
+#noVNC-control-bar {
+ background: #4c4c4c; /* Old browsers */
+ 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-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
+ 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 */
+}
+
+.triangle-right {
+ border:2px solid #fff;
+ background:#000;
+ color:#fff;
+}
+
+.noVNC_status_button {
+ font-size: 12px;
+ vertical-align: middle;
+ border:1px solid #4c4c4c;
+
+ background: #4c4c4c; /* Old browsers */
+ 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-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* Opera11.10+ */
+ background: -ms-linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* IE10+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */
+ background: linear-gradient(top, #4c4c4c 0%,#2c2c2c 50%,#000000 51%,#131313 100%); /* W3C */
+}
+
+.noVNC_status_button_selected {
+ background: #9dd53a; /* Old browsers */
+ background: -moz-linear-gradient(top, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* FF3.6+ */
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9dd53a), color-stop(50%,#a1d54f), color-stop(51%,#80c217), color-stop(100%,#7cbc0a)); /* Chrome,Safari4+ */
+ background: -webkit-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* Chrome10+,Safari5.1+ */
+ background: -o-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* Opera11.10+ */
+ background: -ms-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* IE10+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9dd53a', endColorstr='#7cbc0a',GradientType=0 ); /* IE6-9 */
+ background: linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* W3C */
+}

diff --git a/noVNC/include/blue.css b/noVNC/include/blue.css
new file mode 100644
index 0000000..3dad0b4
--- /dev/null
+++ b/noVNC/include/blue.css
@@ -0,0 +1,33 @@
+/*
+ * noVNC base CSS
+ * Copyright (C) 2012 Joel Martin
+ * noVNC is licensed under the LGPL-3 (see LICENSE.txt)
+ * This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
+ */
+
+#noVNC-control-bar {
+ background-color:#04073d;
+ background-image: -webkit-gradient(
+ linear,
+ left bottom,
+ left top,
+ color-stop(0.54, rgb(10,15,79)),
+ color-stop(0.5, rgb(4,7,61))
+ );
+ background-image: -moz-linear-gradient(
+ center bottom,
+ rgb(10,15,79) 54%,
+ rgb(4,7,61) 50%
+ );
+}
+
+.triangle-right {
+ border:2px solid #fff;
+ background:#04073d;
+ color:#fff;
+}
+
+#keyboardinput {
+ background-color:#04073d;
+}
+

diff --git a/noVNC/include/des.js b/noVNC/include/des.js
new file mode 100644
index 0000000..1f95285
--- /dev/null
+++ b/noVNC/include/des.js
@@ -0,0 +1,273 @@
+/*
+ * Ported from Flashlight VNC ActionScript implementation:
+ * http://www.wizhelp.com/flashlight-vnc/
+ *
+ * Full attribution follows:
+ *
+ * -------------------------------------------------------------------------
+ *
+ * This DES class has been extracted from package Acme.Crypto for use in VNC.
+ * The unnecessary odd parity code has been removed.
+ *
+ * These changes are:
+ * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+
+ * DesCipher - the DES encryption method
+ *
+ * The meat of this code is by Dave Zimmerman <dz...@widget.com>, and is:
+ *
+ * Copyright (c) 1996 Widget Workshop, Inc. All Rights Reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * and its documentation for NON-COMMERCIAL or COMMERCIAL purposes and
+ * without fee is hereby granted, provided that this copyright notice is kept
+ * intact.
+ *
+ * WIDGET WORKSHOP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
+ * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. WIDGET WORKSHOP SHALL NOT BE LIABLE
+ * FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+ *
+ * THIS SOFTWARE IS NOT DESIGNED OR INTENDED FOR USE OR RESALE AS ON-LINE
+ * CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE
+ * PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
+ * NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE
+ * SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE
+ * SOFTWARE COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE
+ * PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). WIDGET WORKSHOP
+ * SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR
+ * HIGH RISK ACTIVITIES.
+ *
+ *
+ * The rest is:
+ *
+ * Copyright (C) 1996 by Jef Poskanzer <j...@acme.com>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * Visit the ACME Labs Java page for up-to-date versions of this and other
+ * fine Java utilities: http://www.acme.com/java/
+ */
+
+"use strict";
+/*jslint white: false, bitwise: false, plusplus: false */
+
+function DES(passwd) {
+
+// Tables, permutations, S-boxes, etc.
+var PC2 = [13,16,10,23, 0, 4, 2,27,14, 5,20, 9,22,18,11, 3,
+ 25, 7,15, 6,26,19,12, 1,40,51,30,36,46,54,29,39,
+ 50,44,32,47,43,48,38,55,33,52,45,41,49,35,28,31 ],
+ totrot = [ 1, 2, 4, 6,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,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.
+function setKeys(keyBlock) {
+ var i, j, l, m, n, o, pc1m = [], pcr = [], kn = [],
+ raw0, raw1, rawi, KnLi;
+
+ 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
+ m = l & 0x7;
+ pc1m[j] = ((keyBlock[l >>> 3] & (1<<m)) !== 0) ? 1: 0;
+ }
+
+ for (i = 0; i < 16; ++i) {
+ m = i << 1;
+ n = m + 1;
+ kn[m] = kn[n] = 0;
+ for (o=28; o<59; o+=28) {
+ for (j = o-28; j < o; ++j) {
+ l = j + totrot[i];
+ if (l < o) {
+ pcr[j] = pc1m[l];
+ } else {
+ pcr[j] = pc1m[l - 28];
+ }
+ }
+ }
+ for (j = 0; j < 24; ++j) {
+ if (pcr[PC2[j]] !== 0) {
+ kn[m] |= 1<<(23-j);
+ }
+ if (pcr[PC2[j + 24]] !== 0) {
+ kn[n] |= 1<<(23-j);
+ }
+ }
+ }
+
+ // cookey
+ for (i = 0, rawi = 0, KnLi = 0; i < 16; ++i) {
+ raw0 = kn[rawi++];
+ raw1 = kn[rawi++];
+ keys[KnLi] = (raw0 & 0x00fc0000) << 6;
+ keys[KnLi] |= (raw0 & 0x00000fc0) << 10;
+ keys[KnLi] |= (raw1 & 0x00fc0000) >>> 10;
+ keys[KnLi] |= (raw1 & 0x00000fc0) >>> 6;
+ ++KnLi;
+ keys[KnLi] = (raw0 & 0x0003f000) << 12;
+ keys[KnLi] |= (raw0 & 0x0000003f) << 16;
+ keys[KnLi] |= (raw1 & 0x0003f000) >>> 4;
+ keys[KnLi] |= (raw1 & 0x0000003f);
+ ++KnLi;
+ }
+}
+
+// Encrypt 8 bytes of text
+function enc8(text) {
+ var i = 0, b = text.slice(), fval, keysi = 0,
+ l, r, x; // left, right, accumulator
+
+ // Squash 8 bytes to 2 ints
+ l = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
+ r = b[i++]<<24 | b[i++]<<16 | b[i++]<<8 | b[i++];
+
+ x = ((l >>> 4) ^ r) & 0x0f0f0f0f;
+ r ^= x;
+ l ^= (x << 4);
+ x = ((l >>> 16) ^ r) & 0x0000ffff;
+ r ^= x;
+ l ^= (x << 16);
+ x = ((r >>> 2) ^ l) & 0x33333333;
+ l ^= x;
+ r ^= (x << 2);
+ x = ((r >>> 8) ^ l) & 0x00ff00ff;
+ l ^= x;
+ r ^= (x << 8);
+ r = (r << 1) | ((r >>> 31) & 1);
+ x = (l ^ r) & 0xaaaaaaaa;
+ l ^= x;
+ r ^= x;
+ l = (l << 1) | ((l >>> 31) & 1);
+
+ for (i = 0; i < 8; ++i) {
+ x = (r << 28) | (r >>> 4);
+ x ^= keys[keysi++];
+ fval = SP7[x & 0x3f];
+ fval |= SP5[(x >>> 8) & 0x3f];
+ fval |= SP3[(x >>> 16) & 0x3f];
+ fval |= SP1[(x >>> 24) & 0x3f];
+ x = r ^ keys[keysi++];
+ fval |= SP8[x & 0x3f];
+ fval |= SP6[(x >>> 8) & 0x3f];
+ fval |= SP4[(x >>> 16) & 0x3f];
+ fval |= SP2[(x >>> 24) & 0x3f];
+ l ^= fval;
+ x = (l << 28) | (l >>> 4);
+ x ^= keys[keysi++];
+ fval = SP7[x & 0x3f];
+ fval |= SP5[(x >>> 8) & 0x3f];
+ fval |= SP3[(x >>> 16) & 0x3f];
+ fval |= SP1[(x >>> 24) & 0x3f];
+ x = l ^ keys[keysi++];
+ fval |= SP8[x & 0x0000003f];
+ fval |= SP6[(x >>> 8) & 0x3f];
+ fval |= SP4[(x >>> 16) & 0x3f];
+ fval |= SP2[(x >>> 24) & 0x3f];
+ r ^= fval;
+ }
+
+ r = (r << 31) | (r >>> 1);
+ x = (l ^ r) & 0xaaaaaaaa;
+ l ^= x;
+ r ^= x;
+ l = (l << 31) | (l >>> 1);
+ x = ((l >>> 8) ^ r) & 0x00ff00ff;
+ r ^= x;
+ l ^= (x << 8);
+ x = ((l >>> 2) ^ r) & 0x33333333;
+ r ^= x;
+ l ^= (x << 2);
+ x = ((r >>> 16) ^ l) & 0x0000ffff;
+ l ^= x;
+ r ^= (x << 16);
+ x = ((r >>> 4) ^ l) & 0x0f0f0f0f;
+ l ^= x;
+ r ^= (x << 4);
+
+ // Spread ints to bytes
+ x = [r, l];
+ for (i = 0; i < 8; i++) {
+ b[i] = (x[i>>>2] >>> (8*(3 - (i%4)))) % 256;
+ if (b[i] < 0) { b[i] += 256; } // unsigned
+ }
+ return b;
+}
+
+// Encrypt 16 bytes of text using passwd as key
+function encrypt(t) {
+ return enc8(t.slice(0,8)).concat(enc8(t.slice(8,16)));
+}
+
+setKeys(passwd); // Setup keys
+return {'encrypt': encrypt}; // Public interface
+
+} // function DES

diff --git a/noVNC/include/display.js b/noVNC/include/display.js
new file mode 100644
index 0000000..5ad99ba
--- /dev/null
+++ b/noVNC/include/display.js
@@ -0,0 +1,757 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ */
+
+/*jslint browser: true, white: false, bitwise: false */
+/*global Util, Base64, changeCursor */
+
+function Display(defaults) {
+"use strict";
+
+var that = {}, // Public API methods
+ conf = {}, // Configuration attributes
+
+ // Private Display namespace variables
+ c_ctx = null,
+ c_forceCanvas = false,
+
+ // Queued drawing actions for in-order rendering
+ renderQ = [],
+
+ // Predefine function variables (jslint)
+ imageDataGet, rgbImageData, bgrxImageData, cmapImageData,
+ setFillColor, rescale, scan_renderQ,
+
+ // The full frame buffer (logical canvas) size
+ fb_width = 0,
+ fb_height = 0,
+ // The visible "physical canvas" viewport
+ viewport = {'x': 0, 'y': 0, 'w' : 0, 'h' : 0 },
+ cleanRect = {'x1': 0, 'y1': 0, 'x2': -1, 'y2': -1},
+
+ c_prevStyle = "",
+ tile = null,
+ tile16x16 = null,
+ tile_x = 0,
+ tile_y = 0;
+
+
+// Configuration attributes
+Util.conf_defaults(conf, that, defaults, [
+ ['target', 'wo', 'dom', null, 'Canvas element for rendering'],
+ ['context', 'ro', 'raw', null, 'Canvas 2D context for rendering (read-only)'],
+ ['logo', 'rw', 'raw', null, 'Logo to display when cleared: {"width": width, "height": height, "data": data}'],
+ ['true_color', 'rw', 'bool', true, 'Use true-color pixel data'],
+ ['colourMap', 'rw', 'arr', [], 'Colour map array (when not true-color)'],
+ ['scale', 'rw', 'float', 1.0, 'Display area scale factor 0.0 - 1.0'],
+ ['viewport', 'rw', 'bool', false, 'Use a viewport set with viewportChange()'],
+ ['width', 'rw', 'int', null, 'Display area width'],
+ ['height', 'rw', 'int', null, 'Display area height'],
+
+ ['render_mode', 'ro', 'str', '', 'Canvas rendering mode (read-only)'],
+
+ ['prefer_js', 'rw', 'str', null, 'Prefer Javascript over canvas methods'],
+ ['cursor_uri', 'rw', 'raw', null, 'Can we render cursor using data URI']
+ ]);
+
+// Override some specific getters/setters
+that.get_context = function () { return c_ctx; };
+
+that.set_scale = function(scale) { rescale(scale); };
+
+that.set_width = function (val) { that.resize(val, fb_height); };
+that.get_width = function() { return fb_width; };
+
+that.set_height = function (val) { that.resize(fb_width, val); };
+that.get_height = function() { return fb_height; };
+
+
+
+//
+// Private functions
+//
+
+// Create the public API interface
+function constructor() {
+ Util.Debug(">> Display.constructor");
+
+ var c, func, i, curDat, curSave,
+ has_imageData = false, UE = Util.Engine;
+
+ if (! conf.target) { throw("target must be set"); }
+
+ if (typeof conf.target === 'string') {
+ throw("target must be a DOM element");
+ }
+
+ c = conf.target;
+
+ if (! c.getContext) { throw("no getContext method"); }
+
+ if (! c_ctx) { c_ctx = c.getContext('2d'); }
+
+ Util.Debug("User Agent: " + navigator.userAgent);
+ if (UE.gecko) { Util.Debug("Browser: gecko " + UE.gecko); }
+ if (UE.webkit) { Util.Debug("Browser: webkit " + UE.webkit); }
+ if (UE.trident) { Util.Debug("Browser: trident " + UE.trident); }
+ if (UE.presto) { Util.Debug("Browser: presto " + UE.presto); }
+
+ that.clear();
+
+ // Check canvas features
+ if ('createImageData' in c_ctx) {
+ conf.render_mode = "canvas rendering";
+ } else {
+ throw("Canvas does not support createImageData");
+ }
+ if (conf.prefer_js === null) {
+ Util.Info("Prefering javascript operations");
+ conf.prefer_js = true;
+ }
+
+ // Initialize cached tile imageData
+ tile16x16 = c_ctx.createImageData(16, 16);
+
+ /*
+ * Determine browser support for setting the cursor via data URI
+ * scheme
+ */
+ curDat = [];
+ for (i=0; i < 8 * 8 * 4; i += 1) {
+ curDat.push(255);
+ }
+ try {
+ curSave = c.style.cursor;
+ changeCursor(conf.target, curDat, curDat, 2, 2, 8, 8);
+ if (c.style.cursor) {
+ if (conf.cursor_uri === null) {
+ conf.cursor_uri = true;
+ }
+ Util.Info("Data URI scheme cursor supported");
+ } else {
+ if (conf.cursor_uri === null) {
+ conf.cursor_uri = false;
+ }
+ Util.Warn("Data URI scheme cursor not supported");
+ }
+ c.style.cursor = curSave;
+ } catch (exc2) {
+ Util.Error("Data URI scheme cursor test exception: " + exc2);
+ conf.cursor_uri = false;
+ }
+
+ Util.Debug("<< Display.constructor");
+ return that ;
+}
+
+rescale = function(factor) {
+ var c, tp, x, y,
+ properties = ['transform', 'WebkitTransform', 'MozTransform', null];
+ c = conf.target;
+ tp = properties.shift();
+ while (tp) {
+ if (typeof c.style[tp] !== 'undefined') {
+ break;
+ }
+ tp = properties.shift();
+ }
+
+ if (tp === null) {
+ Util.Debug("No scaling support");
+ return;
+ }
+
+
+ if (typeof(factor) === "undefined") {
+ factor = conf.scale;
+ } else if (factor > 1.0) {
+ factor = 1.0;
+ } else if (factor < 0.1) {
+ factor = 0.1;
+ }
+
+ if (conf.scale === factor) {
+ //Util.Debug("Display already scaled to '" + factor + "'");
+ return;
+ }
+
+ conf.scale = factor;
+ x = c.width - c.width * factor;
+ y = c.height - c.height * factor;
+ c.style[tp] = "scale(" + conf.scale + ") translate(-" + x + "px, -" + y + "px)";
+};
+
+setFillColor = function(color) {
+ var bgr, newStyle;
+ if (conf.true_color) {
+ bgr = color;
+ } else {
+ bgr = conf.colourMap[color[0]];
+ }
+ newStyle = "rgb(" + bgr[2] + "," + bgr[1] + "," + bgr[0] + ")";
+ if (newStyle !== c_prevStyle) {
+ c_ctx.fillStyle = newStyle;
+ c_prevStyle = newStyle;
+ }
+};
+
+
+//
+// Public API interface functions
+//
+
+// Shift and/or resize the visible viewport
+that.viewportChange = function(deltaX, deltaY, width, height) {
+ var c = conf.target, v = viewport, cr = cleanRect,
+ saveImg = null, saveStyle, x1, y1, vx2, vy2, w, h;
+
+ if (!conf.viewport) {
+ Util.Debug("Setting viewport to full display region");
+ deltaX = -v.w; // Clamped later if out of bounds
+ deltaY = -v.h; // Clamped later if out of bounds
+ width = fb_width;
+ height = fb_height;
+ }
+
+ if (typeof(deltaX) === "undefined") { deltaX = 0; }
+ if (typeof(deltaY) === "undefined") { deltaY = 0; }
+ if (typeof(width) === "undefined") { width = v.w; }
+ if (typeof(height) === "undefined") { height = v.h; }
+
+ // Size change
+
+ if (width > fb_width) { width = fb_width; }
+ if (height > fb_height) { height = fb_height; }
+
+ if ((v.w !== width) || (v.h !== height)) {
+ // Change width
+ if ((width < v.w) && (cr.x2 > v.x + width -1)) {
+ cr.x2 = v.x + width - 1;
+ }
+ v.w = width;
+
+ // Change height
+ if ((height < v.h) && (cr.y2 > v.y + height -1)) {
+ cr.y2 = v.y + height - 1;
+ }
+ v.h = height;
+
+
+ if (v.w > 0 && v.h > 0 && c.width > 0 && c.height > 0) {
+ saveImg = c_ctx.getImageData(0, 0,
+ (c.width < v.w) ? c.width : v.w,
+ (c.height < v.h) ? c.height : v.h);
+ }
+
+ c.width = v.w;
+ c.height = v.h;
+
+ if (saveImg) {
+ c_ctx.putImageData(saveImg, 0, 0);
+ }
+ }
+
+ vx2 = v.x + v.w - 1;
+ vy2 = v.y + v.h - 1;
+
+
+ // Position change
+
+ if ((deltaX < 0) && ((v.x + deltaX) < 0)) {
+ deltaX = - v.x;
+ }
+ if ((vx2 + deltaX) >= fb_width) {
+ deltaX -= ((vx2 + deltaX) - fb_width + 1);
+ }
+
+ if ((v.y + deltaY) < 0) {
+ deltaY = - v.y;
+ }
+ if ((vy2 + deltaY) >= fb_height) {
+ deltaY -= ((vy2 + deltaY) - fb_height + 1);
+ }
+
+ if ((deltaX === 0) && (deltaY === 0)) {
+ //Util.Debug("skipping viewport change");
+ return;
+ }
+ Util.Debug("viewportChange deltaX: " + deltaX + ", deltaY: " + deltaY);
+
+ v.x += deltaX;
+ vx2 += deltaX;
+ v.y += deltaY;
+ vy2 += deltaY;
+
+ // Update the clean rectangle
+ if (v.x > cr.x1) {
+ cr.x1 = v.x;
+ }
+ if (vx2 < cr.x2) {
+ cr.x2 = vx2;
+ }
+ if (v.y > cr.y1) {
+ cr.y1 = v.y;
+ }
+ if (vy2 < cr.y2) {
+ cr.y2 = vy2;
+ }
+
+ if (deltaX < 0) {
+ // Shift viewport left, redraw left section
+ x1 = 0;
+ w = - deltaX;
+ } else {
+ // Shift viewport right, redraw right section
+ x1 = v.w - deltaX;
+ w = deltaX;
+ }
+ if (deltaY < 0) {
+ // Shift viewport up, redraw top section
+ y1 = 0;
+ h = - deltaY;
+ } else {
+ // Shift viewport down, redraw bottom section
+ y1 = v.h - deltaY;
+ h = deltaY;
+ }
+
+ // Copy the valid part of the viewport to the shifted location
+ saveStyle = c_ctx.fillStyle;
+ c_ctx.fillStyle = "rgb(255,255,255)";
+ if (deltaX !== 0) {
+ //that.copyImage(0, 0, -deltaX, 0, v.w, v.h);
+ //that.fillRect(x1, 0, w, v.h, [255,255,255]);
+ c_ctx.drawImage(c, 0, 0, v.w, v.h, -deltaX, 0, v.w, v.h);
+ c_ctx.fillRect(x1, 0, w, v.h);
+ }
+ if (deltaY !== 0) {
+ //that.copyImage(0, 0, 0, -deltaY, v.w, v.h);
+ //that.fillRect(0, y1, v.w, h, [255,255,255]);
+ c_ctx.drawImage(c, 0, 0, v.w, v.h, 0, -deltaY, v.w, v.h);
+ c_ctx.fillRect(0, y1, v.w, h);
+ }
+ c_ctx.fillStyle = saveStyle;
+};
+
+
+// Return a map of clean and dirty areas of the viewport and reset the
+// tracking of clean and dirty areas.
+//
+// Returns: {'cleanBox': {'x': x, 'y': y, 'w': w, 'h': h},
+// 'dirtyBoxes': [{'x': x, 'y': y, 'w': w, 'h': h}, ...]}
+that.getCleanDirtyReset = function() {
+ var v = viewport, c = cleanRect, cleanBox, dirtyBoxes = [],
+ vx2 = v.x + v.w - 1, vy2 = v.y + v.h - 1;
+
+
+ // Copy the cleanRect
+ cleanBox = {'x': c.x1, 'y': c.y1,
+ 'w': c.x2 - c.x1 + 1, 'h': c.y2 - c.y1 + 1};
+
+ if ((c.x1 >= c.x2) || (c.y1 >= c.y2)) {
+ // Whole viewport is dirty
+ dirtyBoxes.push({'x': v.x, 'y': v.y, 'w': v.w, 'h': v.h});
+ } else {
+ // Redraw dirty regions
+ if (v.x < c.x1) {
+ // left side dirty region
+ dirtyBoxes.push({'x': v.x, 'y': v.y,
+ 'w': c.x1 - v.x + 1, 'h': v.h});
+ }
+ if (vx2 > c.x2) {
+ // right side dirty region
+ dirtyBoxes.push({'x': c.x2 + 1, 'y': v.y,
+ 'w': vx2 - c.x2, 'h': v.h});
+ }
+ if (v.y < c.y1) {
+ // top/middle dirty region
+ dirtyBoxes.push({'x': c.x1, 'y': v.y,
+ 'w': c.x2 - c.x1 + 1, 'h': c.y1 - v.y});
+ }
+ if (vy2 > c.y2) {
+ // bottom/middle dirty region
+ dirtyBoxes.push({'x': c.x1, 'y': c.y2 + 1,
+ 'w': c.x2 - c.x1 + 1, 'h': vy2 - c.y2});
+ }
+ }
+
+ // Reset the cleanRect to the whole viewport
+ cleanRect = {'x1': v.x, 'y1': v.y,
+ 'x2': v.x + v.w - 1, 'y2': v.y + v.h - 1};
+
+ return {'cleanBox': cleanBox, 'dirtyBoxes': dirtyBoxes};
+};
+
+// Translate viewport coordinates to absolute coordinates
+that.absX = function(x) {
+ return x + viewport.x;
+};
+that.absY = function(y) {
+ return y + viewport.y;
+};
+
+
+that.resize = function(width, height) {
+ c_prevStyle = "";
+
+ fb_width = width;
+ fb_height = height;
+
+ rescale(conf.scale);
+ that.viewportChange();
+};
+
+that.clear = function() {
+
+ if (conf.logo) {
+ that.resize(conf.logo.width, conf.logo.height);
+ that.blitStringImage(conf.logo.data, 0, 0);
+ } else {
+ that.resize(640, 20);
+ c_ctx.clearRect(0, 0, viewport.w, viewport.h);
+ }
+
+ renderQ = [];
+
+ // No benefit over default ("source-over") in Chrome and firefox
+ //c_ctx.globalCompositeOperation = "copy";
+};
+
+that.fillRect = function(x, y, width, height, color) {
+ setFillColor(color);
+ c_ctx.fillRect(x - viewport.x, y - viewport.y, width, height);
+};
+
+that.copyImage = function(old_x, old_y, new_x, new_y, w, h) {
+ var x1 = old_x - viewport.x, y1 = old_y - viewport.y,
+ x2 = new_x - viewport.x, y2 = new_y - viewport.y;
+ c_ctx.drawImage(conf.target, x1, y1, w, h, x2, y2, w, h);
+};
+
+
+// Start updating a tile
+that.startTile = function(x, y, width, height, color) {
+ var data, bgr, red, green, blue, i;
+ tile_x = x;
+ tile_y = y;
+ if ((width === 16) && (height === 16)) {
+ tile = tile16x16;
+ } else {
+ tile = c_ctx.createImageData(width, height);
+ }
+ data = tile.data;
+ if (conf.prefer_js) {
+ if (conf.true_color) {
+ bgr = color;
+ } else {
+ bgr = conf.colourMap[color[0]];
+ }
+ red = bgr[2];
+ green = bgr[1];
+ blue = bgr[0];
+ for (i = 0; i < (width * height * 4); i+=4) {
+ data[i ] = red;
+ data[i + 1] = green;
+ data[i + 2] = blue;
+ data[i + 3] = 255;
+ }
+ } else {
+ that.fillRect(x, y, width, height, color);
+ }
+};
+
+// Update sub-rectangle of the current tile
+that.subTile = function(x, y, w, h, color) {
+ var data, p, bgr, red, green, blue, width, j, i, xend, yend;
+ if (conf.prefer_js) {
+ data = tile.data;
+ width = tile.width;
+ if (conf.true_color) {
+ bgr = color;
+ } else {
+ bgr = conf.colourMap[color[0]];
+ }
+ red = bgr[2];
+ green = bgr[1];
+ blue = bgr[0];
+ xend = x + w;
+ yend = y + h;
+ for (j = y; j < yend; j += 1) {
+ for (i = x; i < xend; i += 1) {
+ p = (i + (j * width) ) * 4;
+ data[p ] = red;
+ data[p + 1] = green;
+ data[p + 2] = blue;
+ data[p + 3] = 255;
+ }
+ }
+ } else {
+ that.fillRect(tile_x + x, tile_y + y, w, h, color);
+ }
+};
+
+// Draw the current tile to the screen
+that.finishTile = function() {
+ if (conf.prefer_js) {
+ c_ctx.putImageData(tile, tile_x - viewport.x, tile_y - viewport.y);
+ }
+ // else: No-op, if not prefer_js then already done by setSubTile
+};
+
+rgbImageData = function(x, y, width, height, arr, offset) {
+ var img, i, j, data, v = viewport;
+ /*
+ if ((x - v.x >= v.w) || (y - v.y >= v.h) ||
+ (x - v.x + width < 0) || (y - v.y + height < 0)) {
+ // Skipping because outside of viewport
+ return;
+ }
+ */
+ img = c_ctx.createImageData(width, height);
+ data = img.data;
+ for (i=0, j=offset; i < (width * height * 4); i=i+4, j=j+3) {
+ data[i ] = arr[j ];
+ data[i + 1] = arr[j + 1];
+ data[i + 2] = arr[j + 2];
+ data[i + 3] = 255; // Set Alpha
+ }
+ c_ctx.putImageData(img, x - v.x, y - v.y);
+};
+
+bgrxImageData = function(x, y, width, height, arr, offset) {
+ var img, i, j, data, v = viewport;
+ /*
+ if ((x - v.x >= v.w) || (y - v.y >= v.h) ||
+ (x - v.x + width < 0) || (y - v.y + height < 0)) {
+ // Skipping because outside of viewport
+ return;
+ }
+ */
+ img = c_ctx.createImageData(width, height);
+ data = img.data;
+ for (i=0, j=offset; i < (width * height * 4); i=i+4, j=j+4) {
+ data[i ] = arr[j + 2];
+ data[i + 1] = arr[j + 1];
+ data[i + 2] = arr[j ];
+ data[i + 3] = 255; // Set Alpha
+ }
+ c_ctx.putImageData(img, x - v.x, y - v.y);
+};
+
+cmapImageData = function(x, y, width, height, arr, offset) {
+ var img, i, j, data, bgr, cmap;
+ img = c_ctx.createImageData(width, height);
+ data = img.data;
+ cmap = conf.colourMap;
+ for (i=0, j=offset; i < (width * height * 4); i+=4, j+=1) {
+ bgr = cmap[arr[j]];
+ data[i ] = bgr[2];
+ data[i + 1] = bgr[1];
+ data[i + 2] = bgr[0];
+ data[i + 3] = 255; // Set Alpha
+ }
+ c_ctx.putImageData(img, x - viewport.x, y - viewport.y);
+};
+
+that.blitImage = function(x, y, width, height, arr, offset) {
+ if (conf.true_color) {
+ bgrxImageData(x, y, width, height, arr, offset);
+ } else {
+ cmapImageData(x, y, width, height, arr, offset);
+ }
+};
+
+that.blitRgbImage = function(x, y, width, height, arr, offset) {
+ if (conf.true_color) {
+ rgbImageData(x, y, width, height, arr, offset);
+ } else {
+ // prolly wrong...
+ cmapImageData(x, y, width, height, arr, offset);
+ }
+};
+
+that.blitStringImage = function(str, x, y) {
+ var img = new Image();
+ img.onload = function () {
+ c_ctx.drawImage(img, x - viewport.x, y - viewport.y);
+ };
+ img.src = str;
+};
+
+// Wrap ctx.drawImage but relative to viewport
+that.drawImage = function(img, x, y) {
+ c_ctx.drawImage(img, x - viewport.x, y - viewport.y);
+};
+
+that.renderQ_push = function(action) {
+ renderQ.push(action);
+ if (renderQ.length === 1) {
+ // If this can be rendered immediately it will be, otherwise
+ // the scanner will start polling the queue (every
+ // requestAnimationFrame interval)
+ scan_renderQ();
+ }
+};
+
+scan_renderQ = function() {
+ var a, ready = true;
+ while (ready && renderQ.length > 0) {
+ a = renderQ[0];
+ switch (a.type) {
+ case 'copy':
+ that.copyImage(a.old_x, a.old_y, a.x, a.y, a.width, a.height);
+ break;
+ case 'fill':
+ that.fillRect(a.x, a.y, a.width, a.height, a.color);
+ break;
+ case 'blit':
+ that.blitImage(a.x, a.y, a.width, a.height, a.data, 0);
+ break;
+ case 'blitRgb':
+ that.blitRgbImage(a.x, a.y, a.width, a.height, a.data, 0);
+ break;
+ case 'img':
+ if (a.img.complete) {
+ that.drawImage(a.img, a.x, a.y);
+ } else {
+ // We need to wait for this image to 'load'
+ // to keep things in-order
+ ready = false;
+ }
+ break;
+ }
+ if (ready) {
+ a = renderQ.shift();
+ }
+ }
+ if (renderQ.length > 0) {
+ requestAnimFrame(scan_renderQ);
+ }
+};
+
+
+that.changeCursor = function(pixels, mask, hotx, hoty, w, h) {
+ if (conf.cursor_uri === false) {
+ Util.Warn("changeCursor called but no cursor data URI support");
+ return;
+ }
+
+ if (conf.true_color) {
+ changeCursor(conf.target, pixels, mask, hotx, hoty, w, h);
+ } else {
+ changeCursor(conf.target, pixels, mask, hotx, hoty, w, h, conf.colourMap);
+ }
+};
+
+that.defaultCursor = function() {
+ conf.target.style.cursor = "default";
+};
+
+return constructor(); // Return the public API interface
+
+} // End of Display()
+
+
+/* Set CSS cursor property using data URI encoded cursor file */
+function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
+ "use strict";
+ var cur = [], rgb, IHDRsz, RGBsz, ANDsz, XORsz, url, idx, alpha, x, y;
+ //Util.Debug(">> changeCursor, x: " + hotx + ", y: " + hoty + ", w: " + w + ", h: " + h);
+
+ // Push multi-byte little-endian values
+ cur.push16le = function (num) {
+ this.push((num ) & 0xFF,
+ (num >> 8) & 0xFF );
+ };
+ cur.push32le = function (num) {
+ this.push((num ) & 0xFF,
+ (num >> 8) & 0xFF,
+ (num >> 16) & 0xFF,
+ (num >> 24) & 0xFF );
+ };
+
+ IHDRsz = 40;
+ RGBsz = w * h * 4;
+ XORsz = Math.ceil( (w * h) / 8.0 );
+ ANDsz = Math.ceil( (w * h) / 8.0 );
+
+ // Main header
+ cur.push16le(0); // 0: Reserved
+ cur.push16le(2); // 2: .CUR type
+ cur.push16le(1); // 4: Number of images, 1 for non-animated ico
+
+ // Cursor #1 header (ICONDIRENTRY)
+ cur.push(w); // 6: width
+ cur.push(h); // 7: height
+ cur.push(0); // 8: colors, 0 -> true-color
+ cur.push(0); // 9: reserved
+ cur.push16le(hotx); // 10: hotspot x coordinate
+ cur.push16le(hoty); // 12: hotspot y coordinate
+ cur.push32le(IHDRsz + RGBsz + XORsz + ANDsz);
+ // 14: cursor data byte size
+ cur.push32le(22); // 18: offset of cursor data in the file
+
+
+ // Cursor #1 InfoHeader (ICONIMAGE/BITMAPINFO)
+ cur.push32le(IHDRsz); // 22: Infoheader size
+ cur.push32le(w); // 26: Cursor width
+ cur.push32le(h*2); // 30: XOR+AND height
+ cur.push16le(1); // 34: number of planes
+ cur.push16le(32); // 36: bits per pixel
+ cur.push32le(0); // 38: Type of compression
+
+ cur.push32le(XORsz + ANDsz); // 43: Size of Image
+ // Gimp leaves this as 0
+
+ cur.push32le(0); // 46: reserved
+ cur.push32le(0); // 50: reserved
+ cur.push32le(0); // 54: reserved
+ cur.push32le(0); // 58: reserved
+
+ // 62: color data (RGBQUAD icColors[])
+ for (y = h-1; y >= 0; y -= 1) {
+ for (x = 0; x < w; x += 1) {
+ idx = y * Math.ceil(w / 8) + Math.floor(x/8);
+ alpha = (mask[idx] << (x % 8)) & 0x80 ? 255 : 0;
+
+ if (cmap) {
+ idx = (w * y) + x;
+ rgb = cmap[pixels[idx]];
+ cur.push(rgb[2]); // blue
+ cur.push(rgb[1]); // green
+ cur.push(rgb[0]); // red
+ cur.push(alpha); // alpha
+ } else {
+ idx = ((w * y) + x) * 4;
+ cur.push(pixels[idx + 2]); // blue
+ cur.push(pixels[idx + 1]); // green
+ cur.push(pixels[idx ]); // red
+ cur.push(alpha); // alpha
+ }
+ }
+ }
+
+ // XOR/bitmask data (BYTE icXOR[])
+ // (ignored, just needs to be right size)
+ for (y = 0; y < h; y += 1) {
+ for (x = 0; x < Math.ceil(w / 8); x += 1) {
+ cur.push(0x00);
+ }
+ }
+
+ // AND/bitmask data (BYTE icAND[])
+ // (ignored, just needs to be right size)
+ for (y = 0; y < h; y += 1) {
+ for (x = 0; x < Math.ceil(w / 8); x += 1) {
+ cur.push(0x00);
+ }
+ }
+
+ url = "data:image/x-icon;base64," + Base64.encode(cur);
+ target.style.cursor = "url(" + url + ") " + hotx + " " + hoty + ", default";
+ //Util.Debug("<< changeCursor, cur.length: " + cur.length);
+}

diff --git a/noVNC/include/input.js b/noVNC/include/input.js
new file mode 100644
index 0000000..9298dfe
--- /dev/null
+++ b/noVNC/include/input.js
@@ -0,0 +1,1911 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2011 Joel Martin
+ * Licensed under LGPL-2 or any later version (see LICENSE.txt)
+ */
+
+/*jslint browser: true, white: false, bitwise: false */
+/*global window, Util */
+
+
+//
+// Keyboard event handler
+//
+
+function Keyboard(defaults) {
+"use strict";
+
+var that = {}, // Public API methods
+ conf = {}, // Configuration attributes
+
+ keyDownList = []; // List of depressed keys
+ // (even if they are happy)
+
+// Configuration attributes
+Util.conf_defaults(conf, that, defaults, [
+ ['target', 'wo', 'dom', document, 'DOM element that captures keyboard input'],
+ ['focused', 'rw', 'bool', true, 'Capture and send key events'],
+
+ ['onKeyPress', 'rw', 'func', null, 'Handler for key press/release']
+ ]);
+
+
+//
+// Private functions
+//
+
+// From the event keyCode return the keysym value for keys that need
+// to be suppressed otherwise they may trigger unintended browser
+// actions
+function getKeysymSpecial(evt) {
+ var keysym = null;
+
+ switch ( evt.keyCode ) {
+ // These generate a keyDown and keyPress in Firefox and Opera
+ case 8 : keysym = 0xFF08; break; // BACKSPACE
+ case 13 : keysym = 0xFF0D; break; // ENTER
+
+ // This generates a keyDown and keyPress in Opera
+ case 9 : keysym = 0xFF09; break; // TAB
+ default : break;
+ }
+
+ if (evt.type === 'keydown') {
+ switch ( evt.keyCode ) {
+ case 27 : keysym = 0xFF1B; break; // ESCAPE
+ case 46 : keysym = 0xFFFF; break; // DELETE
+
+ case 36 : keysym = 0xFF50; break; // HOME
+ case 35 : keysym = 0xFF57; break; // END
+ case 33 : keysym = 0xFF55; break; // PAGE_UP
+ case 34 : keysym = 0xFF56; break; // PAGE_DOWN
+ case 45 : keysym = 0xFF63; break; // INSERT
+ // '-' during keyPress
+ case 37 : keysym = 0xFF51; break; // LEFT
+ case 38 : keysym = 0xFF52; break; // UP
+ case 39 : keysym = 0xFF53; break; // RIGHT
+ case 40 : keysym = 0xFF54; break; // DOWN
+ case 16 : keysym = 0xFFE1; break; // SHIFT
+ case 17 : keysym = 0xFFE3; break; // CONTROL
+ //case 18 : keysym = 0xFFE7; break; // Left Meta (Mac Option)
+ case 18 : keysym = 0xFFE9; break; // Left ALT (Mac Command)
+
+ case 112 : keysym = 0xFFBE; break; // F1
+ case 113 : keysym = 0xFFBF; break; // F2
+ case 114 : keysym = 0xFFC0; break; // F3
+ case 115 : keysym = 0xFFC1; break; // F4
+ case 116 : keysym = 0xFFC2; break; // F5
+ case 117 : keysym = 0xFFC3; break; // F6
+ case 118 : keysym = 0xFFC4; break; // F7
+ case 119 : keysym = 0xFFC5; break; // F8
+ case 120 : keysym = 0xFFC6; break; // F9
+ case 121 : keysym = 0xFFC7; break; // F10
+ case 122 : keysym = 0xFFC8; break; // F11
+ case 123 : keysym = 0xFFC9; break; // F12
+
+ default : break;
+ }
+ }
+
+ if ((!keysym) && (evt.ctrlKey || evt.altKey)) {
+ if ((typeof(evt.which) !== "undefined") && (evt.which > 0)) {
+ keysym = evt.which;
+ } else {
+ // IE9 always
+ // Firefox and Opera when ctrl/alt + special
+ Util.Warn("which not set, using keyCode");
+ keysym = evt.keyCode;
+ }
+
+ /* Remap symbols */
+ switch (keysym) {
+ case 186 : keysym = 59; break; // ; (IE)
+ case 187 : keysym = 61; break; // = (IE)
+ case 188 : keysym = 44; break; // , (Mozilla, IE)
+ case 109 : // - (Mozilla, Opera)
+ if (Util.Engine.gecko || Util.Engine.presto) {
+ keysym = 45; }
+ break;
+ case 189 : keysym = 45; break; // - (IE)
+ case 190 : keysym = 46; break; // . (Mozilla, IE)
+ case 191 : keysym = 47; break; // / (Mozilla, IE)
+ case 192 : keysym = 96; break; // ` (Mozilla, IE)
+ case 219 : keysym = 91; break; // [ (Mozilla, IE)
+ case 220 : keysym = 92; break; // \ (Mozilla, IE)
+ case 221 : keysym = 93; break; // ] (Mozilla, IE)
+ case 222 : keysym = 39; break; // ' (Mozilla, IE)
+ }
+
+ /* Remap shifted and unshifted keys */
+ if (!!evt.shiftKey) {
+ switch (keysym) {
+ case 48 : keysym = 41 ; break; // ) (shifted 0)
+ case 49 : keysym = 33 ; break; // ! (shifted 1)
+ case 50 : keysym = 64 ; break; // @ (shifted 2)
+ case 51 : keysym = 35 ; break; // # (shifted 3)
+ case 52 : keysym = 36 ; break; // $ (shifted 4)
+ case 53 : keysym = 37 ; break; // % (shifted 5)
+ case 54 : keysym = 94 ; break; // ^ (shifted 6)
+ case 55 : keysym = 38 ; break; // & (shifted 7)
+ case 56 : keysym = 42 ; break; // * (shifted 8)
+ case 57 : keysym = 40 ; break; // ( (shifted 9)
+
+ case 59 : keysym = 58 ; break; // : (shifted `)
+ case 61 : keysym = 43 ; break; // + (shifted ;)
+ case 44 : keysym = 60 ; break; // < (shifted ,)
+ case 45 : keysym = 95 ; break; // _ (shifted -)
+ case 46 : keysym = 62 ; break; // > (shifted .)
+ case 47 : keysym = 63 ; break; // ? (shifted /)
+ case 96 : keysym = 126; break; // ~ (shifted `)
+ case 91 : keysym = 123; break; // { (shifted [)
+ case 92 : keysym = 124; break; // | (shifted \)
+ case 93 : keysym = 125; break; // } (shifted ])
+ case 39 : keysym = 34 ; break; // " (shifted ')
+ }
+ } else if ((keysym >= 65) && (keysym <=90)) {
+ /* Remap unshifted A-Z */
+ keysym += 32;
+ } else if (evt.keyLocation === 3) {
+ // numpad keys
+ switch (keysym) {
+ case 96 : keysym = 48; break; // 0
+ case 97 : keysym = 49; break; // 1
+ case 98 : keysym = 50; break; // 2
+ case 99 : keysym = 51; break; // 3
+ case 100: keysym = 52; break; // 4
+ case 101: keysym = 53; break; // 5
+ case 102: keysym = 54; break; // 6
+ case 103: keysym = 55; break; // 7
+ case 104: keysym = 56; break; // 8
+ case 105: keysym = 57; break; // 9
+ case 109: keysym = 45; break; // -
+ case 110: keysym = 46; break; // .
+ case 111: keysym = 47; break; // /
+ }
+ }
+ }
+
+ return keysym;
+}
+
+/* Translate DOM keyPress event to keysym value */
+function getKeysym(evt) {
+ var keysym, msg;
+
+ if (typeof(evt.which) !== "undefined") {
+ // WebKit, Firefox, Opera
+ keysym = evt.which;
+ } else {
+ // IE9
+ Util.Warn("which not set, using keyCode");
+ keysym = evt.keyCode;
+ }
+
+ if ((keysym > 255) && (keysym < 0xFF00)) {
+ msg = "Mapping character code " + keysym;
+ // Map Unicode outside Latin 1 to X11 keysyms
+ keysym = unicodeTable[keysym];
+ if (typeof(keysym) === 'undefined') {
+ keysym = 0;
+ }
+ Util.Debug(msg + " to " + keysym);
+ }
+
+ return keysym;
+}
+
+function show_keyDownList(kind) {
+ var c;
+ var msg = "keyDownList (" + kind + "):\n";
+ for (c = 0; c < keyDownList.length; c++) {
+ msg = msg + " " + c + " - keyCode: " + keyDownList[c].keyCode +
+ " - which: " + keyDownList[c].which + "\n";
+ }
+ Util.Debug(msg);
+}
+
+function copyKeyEvent(evt) {
+ var members = ['type', 'keyCode', 'charCode', 'which',
+ 'altKey', 'ctrlKey', 'shiftKey',
+ 'keyLocation', 'keyIdentifier'], i, obj = {};
+ for (i = 0; i < members.length; i++) {
+ if (typeof(evt[members[i]]) !== "undefined") {
+ obj[members[i]] = evt[members[i]];
+ }
+ }
+ return obj;
+}
+
+function pushKeyEvent(fevt) {
+ keyDownList.push(fevt);
+}
+
+function getKeyEvent(keyCode, pop) {
+ var i, fevt = null;
+ for (i = keyDownList.length-1; i >= 0; i--) {
+ if (keyDownList[i].keyCode === keyCode) {
+ if ((typeof(pop) !== "undefined") && (pop)) {
+ fevt = keyDownList.splice(i, 1)[0];
+ } else {
+ fevt = keyDownList[i];
+ }
+ break;
+ }
+ }
+ return fevt;
+}
+
+function ignoreKeyEvent(evt) {
+ // Blarg. Some keys have a different keyCode on keyDown vs keyUp
+ if (evt.keyCode === 229) {
+ // French AZERTY keyboard dead key.
+ // Lame thing is that the respective keyUp is 219 so we can't
+ // properly ignore the keyUp event
+ return true;
+ }
+ return false;
+}
+
+
+//
+// Key Event Handling:
+//
+// There are several challenges when dealing with key events:
+// - The meaning and use of keyCode, charCode and which depends on
+// both the browser and the event type (keyDown/Up vs keyPress).
+// - We cannot automatically determine the keyboard layout
+// - The keyDown and keyUp events have a keyCode value that has not
+// been translated by modifier keys.
+// - The keyPress event has a translated (for layout and modifiers)
+// character code but the attribute containing it differs. keyCode
+// contains the translated value in WebKit (Chrome/Safari), Opera
+// 11 and IE9. charCode contains the value in WebKit and Firefox.
+// The which attribute contains the value on WebKit, Firefox and
+// Opera 11.
+// - The keyDown/Up keyCode value indicates (sort of) the physical
+// key was pressed but only for standard US layout. On a US
+// keyboard, the '-' and '_' characters are on the same key and
+// generate a keyCode value of 189. But on an AZERTY keyboard even
+// though they are different physical keys they both still
+// generate a keyCode of 189!
+// - To prevent a key event from propagating to the browser and
+// causing unwanted default actions (such as closing a tab,
+// opening a menu, shifting focus, etc) we must suppress this
+// event in both keyDown and keyPress because not all key strokes
+// generate on a keyPress event. Also, in WebKit and IE9
+// suppressing the keyDown prevents a keyPress but other browsers
+// still generated a keyPress even if keyDown is suppressed.
+//
+// For safe key events, we wait until the keyPress event before
+// reporting a key down event. For unsafe key events, we report a key
+// down event when the keyDown event fires and we suppress any further
+// actions (including keyPress).
+//
+// In order to report a key up event that matches what we reported
+// for the key down event, we keep a list of keys that are currently
+// down. When the keyDown event happens, we add the key event to the
+// list. If it is a safe key event, then we update the which attribute
+// in the most recent item on the list when we received a keyPress
+// event (keyPress should immediately follow keyDown). When we
+// received a keyUp event we search for the event on the list with
+// a matching keyCode and we report the character code using the value
+// in the 'which' attribute that was stored with that key.
+//
+
+function onKeyDown(e) {
+ if (! conf.focused) {
+ return true;
+ }
+ var fevt = null, evt = (e ? e : window.event),
+ keysym = null, suppress = false;
+ //Util.Debug("onKeyDown kC:" + evt.keyCode + " cC:" + evt.charCode + " w:" + evt.which);
+
+ fevt = copyKeyEvent(evt);
+
+ keysym = getKeysymSpecial(evt);
+ // Save keysym decoding for use in keyUp
+ fevt.keysym = keysym;
+ if (keysym) {
+ // If it is a key or key combination that might trigger
+ // browser behaviors or it has no corresponding keyPress
+ // event, then send it immediately
+ if (conf.onKeyPress && !ignoreKeyEvent(evt)) {
+ Util.Debug("onKeyPress down, keysym: " + keysym +
+ " (onKeyDown key: " + evt.keyCode +
+ ", which: " + evt.which + ")");
+ conf.onKeyPress(keysym, 1, evt);
+ }
+ suppress = true;
+ }
+
+ if (! ignoreKeyEvent(evt)) {
+ // Add it to the list of depressed keys
+ pushKeyEvent(fevt);
+ //show_keyDownList('down');
+ }
+
+ if (suppress) {
+ // Suppress bubbling/default actions
+ Util.stopEvent(e);
+ return false;
+ } else {
+ // Allow the event to bubble and become a keyPress event which
+ // will have the character code translated
+ return true;
+ }
+}
+
+function onKeyPress(e) {
+ if (! conf.focused) {
+ return true;
+ }
+ var evt = (e ? e : window.event),
+ kdlen = keyDownList.length, keysym = null;
+ //Util.Debug("onKeyPress kC:" + evt.keyCode + " cC:" + evt.charCode + " w:" + evt.which);
+
+ if (((evt.which !== "undefined") && (evt.which === 0)) ||
+ (getKeysymSpecial(evt))) {
+ // Firefox and Opera generate a keyPress event even if keyDown
+ // is suppressed. But the keys we want to suppress will have
+ // either:
+ // - the which attribute set to 0
+ // - getKeysymSpecial() will identify it
+ Util.Debug("Ignoring special key in keyPress");
+ Util.stopEvent(e);
+ return false;
+ }
+
+ keysym = getKeysym(evt);
+
+ // Modify the the which attribute in the depressed keys list so
+ // that the keyUp event will be able to have the character code
+ // translation available.
+ if (kdlen > 0) {
+ keyDownList[kdlen-1].keysym = keysym;
+ } else {
+ Util.Warn("keyDownList empty when keyPress triggered");
+ }
+
+ //show_keyDownList('press');
+
+ // Send the translated keysym
+ if (conf.onKeyPress && (keysym > 0)) {
+ Util.Debug("onKeyPress down, keysym: " + keysym +
+ " (onKeyPress key: " + evt.keyCode +
+ ", which: " + evt.which + ")");
+ conf.onKeyPress(keysym, 1, evt);
+ }
+
+ // Stop keypress events just in case
+ Util.stopEvent(e);
+ return false;
+}
+
+function onKeyUp(e) {
+ if (! conf.focused) {
+ return true;
+ }
+ var fevt = null, evt = (e ? e : window.event), keysym;
+ //Util.Debug("onKeyUp kC:" + evt.keyCode + " cC:" + evt.charCode + " w:" + evt.which);
+
+ fevt = getKeyEvent(evt.keyCode, true);
+
+ if (fevt) {
+ keysym = fevt.keysym;
+ } else {
+ Util.Warn("Key event (keyCode = " + evt.keyCode +
+ ") not found on keyDownList");
+ keysym = 0;
+ }
+
+ //show_keyDownList('up');
+
+ if (conf.onKeyPress && (keysym > 0)) {
+ //Util.Debug("keyPress up, keysym: " + keysym +
+ // " (key: " + evt.keyCode + ", which: " + evt.which + ")");
+ Util.Debug("onKeyPress up, keysym: " + keysym +
+ " (onKeyPress key: " + evt.keyCode +
+ ", which: " + evt.which + ")");
+ conf.onKeyPress(keysym, 0, evt);
+ }
+ Util.stopEvent(e);
+ return false;
+}
+
+function allKeysUp() {
+ Util.Debug(">> Keyboard.allKeysUp");
+ if (keyDownList.length > 0) {
+ Util.Info("Releasing pressed/down keys");
+ }
+ var i, keysym, fevt = null;
+ for (i = keyDownList.length-1; i >= 0; i--) {
+ fevt = keyDownList.splice(i, 1)[0];
+ keysym = fevt.keysym;
+ if (conf.onKeyPress && (keysym > 0)) {
+ Util.Debug("allKeysUp, keysym: " + keysym +
+ " (keyCode: " + fevt.keyCode +
+ ", which: " + fevt.which + ")");
+ conf.onKeyPress(keysym, 0, fevt);
+ }
+ }
+ Util.Debug("<< Keyboard.allKeysUp");
+ return;
+}
+
+//
+// Public API interface functions
+//
+
+that.grab = function() {
+ //Util.Debug(">> Keyboard.grab");
+ var c = conf.target;
+
+ Util.addEvent(c, 'keydown', onKeyDown);
+ Util.addEvent(c, 'keyup', onKeyUp);
+ Util.addEvent(c, 'keypress', onKeyPress);
+
+ // Release (key up) if window loses focus
+ Util.addEvent(window, 'blur', allKeysUp);
+
+ //Util.Debug("<< Keyboard.grab");
+};
+
+that.ungrab = function() {
+ //Util.Debug(">> Keyboard.ungrab");
+ var c = conf.target;
+
+ Util.removeEvent(c, 'keydown', onKeyDown);
+ Util.removeEvent(c, 'keyup', onKeyUp);
+ Util.removeEvent(c, 'keypress', onKeyPress);
+ Util.removeEvent(window, 'blur', allKeysUp);
+
+ // Release (key up) all keys that are in a down state
+ allKeysUp();
+
+ //Util.Debug(">> Keyboard.ungrab");
+};
+
+return that; // Return the public API interface
+
+} // End of Keyboard()
+
+
+//
+// Mouse event handler
+//
+
+function Mouse(defaults) {
+"use strict";
+
+var that = {}, // Public API methods
+ conf = {}; // Configuration attributes
+
+// Configuration attributes
+Util.conf_defaults(conf, that, defaults, [
+ ['target', 'ro', 'dom', document, 'DOM element that captures mouse input'],
+ ['focused', 'rw', 'bool', true, 'Capture and send mouse clicks/movement'],
+ ['scale', 'rw', 'float', 1.0, 'Viewport scale factor 0.0 - 1.0'],
+
+ ['onMouseButton', 'rw', 'func', null, 'Handler for mouse button click/release'],
+ ['onMouseMove', 'rw', 'func', null, 'Handler for mouse movement'],
+ ['touchButton', 'rw', 'int', 1, 'Button mask (1, 2, 4) for touch devices (0 means ignore clicks)']
+ ]);
+
+
+//
+// Private functions
+//
+
+function onMouseButton(e, down) {
+ var evt, pos, bmask;
+ if (! conf.focused) {
+ return true;
+ }
+ evt = (e ? e : window.event);
+ pos = Util.getEventPosition(e, conf.target, conf.scale);
+ if (e.touches || e.changedTouches) {
+ // Touch device
+ bmask = conf.touchButton;
+ // If bmask is set
+ } else if (evt.which) {
+ /* everything except IE */
+ bmask = 1 << evt.button;
+ } else {
+ /* IE including 9 */
+ bmask = (evt.button & 0x1) + // Left
+ (evt.button & 0x2) * 2 + // Right
+ (evt.button & 0x4) / 2; // Middle
+ }
+ //Util.Debug("mouse " + pos.x + "," + pos.y + " down: " + down +
+ // " bmask: " + bmask + "(evt.button: " + evt.button + ")");
+ if (bmask > 0 && conf.onMouseButton) {
+ Util.Debug("onMouseButton " + (down ? "down" : "up") +
+ ", x: " + pos.x + ", y: " + pos.y + ", bmask: " + bmask);
+ conf.onMouseButton(pos.x, pos.y, down, bmask);
+ }
+ Util.stopEvent(e);
+ return false;
+}
+
+function onMouseDown(e) {
+ onMouseButton(e, 1);
+}
+
+function onMouseUp(e) {
+ onMouseButton(e, 0);
+}
+
+function onMouseWheel(e) {
+ var evt, pos, bmask, wheelData;
+ if (! conf.focused) {
+ return true;
+ }
+ evt = (e ? e : window.event);
+ pos = Util.getEventPosition(e, conf.target, conf.scale);
+ wheelData = evt.detail ? evt.detail * -1 : evt.wheelDelta / 40;
+ if (wheelData > 0) {
+ bmask = 1 << 3;
+ } else {
+ bmask = 1 << 4;
+ }
+ //Util.Debug('mouse scroll by ' + wheelData + ':' + pos.x + "," + pos.y);
+ if (conf.onMouseButton) {
+ conf.onMouseButton(pos.x, pos.y, 1, bmask);
+ conf.onMouseButton(pos.x, pos.y, 0, bmask);
+ }
+ Util.stopEvent(e);
+ return false;
+}
+
+function onMouseMove(e) {
+ var evt, pos;
+ if (! conf.focused) {
+ return true;
+ }
+ evt = (e ? e : window.event);
+ pos = Util.getEventPosition(e, conf.target, conf.scale);
+ //Util.Debug('mouse ' + evt.which + '/' + evt.button + ' up:' + pos.x + "," + pos.y);
+ if (conf.onMouseMove) {
+ conf.onMouseMove(pos.x, pos.y);
+ }
+ Util.stopEvent(e);
+ return false;
+}
+
+function onMouseDisable(e) {
+ var evt, pos;
+ if (! conf.focused) {
+ return true;
+ }
+ evt = (e ? e : window.event);
+ pos = Util.getEventPosition(e, conf.target, conf.scale);
+ /* Stop propagation if inside canvas area */
+ if ((pos.x >= 0) && (pos.y >= 0) &&
+ (pos.x < conf.target.offsetWidth) &&
+ (pos.y < conf.target.offsetHeight)) {
+ //Util.Debug("mouse event disabled");
+ Util.stopEvent(e);
+ return false;
+ }
+ //Util.Debug("mouse event not disabled");
+ return true;
+}
+
+//
+// Public API interface functions
+//
+
+that.grab = function() {
+ //Util.Debug(">> Mouse.grab");
+ var c = conf.target;
+
+ if ('ontouchstart' in document.documentElement) {
+ Util.addEvent(c, 'touchstart', onMouseDown);
+ Util.addEvent(c, 'touchend', onMouseUp);
+ Util.addEvent(c, 'touchmove', onMouseMove);
+ } else {
+ Util.addEvent(c, 'mousedown', onMouseDown);
+ Util.addEvent(c, 'mouseup', onMouseUp);
+ Util.addEvent(c, 'mousemove', onMouseMove);
+ Util.addEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
+ onMouseWheel);
+ }
+
+ /* Work around right and middle click browser behaviors */
+ Util.addEvent(document, 'click', onMouseDisable);
+ Util.addEvent(document.body, 'contextmenu', onMouseDisable);
+
+ //Util.Debug("<< Mouse.grab");
+};
+
+that.ungrab = function() {
+ //Util.Debug(">> Mouse.ungrab");
+ var c = conf.target;
+
+ if ('ontouchstart' in document.documentElement) {
+ Util.removeEvent(c, 'touchstart', onMouseDown);
+ Util.removeEvent(c, 'touchend', onMouseUp);
+ Util.removeEvent(c, 'touchmove', onMouseMove);
+ } else {
+ Util.removeEvent(c, 'mousedown', onMouseDown);
+ Util.removeEvent(c, 'mouseup', onMouseUp);
+ Util.removeEvent(c, 'mousemove', onMouseMove);
+ Util.removeEvent(c, (Util.Engine.gecko) ? 'DOMMouseScroll' : 'mousewheel',
+ onMouseWheel);
+ }
+
+ /* Work around right and middle click browser behaviors */
+ Util.removeEvent(document, 'click', onMouseDisable);
+ Util.removeEvent(document.body, 'contextmenu', onMouseDisable);
+
+ //Util.Debug(">> Mouse.ungrab");
+};
+
+return that; // Return the public API interface
+
+} // End of Mouse()
+
+
+/*
+ * Browser keypress to X11 keysym for Unicode characters > U+00FF
+ */
+unicodeTable = {
+ 0x0104 : 0x01a1,
+ 0x02D8 : 0x01a2,
+ 0x0141 : 0x01a3,
+ 0x013D : 0x01a5,
+ 0x015A : 0x01a6,
+ 0x0160 : 0x01a9,
+ 0x015E : 0x01aa,
+ 0x0164 : 0x01ab,
+ 0x0179 : 0x01ac,
+ 0x017D : 0x01ae,
+ 0x017B : 0x01af,
+ 0x0105 : 0x01b1,
+ 0x02DB : 0x01b2,
+ 0x0142 : 0x01b3,
+ 0x013E : 0x01b5,
+ 0x015B : 0x01b6,
+ 0x02C7 : 0x01b7,
+ 0x0161 : 0x01b9,
+ 0x015F : 0x01ba,
+ 0x0165 : 0x01bb,
+ 0x017A : 0x01bc,
+ 0x02DD : 0x01bd,
+ 0x017E : 0x01be,
+ 0x017C : 0x01bf,
+ 0x0154 : 0x01c0,
+ 0x0102 : 0x01c3,
+ 0x0139 : 0x01c5,
+ 0x0106 : 0x01c6,
+ 0x010C : 0x01c8,
+ 0x0118 : 0x01ca,
+ 0x011A : 0x01cc,
+ 0x010E : 0x01cf,
+ 0x0110 : 0x01d0,
+ 0x0143 : 0x01d1,
+ 0x0147 : 0x01d2,
+ 0x0150 : 0x01d5,
+ 0x0158 : 0x01d8,
+ 0x016E : 0x01d9,
+ 0x0170 : 0x01db,
+ 0x0162 : 0x01de,
+ 0x0155 : 0x01e0,
+ 0x0103 : 0x01e3,
+ 0x013A : 0x01e5,
+ 0x0107 : 0x01e6,
+ 0x010D : 0x01e8,
+ 0x0119 : 0x01ea,
+ 0x011B : 0x01ec,
+ 0x010F : 0x01ef,
+ 0x0111 : 0x01f0,
+ 0x0144 : 0x01f1,
+ 0x0148 : 0x01f2,
+ 0x0151 : 0x01f5,
+ 0x0171 : 0x01fb,
+ 0x0159 : 0x01f8,
+ 0x016F : 0x01f9,
+ 0x0163 : 0x01fe,
+ 0x02D9 : 0x01ff,
+ 0x0126 : 0x02a1,
+ 0x0124 : 0x02a6,
+ 0x0130 : 0x02a9,
+ 0x011E : 0x02ab,
+ 0x0134 : 0x02ac,
+ 0x0127 : 0x02b1,
+ 0x0125 : 0x02b6,
+ 0x0131 : 0x02b9,
+ 0x011F : 0x02bb,
+ 0x0135 : 0x02bc,
+ 0x010A : 0x02c5,
+ 0x0108 : 0x02c6,
+ 0x0120 : 0x02d5,
+ 0x011C : 0x02d8,
+ 0x016C : 0x02dd,
+ 0x015C : 0x02de,
+ 0x010B : 0x02e5,
+ 0x0109 : 0x02e6,
+ 0x0121 : 0x02f5,
+ 0x011D : 0x02f8,
+ 0x016D : 0x02fd,
+ 0x015D : 0x02fe,
+ 0x0138 : 0x03a2,
+ 0x0156 : 0x03a3,
+ 0x0128 : 0x03a5,
+ 0x013B : 0x03a6,
+ 0x0112 : 0x03aa,
+ 0x0122 : 0x03ab,
+ 0x0166 : 0x03ac,
+ 0x0157 : 0x03b3,
+ 0x0129 : 0x03b5,
+ 0x013C : 0x03b6,
+ 0x0113 : 0x03ba,
+ 0x0123 : 0x03bb,
+ 0x0167 : 0x03bc,
+ 0x014A : 0x03bd,
+ 0x014B : 0x03bf,
+ 0x0100 : 0x03c0,
+ 0x012E : 0x03c7,
+ 0x0116 : 0x03cc,
+ 0x012A : 0x03cf,
+ 0x0145 : 0x03d1,
+ 0x014C : 0x03d2,
+ 0x0136 : 0x03d3,
+ 0x0172 : 0x03d9,
+ 0x0168 : 0x03dd,
+ 0x016A : 0x03de,
+ 0x0101 : 0x03e0,
+ 0x012F : 0x03e7,
+ 0x0117 : 0x03ec,
+ 0x012B : 0x03ef,
+ 0x0146 : 0x03f1,
+ 0x014D : 0x03f2,
+ 0x0137 : 0x03f3,
+ 0x0173 : 0x03f9,
+ 0x0169 : 0x03fd,
+ 0x016B : 0x03fe,
+ 0x1E02 : 0x1001e02,
+ 0x1E03 : 0x1001e03,
+ 0x1E0A : 0x1001e0a,
+ 0x1E80 : 0x1001e80,
+ 0x1E82 : 0x1001e82,
+ 0x1E0B : 0x1001e0b,
+ 0x1EF2 : 0x1001ef2,
+ 0x1E1E : 0x1001e1e,
+ 0x1E1F : 0x1001e1f,
+ 0x1E40 : 0x1001e40,
+ 0x1E41 : 0x1001e41,
+ 0x1E56 : 0x1001e56,
+ 0x1E81 : 0x1001e81,
+ 0x1E57 : 0x1001e57,
+ 0x1E83 : 0x1001e83,
+ 0x1E60 : 0x1001e60,
+ 0x1EF3 : 0x1001ef3,
+ 0x1E84 : 0x1001e84,
+ 0x1E85 : 0x1001e85,
+ 0x1E61 : 0x1001e61,
+ 0x0174 : 0x1000174,
+ 0x1E6A : 0x1001e6a,
+ 0x0176 : 0x1000176,
+ 0x0175 : 0x1000175,
+ 0x1E6B : 0x1001e6b,
+ 0x0177 : 0x1000177,
+ 0x0152 : 0x13bc,
+ 0x0153 : 0x13bd,
+ 0x0178 : 0x13be,
+ 0x203E : 0x047e,
+ 0x3002 : 0x04a1,
+ 0x300C : 0x04a2,
+ 0x300D : 0x04a3,
+ 0x3001 : 0x04a4,
+ 0x30FB : 0x04a5,
+ 0x30F2 : 0x04a6,
+ 0x30A1 : 0x04a7,
+ 0x30A3 : 0x04a8,
+ 0x30A5 : 0x04a9,
+ 0x30A7 : 0x04aa,
+ 0x30A9 : 0x04ab,
+ 0x30E3 : 0x04ac,
+ 0x30E5 : 0x04ad,
+ 0x30E7 : 0x04ae,
+ 0x30C3 : 0x04af,
+ 0x30FC : 0x04b0,
+ 0x30A2 : 0x04b1,
+ 0x30A4 : 0x04b2,
+ 0x30A6 : 0x04b3,
+ 0x30A8 : 0x04b4,
+ 0x30AA : 0x04b5,
+ 0x30AB : 0x04b6,
+ 0x30AD : 0x04b7,
+ 0x30AF : 0x04b8,
+ 0x30B1 : 0x04b9,
+ 0x30B3 : 0x04ba,
+ 0x30B5 : 0x04bb,
+ 0x30B7 : 0x04bc,
+ 0x30B9 : 0x04bd,
+ 0x30BB : 0x04be,
+ 0x30BD : 0x04bf,
+ 0x30BF : 0x04c0,
+ 0x30C1 : 0x04c1,
+ 0x30C4 : 0x04c2,
+ 0x30C6 : 0x04c3,
+ 0x30C8 : 0x04c4,
+ 0x30CA : 0x04c5,
+ 0x30CB : 0x04c6,
+ 0x30CC : 0x04c7,
+ 0x30CD : 0x04c8,
+ 0x30CE : 0x04c9,
+ 0x30CF : 0x04ca,
+ 0x30D2 : 0x04cb,
+ 0x30D5 : 0x04cc,
+ 0x30D8 : 0x04cd,
+ 0x30DB : 0x04ce,
+ 0x30DE : 0x04cf,
+ 0x30DF : 0x04d0,
+ 0x30E0 : 0x04d1,
+ 0x30E1 : 0x04d2,
+ 0x30E2 : 0x04d3,
+ 0x30E4 : 0x04d4,
+ 0x30E6 : 0x04d5,
+ 0x30E8 : 0x04d6,
+ 0x30E9 : 0x04d7,
+ 0x30EA : 0x04d8,
+ 0x30EB : 0x04d9,
+ 0x30EC : 0x04da,
+ 0x30ED : 0x04db,
+ 0x30EF : 0x04dc,
+ 0x30F3 : 0x04dd,
+ 0x309B : 0x04de,
+ 0x309C : 0x04df,
+ 0x06F0 : 0x10006f0,
+ 0x06F1 : 0x10006f1,
+ 0x06F2 : 0x10006f2,
+ 0x06F3 : 0x10006f3,
+ 0x06F4 : 0x10006f4,
+ 0x06F5 : 0x10006f5,
+ 0x06F6 : 0x10006f6,
+ 0x06F7 : 0x10006f7,
+ 0x06F8 : 0x10006f8,
+ 0x06F9 : 0x10006f9,
+ 0x066A : 0x100066a,
+ 0x0670 : 0x1000670,
+ 0x0679 : 0x1000679,
+ 0x067E : 0x100067e,
+ 0x0686 : 0x1000686,
+ 0x0688 : 0x1000688,
+ 0x0691 : 0x1000691,
+ 0x060C : 0x05ac,
+ 0x06D4 : 0x10006d4,
+ 0x0660 : 0x1000660,
+ 0x0661 : 0x1000661,
+ 0x0662 : 0x1000662,
+ 0x0663 : 0x1000663,
+ 0x0664 : 0x1000664,
+ 0x0665 : 0x1000665,
+ 0x0666 : 0x1000666,
+ 0x0667 : 0x1000667,
+ 0x0668 : 0x1000668,
+ 0x0669 : 0x1000669,
+ 0x061B : 0x05bb,
+ 0x061F : 0x05bf,
+ 0x0621 : 0x05c1,
+ 0x0622 : 0x05c2,
+ 0x0623 : 0x05c3,
+ 0x0624 : 0x05c4,
+ 0x0625 : 0x05c5,
+ 0x0626 : 0x05c6,
+ 0x0627 : 0x05c7,
+ 0x0628 : 0x05c8,
+ 0x0629 : 0x05c9,
+ 0x062A : 0x05ca,
+ 0x062B : 0x05cb,
+ 0x062C : 0x05cc,
+ 0x062D : 0x05cd,
+ 0x062E : 0x05ce,
+ 0x062F : 0x05cf,
+ 0x0630 : 0x05d0,
+ 0x0631 : 0x05d1,
+ 0x0632 : 0x05d2,
+ 0x0633 : 0x05d3,
+ 0x0634 : 0x05d4,
+ 0x0635 : 0x05d5,
+ 0x0636 : 0x05d6,
+ 0x0637 : 0x05d7,
+ 0x0638 : 0x05d8,
+ 0x0639 : 0x05d9,
+ 0x063A : 0x05da,
+ 0x0640 : 0x05e0,
+ 0x0641 : 0x05e1,
+ 0x0642 : 0x05e2,
+ 0x0643 : 0x05e3,
+ 0x0644 : 0x05e4,
+ 0x0645 : 0x05e5,
+ 0x0646 : 0x05e6,
+ 0x0647 : 0x05e7,
+ 0x0648 : 0x05e8,
+ 0x0649 : 0x05e9,
+ 0x064A : 0x05ea,
+ 0x064B : 0x05eb,
+ 0x064C : 0x05ec,
+ 0x064D : 0x05ed,
+ 0x064E : 0x05ee,
+ 0x064F : 0x05ef,
+ 0x0650 : 0x05f0,
+ 0x0651 : 0x05f1,
+ 0x0652 : 0x05f2,
+ 0x0653 : 0x1000653,
+ 0x0654 : 0x1000654,
+ 0x0655 : 0x1000655,
+ 0x0698 : 0x1000698,
+ 0x06A4 : 0x10006a4,
+ 0x06A9 : 0x10006a9,
+ 0x06AF : 0x10006af,
+ 0x06BA : 0x10006ba,
+ 0x06BE : 0x10006be,
+ 0x06CC : 0x10006cc,
+ 0x06D2 : 0x10006d2,
+ 0x06C1 : 0x10006c1,
+ 0x0492 : 0x1000492,
+ 0x0493 : 0x1000493,
+ 0x0496 : 0x1000496,
+ 0x0497 : 0x1000497,
+ 0x049A : 0x100049a,
+ 0x049B : 0x100049b,
+ 0x049C : 0x100049c,
+ 0x049D : 0x100049d,
+ 0x04A2 : 0x10004a2,
+ 0x04A3 : 0x10004a3,
+ 0x04AE : 0x10004ae,
+ 0x04AF : 0x10004af,
+ 0x04B0 : 0x10004b0,
+ 0x04B1 : 0x10004b1,
+ 0x04B2 : 0x10004b2,
+ 0x04B3 : 0x10004b3,
+ 0x04B6 : 0x10004b6,
+ 0x04B7 : 0x10004b7,
+ 0x04B8 : 0x10004b8,
+ 0x04B9 : 0x10004b9,
+ 0x04BA : 0x10004ba,
+ 0x04BB : 0x10004bb,
+ 0x04D8 : 0x10004d8,
+ 0x04D9 : 0x10004d9,
+ 0x04E2 : 0x10004e2,
+ 0x04E3 : 0x10004e3,
+ 0x04E8 : 0x10004e8,
+ 0x04E9 : 0x10004e9,
+ 0x04EE : 0x10004ee,
+ 0x04EF : 0x10004ef,
+ 0x0452 : 0x06a1,
+ 0x0453 : 0x06a2,
+ 0x0451 : 0x06a3,
+ 0x0454 : 0x06a4,
+ 0x0455 : 0x06a5,
+ 0x0456 : 0x06a6,
+ 0x0457 : 0x06a7,
+ 0x0458 : 0x06a8,
+ 0x0459 : 0x06a9,
+ 0x045A : 0x06aa,
+ 0x045B : 0x06ab,
+ 0x045C : 0x06ac,
+ 0x0491 : 0x06ad,
+ 0x045E : 0x06ae,
+ 0x045F : 0x06af,
+ 0x2116 : 0x06b0,
+ 0x0402 : 0x06b1,
+ 0x0403 : 0x06b2,
+ 0x0401 : 0x06b3,
+ 0x0404 : 0x06b4,
+ 0x0405 : 0x06b5,
+ 0x0406 : 0x06b6,
+ 0x0407 : 0x06b7,
+ 0x0408 : 0x06b8,
+ 0x0409 : 0x06b9,
+ 0x040A : 0x06ba,
+ 0x040B : 0x06bb,
+ 0x040C : 0x06bc,
+ 0x0490 : 0x06bd,
+ 0x040E : 0x06be,
+ 0x040F : 0x06bf,
+ 0x044E : 0x06c0,
+ 0x0430 : 0x06c1,
+ 0x0431 : 0x06c2,
+ 0x0446 : 0x06c3,
+ 0x0434 : 0x06c4,
+ 0x0435 : 0x06c5,
+ 0x0444 : 0x06c6,
+ 0x0433 : 0x06c7,
+ 0x0445 : 0x06c8,
+ 0x0438 : 0x06c9,
+ 0x0439 : 0x06ca,
+ 0x043A : 0x06cb,
+ 0x043B : 0x06cc,
+ 0x043C : 0x06cd,
+ 0x043D : 0x06ce,
+ 0x043E : 0x06cf,
+ 0x043F : 0x06d0,
+ 0x044F : 0x06d1,
+ 0x0440 : 0x06d2,
+ 0x0441 : 0x06d3,
+ 0x0442 : 0x06d4,
+ 0x0443 : 0x06d5,
+ 0x0436 : 0x06d6,
+ 0x0432 : 0x06d7,
+ 0x044C : 0x06d8,
+ 0x044B : 0x06d9,
+ 0x0437 : 0x06da,
+ 0x0448 : 0x06db,
+ 0x044D : 0x06dc,
+ 0x0449 : 0x06dd,
+ 0x0447 : 0x06de,
+ 0x044A : 0x06df,
+ 0x042E : 0x06e0,
+ 0x0410 : 0x06e1,
+ 0x0411 : 0x06e2,
+ 0x0426 : 0x06e3,
+ 0x0414 : 0x06e4,
+ 0x0415 : 0x06e5,
+ 0x0424 : 0x06e6,
+ 0x0413 : 0x06e7,
+ 0x0425 : 0x06e8,
+ 0x0418 : 0x06e9,
+ 0x0419 : 0x06ea,
+ 0x041A : 0x06eb,
+ 0x041B : 0x06ec,
+ 0x041C : 0x06ed,
+ 0x041D : 0x06ee,
+ 0x041E : 0x06ef,
+ 0x041F : 0x06f0,
+ 0x042F : 0x06f1,
+ 0x0420 : 0x06f2,
+ 0x0421 : 0x06f3,
+ 0x0422 : 0x06f4,
+ 0x0423 : 0x06f5,
+ 0x0416 : 0x06f6,
+ 0x0412 : 0x06f7,
+ 0x042C : 0x06f8,
+ 0x042B : 0x06f9,
+ 0x0417 : 0x06fa,
+ 0x0428 : 0x06fb,
+ 0x042D : 0x06fc,
+ 0x0429 : 0x06fd,
+ 0x0427 : 0x06fe,
+ 0x042A : 0x06ff,
+ 0x0386 : 0x07a1,
+ 0x0388 : 0x07a2,
+ 0x0389 : 0x07a3,
+ 0x038A : 0x07a4,
+ 0x03AA : 0x07a5,
+ 0x038C : 0x07a7,
+ 0x038E : 0x07a8,
+ 0x03AB : 0x07a9,
+ 0x038F : 0x07ab,
+ 0x0385 : 0x07ae,
+ 0x2015 : 0x07af,
+ 0x03AC : 0x07b1,
+ 0x03AD : 0x07b2,
+ 0x03AE : 0x07b3,
+ 0x03AF : 0x07b4,
+ 0x03CA : 0x07b5,
+ 0x0390 : 0x07b6,
+ 0x03CC : 0x07b7,
+ 0x03CD : 0x07b8,
+ 0x03CB : 0x07b9,
+ 0x03B0 : 0x07ba,
+ 0x03CE : 0x07bb,
+ 0x0391 : 0x07c1,
+ 0x0392 : 0x07c2,
+ 0x0393 : 0x07c3,
+ 0x0394 : 0x07c4,
+ 0x0395 : 0x07c5,
+ 0x0396 : 0x07c6,
+ 0x0397 : 0x07c7,
+ 0x0398 : 0x07c8,
+ 0x0399 : 0x07c9,
+ 0x039A : 0x07ca,
+ 0x039B : 0x07cb,
+ 0x039C : 0x07cc,
+ 0x039D : 0x07cd,
+ 0x039E : 0x07ce,
+ 0x039F : 0x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D2 : 0x08ce,
+ 0x2261 : 0x08cf,
+ //0x221A : 0x08d6,
+ 0x2282 : 0x08da,
+ 0x2283 : 0x08db,
+ 0x2229 : 0x08dc,
+ 0x222A : 0x08dd,
+ 0x2227 : 0x08de,
+ 0x2228 : 0x08df,
+ //0x2202 : 0x08ef,
+ 0x0192 : 0x08f6,
+ 0x2190 : 0x08fb,
+ 0x2191 : 0x08fc,
+ 0x2192 : 0x08fd,
+ 0x2193 : 0x08fe,
+ 0x25C6 : 0x09e0,
+ 0x2592 : 0x09e1,
+ 0x2409 : 0x09e2,
+ 0x240C : 0x09e3,
+ 0x240D : 0x09e4,
+ 0x240A : 0x09e5,
+ 0x2424 : 0x09e8,
+ 0x240B : 0x09e9,
+ 0x2518 : 0x09ea,
+ 0x2510 : 0x09eb,
+ 0x250C : 0x09ec,
+ 0x2514 : 0x09ed,
+ 0x253C : 0x09ee,
+ 0x23BA : 0x09ef,
+ 0x23BB : 0x09f0,
+ 0x2500 : 0x09f1,
+ 0x23BC : 0x09f2,
+ 0x23BD : 0x09f3,
+ 0x251C : 0x09f4,
+ 0x2524 : 0x09f5,
+ 0x2534 : 0x09f6,
+ 0x252C : 0x09f7,
+ 0x2502 : 0x09f8,
+ 0x2003 : 0x0aa1,
+ 0x2002 : 0x0aa2,
+ 0x2004 : 0x0aa3,
+ 0x2005 : 0x0aa4,
+ 0x2007 : 0x0aa5,
+ 0x2008 : 0x0aa6,
+ 0x2009 : 0x0aa7,
+ 0x200A : 0x0aa8,
+ 0x2014 : 0x0aa9,
+ 0x2013 : 0x0aaa,
+ 0x2026 : 0x0aae,
+ 0x2025 : 0x0aaf,
+ 0x2153 : 0x0ab0,
+ 0x2154 : 0x0ab1,
+ 0x2155 : 0x0ab2,
+ 0x2156 : 0x0ab3,
+ 0x2157 : 0x0ab4,
+ 0x2158 : 0x0ab5,
+ 0x2159 : 0x0ab6,
+ 0x215A : 0x0ab7,
+ 0x2105 : 0x0ab8,
+ 0x2012 : 0x0abb,
+ 0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ce,
+ 0x0E2F : 0x0dcf,
+ 0x0E30 : 0x0dd0,
+ 0x0E31 : 0x0dd1,
+ 0x0E32 : 0x0dd2,
+ 0x0E33 : 0x0dd3,
+ 0x0E34 : 0x0dd4,
+ 0x0E35 : 0x0dd5,
+ 0x0E36 : 0x0dd6,
+ 0x0E37 : 0x0dd7,
+ 0x0E38 : 0x0dd8,
+ 0x0E39 : 0x0dd9,
+ 0x0E3A : 0x0dda,
+ 0x0E3F : 0x0ddf,
+ 0x0E40 : 0x0de0,
+ 0x0E41 : 0x0de1,
+ 0x0E42 : 0x0de2,
+ 0x0E43 : 0x0de3,
+ 0x0E44 : 0x0de4,
+ 0x0E45 : 0x0de5,
+ 0x0E46 : 0x0de6,
+ 0x0E47 : 0x0de7,
+ 0x0E48 : 0x0de8,
+ 0x0E49 : 0x0de9,
+ 0x0E4A : 0x0dea,
+ 0x0E4B : 0x0deb,
+ 0x0E4C : 0x0dec,
+ 0x0E4D : 0x0ded,
+ 0x0E50 : 0x0df0,
+ 0x0E51 : 0x0df1,
+ 0x0E52 : 0x0df2,
+ 0x0E53 : 0x0df3,
+ 0x0E54 : 0x0df4,
+ 0x0E55 : 0x0df5,
+ 0x0E56 : 0x0df6,
+ 0x0E57 : 0x0df7,
+ 0x0E58 : 0x0df8,
+ 0x0E59 : 0x0df9,
+ 0x0587 : 0x1000587,
+ 0x0589 : 0x1000589,
+ 0x055D : 0x100055d,
+ 0x058A : 0x100058a,
+ 0x055C : 0x100055c,
+ 0x055B : 0x100055b,
+ 0x055E : 0x100055e,
+ 0x0531 : 0x1000531,
+ 0x0561 : 0x1000561,
+ 0x0532 : 0x1000532,
+ 0x0562 : 0x1000562,
+ 0x0533 : 0x1000533,
+ 0x0563 : 0x1000563,
+ 0x0534 : 0x1000534,
+ 0x0564 : 0x1000564,
+ 0x0535 : 0x1000535,
+ 0x0565 : 0x1000565,
+ 0x0536 : 0x1000536,
+ 0x0566 : 0x1000566,
+ 0x0537 : 0x1000537,
+ 0x0567 : 0x1000567,
+ 0x0538 : 0x1000538,
+ 0x0568 : 0x1000568,
+ 0x0539 : 0x1000539,
+ 0x0569 : 0x1000569,
+ 0x053A : 0x100053a,
+ 0x056A : 0x100056a,
+ 0x053B : 0x100053b,
+ 0x056B : 0x100056b,
+ 0x053C : 0x100053c,
+ 0x056C : 0x100056c,
+ 0x053D : 0x100053d,
+ 0x056D : 0x100056d,
+ 0x053E : 0x100053e,
+ 0x056E : 0x100056e,
+ 0x053F : 0x100053f,
+ 0x056F : 0x100056f,
+ 0x0540 : 0x1000540,
+ 0x0570 : 0x1000570,
+ 0x0541 : 0x1000541,
+ 0x0571 : 0x1000571,
+ 0x0542 : 0x1000542,
+ 0x0572 : 0x1000572,
+ 0x0543 : 0x1000543,
+ 0x0573 : 0x1000573,
+ 0x0544 : 0x1000544,
+ 0x0574 : 0x1000574,
+ 0x0545 : 0x1000545,
+ 0x0575 : 0x1000575,
+ 0x0546 : 0x1000546,
+ 0x0576 : 0x1000576,
+ 0x0547 : 0x1000547,
+ 0x0577 : 0x1000577,
+ 0x0548 : 0x1000548,
+ 0x0578 : 0x1000578,
+ 0x0549 : 0x1000549,
+ 0x0579 : 0x1000579,
+ 0x054A : 0x100054a,
+ 0x057A : 0x100057a,
+ 0x054B : 0x100054b,
+ 0x057B : 0x100057b,
+ 0x054C : 0x100054c,
+ 0x057C : 0x100057c,
+ 0x054D : 0x100054d,
+ 0x057D : 0x100057d,
+ 0x054E : 0x100054e,
+ 0x057E : 0x100057e,
+ 0x054F : 0x100054f,
+ 0x057F : 0x100057f,
+ 0x0550 : 0x1000550,
+ 0x0580 : 0x1000580,
+ 0x0551 : 0x1000551,
+ 0x0581 : 0x1000581,
+ 0x0552 : 0x1000552,
+ 0x0582 : 0x1000582,
+ 0x0553 : 0x1000553,
+ 0x0583 : 0x1000583,
+ 0x0554 : 0x1000554,
+ 0x0584 : 0x1000584,
+ 0x0555 : 0x1000555,
+ 0x0585 : 0x1000585,
+ 0x0556 : 0x1000556,
+ 0x0586 : 0x1000586,
+ 0x055A : 0x100055a,
+ 0x10D0 : 0x10010d0,
+ 0x10D1 : 0x10010d1,
+ 0x10D2 : 0x10010d2,
+ 0x10D3 : 0x10010d3,
+ 0x10D4 : 0x10010d4,
+ 0x10D5 : 0x10010d5,
+ 0x10D6 : 0x10010d6,
+ 0x10D7 : 0x10010d7,
+ 0x10D8 : 0x10010d8,
+ 0x10D9 : 0x10010d9,
+ 0x10DA : 0x10010da,
+ 0x10DB : 0x10010db,
+ 0x10DC : 0x10010dc,
+ 0x10DD : 0x10010dd,
+ 0x10DE : 0x10010de,
+ 0x10DF : 0x10010df,
+ 0x10E0 : 0x10010e0,
+ 0x10E1 : 0x10010e1,
+ 0x10E2 : 0x10010e2,
+ 0x10E3 : 0x10010e3,
+ 0x10E4 : 0x10010e4,
+ 0x10E5 : 0x10010e5,
+ 0x10E6 : 0x10010e6,
+ 0x10E7 : 0x10010e7,
+ 0x10E8 : 0x10010e8,
+ 0x10E9 : 0x10010e9,
+ 0x10EA : 0x10010ea,
+ 0x10EB : 0x10010eb,
+ 0x10EC : 0x10010ec,
+ 0x10ED : 0x10010ed,
+ 0x10EE : 0x10010ee,
+ 0x10EF : 0x10010ef,
+ 0x10F0 : 0x10010f0,
+ 0x10F1 : 0x10010f1,
+ 0x10F2 : 0x10010f2,
+ 0x10F3 : 0x10010f3,
+ 0x10F4 : 0x10010f4,
+ 0x10F5 : 0x10010f5,
+ 0x10F6 : 0x10010f6,
+ 0x1E8A : 0x1001e8a,
+ 0x012C : 0x100012c,
+ 0x01B5 : 0x10001b5,
+ 0x01E6 : 0x10001e6,
+ 0x01D2 : 0x10001d1,
+ 0x019F : 0x100019f,
+ 0x1E8B : 0x1001e8b,
+ 0x012D : 0x100012d,
+ 0x01B6 : 0x10001b6,
+ 0x01E7 : 0x10001e7,
+ //0x01D2 : 0x10001d2,
+ 0x0275 : 0x1000275,
+ 0x018F : 0x100018f,
+ 0x0259 : 0x1000259,
+ 0x1E36 : 0x1001e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 0x20A8 : 0x10020a8,
+ 0x20A9 : 0x10020a9,
+ 0x20AA : 0x10020aa,
+ 0x20AB : 0x10020ab,
+ 0x20AC : 0x20ac,
+ 0x2070 : 0x1002070,
+ 0x2074 : 0x1002074,
+ 0x2075 : 0x1002075,
+ 0x2076 : 0x1002076,
+ 0x2077 : 0x1002077,
+ 0x2078 : 0x1002078,
+ 0x2079 : 0x1002079,
+ 0x2080 : 0x1002080,
+ 0x2081 : 0x1002081,
+ 0x2082 : 0x1002082,
+ 0x2083 : 0x1002083,
+ 0x2084 : 0x1002084,
+ 0x2085 : 0x1002085,
+ 0x2086 : 0x1002086,
+ 0x2087 : 0x1002087,
+ 0x2088 : 0x1002088,
+ 0x2089 : 0x1002089,
+ 0x2202 : 0x1002202,
+ 0x2205 : 0x1002205,
+ 0x2208 : 0x1002208,
+ 0x2209 : 0x1002209,
+ 0x220B : 0x100220B,
+ 0x221A : 0x100221A,
+ 0x221B : 0x100221B,
+ 0x221C : 0x100221C,
+ 0x222C : 0x100222C,
+ 0x222D : 0x100222D,
+ 0x2235 : 0x1002235,
+ 0x2245 : 0x1002248,
+ 0x2247 : 0x1002247,
+ 0x2262 : 0x1002262,
+ 0x2263 : 0x1002263,
+ 0x2800 : 0x1002800,
+ 0x2801 : 0x1002801,
+ 0x2802 : 0x1002802,
+ 0x2803 : 0x1002803,
+ 0x2804 : 0x1002804,
+ 0x2805 : 0x1002805,
+ 0x2806 : 0x1002806,
+ 0x2807 : 0x1002807,
+ 0x2808 : 0x1002808,
+ 0x2809 : 0x1002809,
+ 0x280a : 0x100280a,
+ 0x280b : 0x100280b,
+ 0x280c : 0x100280c,
+ 0x280d : 0x100280d,
+ 0x280e : 0x100280e,
+ 0x280f : 0x100280f,
+ 0x2810 : 0x1002810,
+ 0x2811 : 0x1002811,
+ 0x2812 : 0x1002812,
+ 0x2813 : 0x1002813,
+ 0x2814 : 0x1002814,
+ 0x2815 : 0x1002815,
+ 0x2816 : 0x1002816,
+ 0x2817 : 0x1002817,
+ 0x2818 : 0x1002818,
+ 0x2819 : 0x1002819,
+ 0x281a : 0x100281a,
+ 0x281b : 0x100281b,
+ 0x281c : 0x100281c,
+ 0x281d : 0x100281d,
+ 0x281e : 0x100281e,
+ 0x281f : 0x100281f,
+ 0x2820 : 0x1002820,
+ 0x2821 : 0x1002821,
+ 0x2822 : 0x1002822,
+ 0x2823 : 0x1002823,
+ 0x2824 : 0x1002824,
+ 0x2825 : 0x1002825,
+ 0x2826 : 0x1002826,
+ 0x2827 : 0x1002827,
+ 0x2828 : 0x1002828,
+ 0x2829 : 0x1002829,
+ 0x282a : 0x100282a,
+ 0x282b : 0x100282b,
+ 0x282c : 0x100282c,
+ 0x282d : 0x100282d,
+ 0x282e : 0x100282e,
+ 0x282f : 0x100282f,
+ 0x2830 : 0x1002830,
+ 0x2831 : 0x1002831,
+ 0x2832 : 0x1002832,
+ 0x2833 : 0x1002833,
+ 0x2834 : 0x1002834,
+ 0x2835 : 0x1002835,
+ 0x2836 : 0x1002836,
+ 0x2837 : 0x1002837,
+ 0x2838 : 0x1002838,
+ 0x2839 : 0x1002839,
+ 0x283a : 0x100283a,
+ 0x283b : 0x100283b,
+ 0x283c : 0x100283c,
+ 0x283d : 0x100283d,
+ 0x283e : 0x100283e,
+ 0x283f : 0x100283f,
+ 0x2840 : 0x1002840,
+ 0x2841 : 0x1002841,
+ 0x2842 : 0x1002842,
+ 0x2843 : 0x1002843,
+ 0x2844 : 0x1002844,
+ 0x2845 : 0x1002845,
+ 0x2846 : 0x1002846,
+ 0x2847 : 0x1002847,
+ 0x2848 : 0x1002848,
+ 0x2849 : 0x1002849,
+ 0x284a : 0x100284a,
+ 0x284b : 0x100284b,
+ 0x284c : 0x100284c,
+ 0x284d : 0x100284d,
+ 0x284e : 0x100284e,
+ 0x284f : 0x100284f,
+ 0x2850 : 0x1002850,
+ 0x2851 : 0x1002851,
+ 0x2852 : 0x1002852,
+ 0x2853 : 0x1002853,
+ 0x2854 : 0x1002854,
+ 0x2855 : 0x1002855,
+ 0x2856 : 0x1002856,
+ 0x2857 : 0x1002857,
+ 0x2858 : 0x1002858,
+ 0x2859 : 0x1002859,
+ 0x285a : 0x100285a,
+ 0x285b : 0x100285b,
+ 0x285c : 0x100285c,
+ 0x285d : 0x100285d,
+ 0x285e : 0x100285e,
+ 0x285f : 0x100285f,
+ 0x2860 : 0x1002860,
+ 0x2861 : 0x1002861,
+ 0x2862 : 0x1002862,
+ 0x2863 : 0x1002863,
+ 0x2864 : 0x1002864,
+ 0x2865 : 0x1002865,
+ 0x2866 : 0x1002866,
+ 0x2867 : 0x1002867,
+ 0x2868 : 0x1002868,
+ 0x2869 : 0x1002869,
+ 0x286a : 0x100286a,
+ 0x286b : 0x100286b,
+ 0x286c : 0x100286c,
+ 0x286d : 0x100286d,
+ 0x286e : 0x100286e,
+ 0x286f : 0x100286f,
+ 0x2870 : 0x1002870,
+ 0x2871 : 0x1002871,
+ 0x2872 : 0x1002872,
+ 0x2873 : 0x1002873,
+ 0x2874 : 0x1002874,
+ 0x2875 : 0x1002875,
+ 0x2876 : 0x1002876,
+ 0x2877 : 0x1002877,
+ 0x2878 : 0x1002878,
+ 0x2879 : 0x1002879,
+ 0x287a : 0x100287a,
+ 0x287b : 0x100287b,
+ 0x287c : 0x100287c,
+ 0x287d : 0x100287d,
+ 0x287e : 0x100287e,
+ 0x287f : 0x100287f,
+ 0x2880 : 0x1002880,
+ 0x2881 : 0x1002881,
+ 0x2882 : 0x1002882,
+ 0x2883 : 0x1002883,
+ 0x2884 : 0x1002884,
+ 0x2885 : 0x1002885,
+ 0x2886 : 0x1002886,
+ 0x2887 : 0x1002887,
+ 0x2888 : 0x1002888,
+ 0x2889 : 0x1002889,
+ 0x288a : 0x100288a,
+ 0x288b : 0x100288b,
+ 0x288c : 0x100288c,
+ 0x288d : 0x100288d,
+ 0x288e : 0x100288e,
+ 0x288f : 0x100288f,
+ 0x2890 : 0x1002890,
+ 0x2891 : 0x1002891,
+ 0x2892 : 0x1002892,
+ 0x2893 : 0x1002893,
+ 0x2894 : 0x1002894,
+ 0x2895 : 0x1002895,
+ 0x2896 : 0x1002896,
+ 0x2897 : 0x1002897,
+ 0x2898 : 0x1002898,
+ 0x2899 : 0x1002899,
+ 0x289a : 0x100289a,
+ 0x289b : 0x100289b,
+ 0x289c : 0x100289c,
+ 0x289d : 0x100289d,
+ 0x289e : 0x100289e,
+ 0x289f : 0x100289f,
+ 0x28a0 : 0x10028a0,
+ 0x28a1 : 0x10028a1,
+ 0x28a2 : 0x10028a2,
+ 0x28a3 : 0x10028a3,
+ 0x28a4 : 0x10028a4,
+ 0x28a5 : 0x10028a5,
+ 0x28a6 : 0x10028a6,
+ 0x28a7 : 0x10028a7,
+ 0x28a8 : 0x10028a8,
+ 0x28a9 : 0x10028a9,
+ 0x28aa : 0x10028aa,
+ 0x28ab : 0x10028ab,
+ 0x28ac : 0x10028ac,
+ 0x28ad : 0x10028ad,
+ 0x28ae : 0x10028ae,
+ 0x28af : 0x10028af,
+ 0x28b0 : 0x10028b0,
+ 0x28b1 : 0x10028b1,
+ 0x28b2 : 0x10028b2,
+ 0x28b3 : 0x10028b3,
+ 0x28b4 : 0x10028b4,
+ 0x28b5 : 0x10028b5,
+ 0x28b6 : 0x10028b6,
+ 0x28b7 : 0x10028b7,
+ 0x28b8 : 0x10028b8,
+ 0x28b9 : 0x10028b9,
+ 0x28ba : 0x10028ba,
+ 0x28bb : 0x10028bb,
+ 0x28bc : 0x10028bc,
+ 0x28bd : 0x10028bd,
+ 0x28be : 0x10028be,
+ 0x28bf : 0x10028bf,
+ 0x28c0 : 0x10028c0,
+ 0x28c1 : 0x10028c1,
+ 0x28c2 : 0x10028c2,
+ 0x28c3 : 0x10028c3,
+ 0x28c4 : 0x10028c4,
+ 0x28c5 : 0x10028c5,
+ 0x28c6 : 0x10028c6,
+ 0x28c7 : 0x10028c7,
+ 0x28c8 : 0x10028c8,
+ 0x28c9 : 0x10028c9,
+ 0x28ca : 0x10028ca,
+ 0x28cb : 0x10028cb,
+ 0x28cc : 0x10028cc,
+ 0x28cd : 0x10028cd,
+ 0x28ce : 0x10028ce,
+ 0x28cf : 0x10028cf,
+ 0x28d0 : 0x10028d0,
+ 0x28d1 : 0x10028d1,
+ 0x28d2 : 0x10028d2,
+ 0x28d3 : 0x10028d3,
+ 0x28d4 : 0x10028d4,
+ 0x28d5 : 0x10028d5,
+ 0x28d6 : 0x10028d6,
+ 0x28d7 : 0x10028d7,
+ 0x28d8 : 0x10028d8,
+ 0x28d9 : 0x10028d9,
+ 0x28da : 0x10028da,
+ 0x28db : 0x10028db,
+ 0x28dc : 0x10028dc,
+ 0x28dd : 0x10028dd,
+ 0x28de : 0x10028de,
+ 0x28df : 0x10028df,
+ 0x28e0 : 0x10028e0,
+ 0x28e1 : 0x10028e1,
+ 0x28e2 : 0x10028e2,
+ 0x28e3 : 0x10028e3,
+ 0x28e4 : 0x10028e4,
+ 0x28e5 : 0x10028e5,
+ 0x28e6 : 0x10028e6,
+ 0x28e7 : 0x10028e7,
+ 0x28e8 : 0x10028e8,
+ 0x28e9 : 0x10028e9,
+ 0x28ea : 0x10028ea,
+ 0x28eb : 0x10028eb,
+ 0x28ec : 0x10028ec,
+ 0x28ed : 0x10028ed,
+ 0x28ee : 0x10028ee,
+ 0x28ef : 0x10028ef,
+ 0x28f0 : 0x10028f0,
+ 0x28f1 : 0x10028f1,
+ 0x28f2 : 0x10028f2,
+ 0x28f3 : 0x10028f3,
+ 0x28f4 : 0x10028f4,
+ 0x28f5 : 0x10028f5,
+ 0x28f6 : 0x10028f6,
+ 0x28f7 : 0x10028f7,
+ 0x28f8 : 0x10028f8,
+ 0x28f9 : 0x10028f9,
+ 0x28fa : 0x10028fa,
+ 0x28fb : 0x10028fb,
+ 0x28fc : 0x10028fc,
+ 0x28fd : 0x10028fd,
+ 0x28fe : 0x10028fe,
+ 0x28ff : 0x10028ff
+};

diff --git a/noVNC/include/jsunzip.js b/noVNC/include/jsunzip.js
new file mode 100644
index 0000000..f815218
--- /dev/null
+++ b/noVNC/include/jsunzip.js
@@ -0,0 +1,668 @@
+/*
+ * JSUnzip
+ *
+ * Copyright (c) 2011 by Erik Moller
+ * All Rights Reserved
+ *
+ * This software is provided 'as-is', without any express
+ * or implied warranty. In no event will the authors be
+ * held liable for any damages arising from the use of
+ * this software.
+ *
+ * Permission is granted to anyone to use this software
+ * for any purpose, including commercial applications,
+ * and to alter it and redistribute it freely, subject to
+ * the following restrictions:
+ *
+ * 1. The origin of this software must not be
+ * misrepresented; you must not claim that you
+ * wrote the original software. If you use this
+ * software in a product, an acknowledgment in
+ * the product documentation would be appreciated
+ * but is not required.
+ *
+ * 2. Altered source versions must be plainly marked
+ * as such, and must not be misrepresented as
+ * being the original software.
+ *
+ * 3. This notice may not be removed or altered from
+ * any source distribution.
+ */
+
+var tinf;
+
+function JSUnzip() {
+
+ this.getInt = function(offset, size) {
+ switch (size) {
+ case 4:
+ return (this.data.charCodeAt(offset + 3) & 0xff) << 24 |
+ (this.data.charCodeAt(offset + 2) & 0xff) << 16 |
+ (this.data.charCodeAt(offset + 1) & 0xff) << 8 |
+ (this.data.charCodeAt(offset + 0) & 0xff);
+ break;
+ case 2:
+ return (this.data.charCodeAt(offset + 1) & 0xff) << 8 |
+ (this.data.charCodeAt(offset + 0) & 0xff);
+ break;
+ default:
+ return this.data.charCodeAt(offset) & 0xff;
+ break;
+ }
+ };
+
+ this.getDOSDate = function(dosdate, dostime) {
+ var day = dosdate & 0x1f;
+ var month = ((dosdate >> 5) & 0xf) - 1;
+ var year = 1980 + ((dosdate >> 9) & 0x7f)
+ var second = (dostime & 0x1f) * 2;
+ var minute = (dostime >> 5) & 0x3f;
+ hour = (dostime >> 11) & 0x1f;
+ return new Date(year, month, day, hour, minute, second);
+ }
+
+ this.open = function(data) {
+ this.data = data;
+ this.files = [];
+
+ if (this.data.length < 22)
+ return { 'status' : false, 'error' : 'Invalid data' };
+ var endOfCentralDirectory = this.data.length - 22;
+ while (endOfCentralDirectory >= 0 && this.getInt(endOfCentralDirectory, 4) != 0x06054b50)
+ --endOfCentralDirectory;
+ if (endOfCentralDirectory < 0)
+ return { 'status' : false, 'error' : 'Invalid data' };
+ if (this.getInt(endOfCentralDirectory + 4, 2) != 0 || this.getInt(endOfCentralDirectory + 6, 2) != 0)
+ return { 'status' : false, 'error' : 'No multidisk support' };
+
+ var entriesInThisDisk = this.getInt(endOfCentralDirectory + 8, 2);
+ var centralDirectoryOffset = this.getInt(endOfCentralDirectory + 16, 4);
+ var globalCommentLength = this.getInt(endOfCentralDirectory + 20, 2);
+ this.comment = this.data.slice(endOfCentralDirectory + 22, endOfCentralDirectory + 22 + globalCommentLength);
+
+ var fileOffset = centralDirectoryOffset;
+
+ for (var i = 0; i < entriesInThisDisk; ++i) {
+ if (this.getInt(fileOffset + 0, 4) != 0x02014b50)
+ return { 'status' : false, 'error' : 'Invalid data' };
+ if (this.getInt(fileOffset + 6, 2) > 20)
+ return { 'status' : false, 'error' : 'Unsupported version' };
+ if (this.getInt(fileOffset + 8, 2) & 1)
+ return { 'status' : false, 'error' : 'Encryption not implemented' };
+
+ var compressionMethod = this.getInt(fileOffset + 10, 2);
+ if (compressionMethod != 0 && compressionMethod != 8)
+ return { 'status' : false, 'error' : 'Unsupported compression method' };
+
+ var lastModFileTime = this.getInt(fileOffset + 12, 2);
+ var lastModFileDate = this.getInt(fileOffset + 14, 2);
+ var lastModifiedDate = this.getDOSDate(lastModFileDate, lastModFileTime);
+
+ var crc = this.getInt(fileOffset + 16, 4);
+ // TODO: crc
+
+ var compressedSize = this.getInt(fileOffset + 20, 4);
+ var uncompressedSize = this.getInt(fileOffset + 24, 4);
+
+ var fileNameLength = this.getInt(fileOffset + 28, 2);
+ var extraFieldLength = this.getInt(fileOffset + 30, 2);
+ var fileCommentLength = this.getInt(fileOffset + 32, 2);
+
+ var relativeOffsetOfLocalHeader = this.getInt(fileOffset + 42, 4);
+
+ var fileName = this.data.slice(fileOffset + 46, fileOffset + 46 + fileNameLength);
+ var fileComment = this.data.slice(fileOffset + 46 + fileNameLength + extraFieldLength, fileOffset + 46 + fileNameLength + extraFieldLength + fileCommentLength);
+
+ if (this.getInt(relativeOffsetOfLocalHeader + 0, 4) != 0x04034b50)
+ return { 'status' : false, 'error' : 'Invalid data' };
+ var localFileNameLength = this.getInt(relativeOffsetOfLocalHeader + 26, 2);
+ var localExtraFieldLength = this.getInt(relativeOffsetOfLocalHeader + 28, 2);
+ var localFileContent = relativeOffsetOfLocalHeader + 30 + localFileNameLength + localExtraFieldLength;
+
+ this.files[fileName] =
+ {
+ 'fileComment' : fileComment,
+ 'compressionMethod' : compressionMethod,
+ 'compressedSize' : compressedSize,
+ 'uncompressedSize' : uncompressedSize,
+ 'localFileContent' : localFileContent,
+ 'lastModifiedDate' : lastModifiedDate
+ };
+
+ fileOffset += 46 + fileNameLength + extraFieldLength + fileCommentLength;
+ }
+ return { 'status' : true }
+ };
+
+
+ this.read = function(fileName) {
+ var fileInfo = this.files[fileName];
+ if (fileInfo) {
+ if (fileInfo.compressionMethod == 8) {
+ if (!tinf) {
+ tinf = new TINF();
+ tinf.init();
+ }
+ var result = tinf.uncompress(this.data, fileInfo.localFileContent);
+ if (result.status == tinf.OK)
+ return { 'status' : true, 'data' : result.data };
+ else
+ return { 'status' : false, 'error' : result.error };
+ } else {
+ return { 'status' : true, 'data' : this.data.slice(fileInfo.localFileContent, fileInfo.localFileContent + fileInfo.uncompressedSize) };
+ }
+ }
+ return { 'status' : false, 'error' : "File '" + fileName + "' doesn't exist in zip" };
+ };
+
+};
+
+
+
+/*
+ * tinflate - tiny inflate
+ *
+ * Copyright (c) 2003 by Joergen Ibsen / Jibz
+ * All Rights Reserved
+ *
+ * http://www.ibsensoftware.com/
+ *
+ * This software is provided 'as-is', without any express
+ * or implied warranty. In no event will the authors be
+ * held liable for any damages arising from the use of
+ * this software.
+ *
+ * Permission is granted to anyone to use this software
+ * for any purpose, including commercial applications,
+ * and to alter it and redistribute it freely, subject to
+ * the following restrictions:
+ *
+ * 1. The origin of this software must not be
+ * misrepresented; you must not claim that you
+ * wrote the original software. If you use this
+ * software in a product, an acknowledgment in
+ * the product documentation would be appreciated
+ * but is not required.
+ *
+ * 2. Altered source versions must be plainly marked
+ * as such, and must not be misrepresented as
+ * being the original software.
+ *
+ * 3. This notice may not be removed or altered from
+ * any source distribution.
+ */
+
+/*
+ * tinflate javascript port by Erik Moller in May 2011.
+ * emo...@opera.com
+ *
+ * read_bits() patched by mi...@imidio.com to allow
+ * reading more then 8 bits (needed in some zlib streams)
+ */
+
+"use strict";
+
+function TINF() {
+
+this.OK = 0;
+this.DATA_ERROR = (-3);
+this.WINDOW_SIZE = 32768;
+
+/* ------------------------------ *
+ * -- internal data structures -- *
+ * ------------------------------ */
+
+this.TREE = function() {
+ this.table = new Array(16); /* table of code length counts */
+ this.trans = new Array(288); /* code -> symbol translation table */
+};
+
+this.DATA = function(that) {
+ this.source = '';
+ this.sourceIndex = 0;
+ this.tag = 0;
+ this.bitcount = 0;
+
+ this.dest = [];
+
+ this.history = [];
+
+ this.ltree = new that.TREE(); /* dynamic length/symbol tree */
+ this.dtree = new that.TREE(); /* dynamic distance tree */
+};
+
+/* --------------------------------------------------- *
+ * -- uninitialized global data (static structures) -- *
+ * --------------------------------------------------- */
+
+this.sltree = new this.TREE(); /* fixed length/symbol tree */
+this.sdtree = new this.TREE(); /* fixed distance tree */
+
+/* extra bits and base tables for length codes */
+this.length_bits = new Array(30);
+this.length_base = new Array(30);
+
+/* extra bits and base tables for distance codes */
+this.dist_bits = new Array(30);
+this.dist_base = new Array(30);
+
+/* special ordering of code length codes */
+this.clcidx = [
+ 16, 17, 18, 0, 8, 7, 9, 6,
+ 10, 5, 11, 4, 12, 3, 13, 2,
+ 14, 1, 15
+];
+
+/* ----------------------- *
+ * -- utility functions -- *
+ * ----------------------- */
+
+/* build extra bits and base tables */
+this.build_bits_base = function(bits, base, delta, first)
+{
+ var i, sum;
+
+ /* build bits table */
+ for (i = 0; i < delta; ++i) bits[i] = 0;
+ for (i = 0; i < 30 - delta; ++i) bits[i + delta] = Math.floor(i / delta);
+
+ /* build base table */
+ for (sum = first, i = 0; i < 30; ++i)
+ {
+ base[i] = sum;
+ sum += 1 << bits[i];
+ }
+}
+
+/* build the fixed huffman trees */
+this.build_fixed_trees = function(lt, dt)
+{
+ var i;
+
+ /* build fixed length tree */
+ for (i = 0; i < 7; ++i) lt.table[i] = 0;
+
+ lt.table[7] = 24;
+ lt.table[8] = 152;
+ lt.table[9] = 112;
+
+ for (i = 0; i < 24; ++i) lt.trans[i] = 256 + i;
+ for (i = 0; i < 144; ++i) lt.trans[24 + i] = i;
+ for (i = 0; i < 8; ++i) lt.trans[24 + 144 + i] = 280 + i;
+ for (i = 0; i < 112; ++i) lt.trans[24 + 144 + 8 + i] = 144 + i;
+
+ /* build fixed distance tree */
+ for (i = 0; i < 5; ++i) dt.table[i] = 0;
+
+ dt.table[5] = 32;
+
+ for (i = 0; i < 32; ++i) dt.trans[i] = i;
+}
+
+/* given an array of code lengths, build a tree */
+this.build_tree = function(t, lengths, loffset, num)
+{
+ var offs = new Array(16);
+ var i, sum;
+
+ /* clear code length count table */
+ for (i = 0; i < 16; ++i) t.table[i] = 0;
+
+ /* scan symbol lengths, and sum code length counts */
+ for (i = 0; i < num; ++i) t.table[lengths[loffset + i]]++;
+
+ t.table[0] = 0;
+
+ /* compute offset table for distribution sort */
+ for (sum = 0, i = 0; i < 16; ++i)
+ {
+ offs[i] = sum;
+ sum += t.table[i];
+ }
+
+ /* create code->symbol translation table (symbols sorted by code) */
+ for (i = 0; i < num; ++i)
+ {
+ if (lengths[loffset + i]) t.trans[offs[lengths[loffset + i]]++] = i;
+ }
+}
+
+/* ---------------------- *
+ * -- decode functions -- *
+ * ---------------------- */
+
+/* get one bit from source stream */
+this.getbit = function(d)
+{
+ var bit;
+
+ /* check if tag is empty */
+ if (!d.bitcount--)
+ {
+ /* load next tag */
+ d.tag = d.source[d.sourceIndex++] & 0xff;
+ d.bitcount = 7;
+ }
+
+ /* shift bit out of tag */
+ bit = d.tag & 0x01;
+ d.tag >>= 1;
+
+ return bit;
+}
+
+/* read a num bit value from a stream and add base */
+this.read_bits = function(d, num, base)
+{
+ if (!num)
+ return base;
+
+ var val = 0;
+ while (d.bitcount < 24) {
+ d.tag = d.tag | (d.source[d.sourceIndex++] & 0xff) << d.bitcount;
+ d.bitcount += 8;
+ }
+ 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 */
+this.decode_symbol = function(d, t)
+{
+ while (d.bitcount < 16) {
+ d.tag = d.tag | (d.source[d.sourceIndex++] & 0xff) << d.bitcount;
+ d.bitcount += 8;
+ }
+
+ var sum = 0, cur = 0, len = 0;
+ do {
+ cur = 2 * cur + ((d.tag & (1 << len)) >> len);
+
+ ++len;
+
+ sum += t.table[len];
+ cur -= t.table[len];
+
+ } while (cur >= 0);
+
+ d.tag >>= len;
+ d.bitcount -= len;
+
+ return t.trans[sum + cur];
+}
+
+/* given a data stream, decode dynamic trees from it */
+this.decode_trees = function(d, lt, dt)
+{
+ var code_tree = new this.TREE();
+ var lengths = new Array(288+32);
+ var hlit, hdist, hclen;
+ var i, num, length;
+
+ /* get 5 bits HLIT (257-286) */
+ hlit = this.read_bits(d, 5, 257);
+
+ /* get 5 bits HDIST (1-32) */
+ hdist = this.read_bits(d, 5, 1);
+
+ /* get 4 bits HCLEN (4-19) */
+ hclen = this.read_bits(d, 4, 4);
+
+ for (i = 0; i < 19; ++i) lengths[i] = 0;
+
+ /* read code lengths for code length alphabet */
+ for (i = 0; i < hclen; ++i)
+ {
+ /* get 3 bits code length (0-7) */
+ var clen = this.read_bits(d, 3, 0);
+
+ lengths[this.clcidx[i]] = clen;
+ }
+
+ /* build code length tree */
+ this.build_tree(code_tree, lengths, 0, 19);
+
+ /* decode code lengths for the dynamic trees */
+ for (num = 0; num < hlit + hdist; )
+ {
+ var sym = this.decode_symbol(d, code_tree);
+
+ switch (sym)
+ {
+ case 16:
+ /* copy previous code length 3-6 times (read 2 bits) */
+ {
+ var prev = lengths[num - 1];
+ for (length = this.read_bits(d, 2, 3); length; --length)
+ {
+ lengths[num++] = prev;
+ }
+ }
+ break;
+ case 17:
+ /* repeat code length 0 for 3-10 times (read 3 bits) */
+ for (length = this.read_bits(d, 3, 3); length; --length)
+ {
+ lengths[num++] = 0;
+ }
+ break;
+ case 18:
+ /* repeat code length 0 for 11-138 times (read 7 bits) */
+ for (length = this.read_bits(d, 7, 11); length; --length)
+ {
+ lengths[num++] = 0;
+ }
+ break;
+ default:
+ /* values 0-15 represent the actual code lengths */
+ lengths[num++] = sym;
+ break;
+ }
+ }
+
+ /* build dynamic trees */
+ this.build_tree(lt, lengths, 0, hlit);
+ this.build_tree(dt, lengths, hlit, hdist);
+}
+
+/* ----------------------------- *
+ * -- block inflate functions -- *
+ * ----------------------------- */
+
+/* given a stream and two trees, inflate a block of data */
+this.inflate_block_data = function(d, lt, dt)
+{
+ // js optimization.
+ var ddest = d.dest;
+ var ddestlength = ddest.length;
+
+ while (1)
+ {
+ var sym = this.decode_symbol(d, lt);
+
+ /* check for end of block */
+ if (sym == 256)
+ {
+ return this.OK;
+ }
+
+ if (sym < 256)
+ {
+ ddest[ddestlength++] = sym; // ? String.fromCharCode(sym);
+ d.history.push(sym);
+ } else {
+
+ var length, dist, offs;
+ var i;
+
+ sym -= 257;
+
+ /* possibly get more bits from length code */
+ length = this.read_bits(d, this.length_bits[sym], this.length_base[sym]);
+
+ dist = this.decode_symbol(d, dt);
+
+ /* possibly get more bits from distance code */
+ offs = d.history.length - this.read_bits(d, this.dist_bits[dist], this.dist_base[dist]);
+
+ if (offs < 0)
+ throw ("Invalid zlib offset " + offs);
+
+ /* copy match */
+ for (i = offs; i < offs + length; ++i) {
+ //ddest[ddestlength++] = ddest[i];
+ ddest[ddestlength++] = d.history[i];
+ d.history.push(d.history[i]);
+ }
+ }
+ }
+}
+
+/* inflate an uncompressed block of data */
+this.inflate_uncompressed_block = function(d)
+{
+ var length, invlength;
+ var i;
+
+ if (d.bitcount > 7) {
+ var overflow = Math.floor(d.bitcount / 8);
+ d.sourceIndex -= overflow;
+ d.bitcount = 0;
+ d.tag = 0;
+ }
+
+ /* get length */
+ length = d.source[d.sourceIndex+1];
+ length = 256*length + d.source[d.sourceIndex];
+
+ /* get one's complement of length */
+ invlength = d.source[d.sourceIndex+3];
+ invlength = 256*invlength + d.source[d.sourceIndex+2];
+
+ /* check length */
+ if (length != (~invlength & 0x0000ffff)) return this.DATA_ERROR;
+
+ d.sourceIndex += 4;
+
+ /* copy block */
+ for (i = length; i; --i) {
+ d.history.push(d.source[d.sourceIndex]);
+ d.dest[d.dest.length] = d.source[d.sourceIndex++];
+ }
+
+ /* make sure we start next block on a byte boundary */
+ d.bitcount = 0;
+
+ return this.OK;
+}
+
+/* inflate a block of data compressed with fixed huffman trees */
+this.inflate_fixed_block = function(d)
+{
+ /* decode block using fixed trees */
+ return this.inflate_block_data(d, this.sltree, this.sdtree);
+}
+
+/* inflate a block of data compressed with dynamic huffman trees */
+this.inflate_dynamic_block = function(d)
+{
+ /* decode trees from stream */
+ this.decode_trees(d, d.ltree, d.dtree);
+
+ /* decode block using decoded trees */
+ return this.inflate_block_data(d, d.ltree, d.dtree);
+}
+
+/* ---------------------- *
+ * -- public functions -- *
+ * ---------------------- */
+
+/* initialize global (static) data */
+this.init = function()
+{
+ /* build fixed huffman trees */
+ this.build_fixed_trees(this.sltree, this.sdtree);
+
+ /* build extra bits and base tables */
+ this.build_bits_base(this.length_bits, this.length_base, 4, 3);
+ this.build_bits_base(this.dist_bits, this.dist_base, 2, 1);
+
+ /* fix a special case */
+ this.length_bits[28] = 0;
+ this.length_base[28] = 258;
+
+ this.reset();
+}
+
+this.reset = function()
+{
+ this.d = new this.DATA(this);
+ delete this.header;
+}
+
+/* inflate stream from source to dest */
+this.uncompress = function(source, offset)
+{
+
+ var d = this.d;
+ var bfinal;
+
+ /* initialise data */
+ d.source = source;
+ d.sourceIndex = offset;
+ d.bitcount = 0;
+
+ d.dest = [];
+
+ // Skip zlib header at start of stream
+ if (typeof this.header == 'undefined') {
+ this.header = this.read_bits(d, 16, 0);
+ /* byte 0: 0x78, 7 = 32k window size, 8 = deflate */
+ /* byte 1: check bits for header and other flags */
+ }
+
+ var blocks = 0;
+
+ do {
+
+ var btype;
+ var res;
+
+ /* read final block flag */
+ bfinal = this.getbit(d);
+
+ /* read block type (2 bits) */
+ btype = this.read_bits(d, 2, 0);
+
+ /* decompress block */
+ switch (btype)
+ {
+ case 0:
+ /* decompress uncompressed block */
+ res = this.inflate_uncompressed_block(d);
+ break;
+ case 1:
+ /* decompress block with fixed huffman trees */
+ res = this.inflate_fixed_block(d);
+ break;
+ case 2:
+ /* decompress block with dynamic huffman trees */
+ res = this.inflate_dynamic_block(d);
+ break;
+ default:
+ return { 'status' : this.DATA_ERROR };
+ }
+
+ if (res != this.OK) return { 'status' : this.DATA_ERROR };
+ blocks++;
+
+ } while (!bfinal && d.sourceIndex < d.source.length);
+
+ d.history = d.history.slice(-this.WINDOW_SIZE);
+
+ return { 'status' : this.OK, 'data' : d.dest };
+}
+
+};

diff --git a/noVNC/include/logo.js b/noVNC/include/logo.js
new file mode 100644
index 0000000..befa598
--- /dev/null
+++ b/noVNC/include/logo.js
@@ -0,0 +1 @@
+noVNC_logo = {"width": 640, "height": 435, "data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAGzCAYAAAC/y6a9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAStAAAErQBBHTWggAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N13fBvlwQfw3522ZMm2vPdIGCFkA4GyoYyGsCmjk+7dQksHL2/H2/dtC4W2tLTlfelu2VA2lEILFCgQIHEGJCQkdjzkLdmWZGvfvX8oOkmJEy/pNO73/Xz44DtLzz2RT7qfnnXC8uXLZUxDlqfdnUYQhIP+bjbPn+5xhypzrmUf6rGzOc5cjzVduXN9/nTPyfRrMt/jzOcY05U5n3L2f95s/34LPW4m/p6FbLp/73xe+5nKnWuZs/07ZOOcnusx5nucbJU727LneuxslDmdTBxn/2NmusyEuZS7kHMxG/XP5Gf3TOVmQzY+u/PhPMnkMcSsH5WIiIiI8goDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBE
REZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMAASERERaQwDIBEREZHGMADSrMmynOsqEBERUQboc10Bym+SJMHv92NiYgJ+vx+CIECv18NgMCj/N5lMcDgcua4qERERzRIDIE0rEfp8Ph8kSVL2y7KMcDiMcDic9niPx4O6ujqYTCa1q1qU/H4/fD4fBEFQ9iV+NplMKC0tTfsdERHRXDAA0gFcLhcmJibS9pkrAJ1ZgBxD/D9JhhQBwt747wOBALq6uuB0OlFZWQlR5OiCuZJlGV6vF263+4CAvT+3242KigoGQSIimhcGQErT19cHr9erbFuqBSy6SETN8QKmyxnurTJ23iNhalCGLMtwu93wer2oq6uDzWZTseaFS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xloAAAAASUVORK5CYII="};

diff --git a/noVNC/include/playback.js b/noVNC/include/playback.js
new file mode 100644
index 0000000..a21c7b6
--- /dev/null
+++ b/noVNC/include/playback.js
@@ -0,0 +1,90 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.LGPL-3)
+ */
+
+"use strict";
+/*jslint browser: true, white: false */
+/*global Util, VNC_frame_data, finish */
+
+var rfb, mode, test_state, frame_idx, frame_length,
+ iteration, iterations, istart_time,
+
+ // Pre-declarations for jslint
+ send_array, next_iteration, queue_next_packet, do_packet;
+
+// Override send_array
+send_array = function (arr) {
+ // Stub out send_array
+};
+
+next_iteration = function () {
+ if (iteration === 0) {
+ frame_length = VNC_frame_data.length;
+ test_state = 'running';
+ } else {
+ rfb.disconnect();
+ }
+
+ if (test_state !== 'running') { return; }
+
+ iteration += 1;
+ if (iteration > iterations) {
+ finish();
+ return;
+ }
+
+ frame_idx = 0;
+ istart_time = (new Date()).getTime();
+ rfb.connect('test', 0, "bogus");
+
+ queue_next_packet();
+
+};
+
+queue_next_packet = function () {
+ var frame, foffset, toffset, delay;
+ if (test_state !== 'running') { return; }
+
+ frame = VNC_frame_data[frame_idx];
+ while ((frame_idx < frame_length) && (frame.charAt(0) === "}")) {
+ //Util.Debug("Send frame " + frame_idx);
+ frame_idx += 1;
+ frame = VNC_frame_data[frame_idx];
+ }
+
+ if (frame === 'EOF') {
+ Util.Debug("Finished, found EOF");
+ next_iteration();
+ return;
+ }
+ if (frame_idx >= frame_length) {
+ Util.Debug("Finished, no more frames");
+ next_iteration();
+ return;
+ }
+
+ if (mode === 'realtime') {
+ foffset = frame.slice(1, frame.indexOf('{', 1));
+ toffset = (new Date()).getTime() - istart_time;
+ delay = foffset - toffset;
+ if (delay < 1) {
+ delay = 1;
+ }
+
+ setTimeout(do_packet, delay);
+ } else {
+ setTimeout(do_packet, 1);
+ }
+};
+
+do_packet = function () {
+ //Util.Debug("Processing frame: " + frame_idx);
+ var frame = VNC_frame_data[frame_idx];
+ rfb.recv_message({'data' : frame.slice(frame.indexOf('{', 1) + 1)});
+ frame_idx += 1;
+
+ queue_next_packet();
+};
+

diff --git a/noVNC/include/rfb.js b/noVNC/include/rfb.js
new file mode 100644
index 0000000..00fb7d8
--- /dev/null
+++ b/noVNC/include/rfb.js
@@ -0,0 +1,1849 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ *
+ * TIGHT decoder portion:
+ * (c) 2012 Michael Tinglof, Joe Balaz, Les Piech (Mercuri.ca)
+ */
+
+/*jslint white: false, browser: true, bitwise: false, plusplus: false */
+/*global window, Util, Display, Keyboard, Mouse, Websock, Websock_native, Base64, DES */
+
+
+function RFB(defaults) {
+"use strict";
+
+var that = {}, // Public API methods
+ conf = {}, // Configuration attributes
+
+ // Pre-declare private functions used before definitions (jslint)
+ init_vars, updateState, fail, handle_message,
+ init_msg, normal_msg, framebufferUpdate, print_stats,
+
+ pixelFormat, clientEncodings, fbUpdateRequest, fbUpdateRequests,
+ keyEvent, pointerEvent, clientCutText,
+
+ getTightCLength, extract_data_uri,
+ keyPress, mouseButton, mouseMove,
+
+ checkEvents, // Overridable for testing
+
+
+ //
+ // Private RFB namespace variables
+ //
+ rfb_host = '',
+ rfb_port = 5900,
+ rfb_password = '',
+ rfb_path = '',
+
+ rfb_state = 'disconnected',
+ rfb_version = 0,
+ rfb_max_version= 3.8,
+ rfb_auth_scheme= '',
+
+
+ // In preference order
+ encodings = [
+ ['COPYRECT', 0x01 ],
+ ['TIGHT', 0x07 ],
+ ['TIGHT_PNG', -260 ],
+ ['HEXTILE', 0x05 ],
+ ['RRE', 0x02 ],
+ ['RAW', 0x00 ],
+ ['DesktopSize', -223 ],
+ ['Cursor', -239 ],
+
+ // Psuedo-encoding settings
+ //['JPEG_quality_lo', -32 ],
+ ['JPEG_quality_med', -26 ],
+ //['JPEG_quality_hi', -23 ],
+ //['compress_lo', -255 ],
+ ['compress_hi', -247 ],
+ ['last_rect', -224 ]
+ ],
+
+ encHandlers = {},
+ encNames = {},
+ encStats = {}, // [rectCnt, rectCntTot]
+
+ ws = null, // Websock object
+ display = null, // Display object
+ keyboard = null, // Keyboard input handler object
+ mouse = null, // Mouse input handler object
+ sendTimer = null, // Send Queue check timer
+ connTimer = null, // connection timer
+ disconnTimer = null, // disconnection timer
+ msgTimer = null, // queued handle_message timer
+
+ // Frame buffer update state
+ FBU = {
+ rects : 0,
+ subrects : 0, // RRE
+ lines : 0, // RAW
+ tiles : 0, // HEXTILE
+ bytes : 0,
+ x : 0,
+ y : 0,
+ width : 0,
+ height : 0,
+ encoding : 0,
+ subencoding : -1,
+ background : null,
+ zlibs : [] // TIGHT zlib streams
+ },
+
+ fb_Bpp = 4,
+ fb_depth = 3,
+ fb_width = 0,
+ fb_height = 0,
+ fb_name = "",
+
+ last_req_time = 0,
+ rre_chunk_sz = 100,
+
+ timing = {
+ last_fbu : 0,
+ fbu_total : 0,
+ fbu_total_cnt : 0,
+ full_fbu_total : 0,
+ full_fbu_cnt : 0,
+
+ fbu_rt_start : 0,
+ fbu_rt_total : 0,
+ fbu_rt_cnt : 0,
+ pixels : 0
+ },
+
+ test_mode = false,
+
+ def_con_timeout = Websock_native ? 2 : 5,
+
+ /* Mouse state */
+ mouse_buttonMask = 0,
+ mouse_arr = [],
+ viewportDragging = false,
+ viewportDragPos = {};
+
+// Configuration attributes
+Util.conf_defaults(conf, that, defaults, [
+ ['target', 'wo', 'dom', null, 'VNC display rendering Canvas object'],
+ ['focusContainer', 'wo', 'dom', document, 'DOM element that captures keyboard input'],
+
+ ['encrypt', 'rw', 'bool', false, 'Use TLS/SSL/wss encryption'],
+ ['true_color', 'rw', 'bool', true, 'Request true color pixel data'],
+ ['local_cursor', 'rw', 'bool', false, 'Request locally rendered cursor'],
+ ['shared', 'rw', 'bool', true, 'Request shared mode'],
+ ['view_only', 'rw', 'bool', false, 'Disable client mouse/keyboard'],
+
+ ['connectTimeout', 'rw', 'int', def_con_timeout, 'Time (s) to wait for connection'],
+ ['disconnectTimeout', 'rw', 'int', 3, 'Time (s) to wait for disconnection'],
+
+ // UltraVNC repeater ID to connect to
+ ['repeaterID', 'rw', 'str', '', 'RepeaterID to connect to'],
+
+ ['viewportDrag', 'rw', 'bool', false, 'Move the viewport on mouse drags'],
+
+ ['check_rate', 'rw', 'int', 217, 'Timing (ms) of send/receive check'],
+ ['fbu_req_rate', 'rw', 'int', 1413, 'Timing (ms) of frameBufferUpdate requests'],
+
+ // Callback functions
+ ['onUpdateState', 'rw', 'func', function() { },
+ 'onUpdateState(rfb, state, oldstate, statusMsg): RFB state update/change '],
+ ['onPasswordRequired', 'rw', 'func', function() { },
+ 'onPasswordRequired(rfb): VNC password is required '],
+ ['onClipboard', 'rw', 'func', function() { },
+ 'onClipboard(rfb, text): RFB clipboard contents received'],
+ ['onBell', 'rw', 'func', function() { },
+ 'onBell(rfb): RFB Bell message received '],
+ ['onFBUReceive', 'rw', 'func', function() { },
+ 'onFBUReceive(rfb, fbu): RFB FBU received but not yet processed '],
+ ['onFBUComplete', 'rw', 'func', function() { },
+ 'onFBUComplete(rfb, fbu): RFB FBU received and processed '],
+
+ // These callback names are deprecated
+ ['updateState', 'rw', 'func', function() { },
+ 'obsolete, use onUpdateState'],
+ ['clipboardReceive', 'rw', 'func', function() { },
+ 'obsolete, use onClipboard']
+ ]);
+
+
+// Override/add some specific configuration getters/setters
+that.set_local_cursor = function(cursor) {
+ if ((!cursor) || (cursor in {'0':1, 'no':1, 'false':1})) {
+ conf.local_cursor = false;
+ } else {
+ if (display.get_cursor_uri()) {
+ conf.local_cursor = true;
+ } else {
+ Util.Warn("Browser does not support local cursor");
+ }
+ }
+};
+
+// These are fake configuration getters
+that.get_display = function() { return display; };
+
+that.get_keyboard = function() { return keyboard; };
+
+that.get_mouse = function() { return mouse; };
+
+
+
+//
+// Setup routines
+//
+
+// Create the public API interface and initialize values that stay
+// constant across connect/disconnect
+function constructor() {
+ var i, rmode;
+ Util.Debug(">> RFB.constructor");
+
+ // Create lookup tables based encoding number
+ for (i=0; i < encodings.length; i+=1) {
+ encHandlers[encodings[i][1]] = encHandlers[encodings[i][0]];
+ encNames[encodings[i][1]] = encodings[i][0];
+ encStats[encodings[i][1]] = [0, 0];
+ }
+ // Initialize display, mouse, keyboard, and websock
+ try {
+ display = new Display({'target': conf.target});
+ } catch (exc) {
+ Util.Error("Display exception: " + exc);
+ updateState('fatal', "No working Display");
+ }
+ keyboard = new Keyboard({'target': conf.focusContainer,
+ 'onKeyPress': keyPress});
+ mouse = new Mouse({'target': conf.target,
+ 'onMouseButton': mouseButton,
+ 'onMouseMove': mouseMove});
+
+ rmode = display.get_render_mode();
+
+ ws = new Websock();
+ ws.on('message', handle_message);
+ ws.on('open', function() {
+ if (rfb_state === "connect") {
+ updateState('ProtocolVersion', "Starting VNC handshake");
+ } else {
+ fail("Got unexpected WebSockets connection");
+ }
+ });
+ ws.on('close', function(e) {
+ Util.Warn("WebSocket on-close event");
+ var msg = "";
+ if (e.code) {
+ msg = " (code: " + e.code;
+ if (e.reason) {
+ msg += ", reason: " + e.reason;
+ }
+ msg += ")";
+ }
+ if (rfb_state === 'disconnect') {
+ updateState('disconnected', 'VNC disconnected' + msg);
+ } else if (rfb_state === 'ProtocolVersion') {
+ fail('Failed to connect to server' + msg);
+ } else if (rfb_state in {'failed':1, 'disconnected':1}) {
+ Util.Error("Received onclose while disconnected" + msg);
+ } else {
+ fail('Server disconnected' + msg);
+ }
+ });
+ ws.on('error', function(e) {
+ Util.Warn("WebSocket on-error event");
+ //fail("WebSock reported an error");
+ });
+
+
+ init_vars();
+
+ /* Check web-socket-js if no builtin WebSocket support */
+ if (Websock_native) {
+ Util.Info("Using native WebSockets");
+ updateState('loaded', 'noVNC ready: native WebSockets, ' + rmode);
+ } else {
+ Util.Warn("Using web-socket-js bridge. Flash version: " +
+ Util.Flash.version);
+ if ((! Util.Flash) ||
+ (Util.Flash.version < 9)) {
+ updateState('fatal', "WebSockets or <a href='http://get.adobe.com/flashplayer'>Adobe Flash<\/a> is required");
+ } else if (document.location.href.substr(0, 7) === "file://") {
+ updateState('fatal',
+ "'file://' URL is incompatible with Adobe Flash");
+ } else {
+ updateState('loaded', 'noVNC ready: WebSockets emulation, ' + rmode);
+ }
+ }
+
+ Util.Debug("<< RFB.constructor");
+ return that; // Return the public API interface
+}
+
+function connect() {
+ Util.Debug(">> RFB.connect");
+ var uri;
+
+ if (typeof UsingSocketIO !== "undefined") {
+ uri = "http://" + rfb_host + ":" + rfb_port + "/" + rfb_path;
+ } else {
+ if (conf.encrypt) {
+ uri = "wss://";
+ } else {
+ uri = "ws://";
+ }
+ uri += rfb_host + ":" + rfb_port + "/" + rfb_path;
+ }
+ Util.Info("connecting to " + uri);
+ ws.open(uri);
+
+ Util.Debug("<< RFB.connect");
+}
+
+// Initialize variables that are reset before each connection
+init_vars = function() {
+ var i;
+
+ /* Reset state */
+ ws.init();
+
+ FBU.rects = 0;
+ FBU.subrects = 0; // RRE and HEXTILE
+ FBU.lines = 0; // RAW
+ FBU.tiles = 0; // HEXTILE
+ FBU.zlibs = []; // TIGHT zlib encoders
+ mouse_buttonMask = 0;
+ mouse_arr = [];
+
+ // Clear the per connection encoding stats
+ for (i=0; i < encodings.length; i+=1) {
+ encStats[encodings[i][1]][0] = 0;
+ }
+
+ for (i=0; i < 4; i++) {
+ //FBU.zlibs[i] = new InflateStream();
+ FBU.zlibs[i] = new TINF();
+ FBU.zlibs[i].init();
+ }
+};
+
+// Print statistics
+print_stats = function() {
+ var i, s;
+ Util.Info("Encoding stats for this connection:");
+ for (i=0; i < encodings.length; i+=1) {
+ s = encStats[encodings[i][1]];
+ if ((s[0] + s[1]) > 0) {
+ Util.Info(" " + encodings[i][0] + ": " +
+ s[0] + " rects");
+ }
+ }
+ Util.Info("Encoding stats since page load:");
+ for (i=0; i < encodings.length; i+=1) {
+ s = encStats[encodings[i][1]];
+ if ((s[0] + s[1]) > 0) {
+ Util.Info(" " + encodings[i][0] + ": " +
+ s[1] + " rects");
+ }
+ }
+};
+
+//
+// Utility routines
+//
+
+
+/*
+ * Page states:
+ * loaded - page load, equivalent to disconnected
+ * disconnected - idle state
+ * connect - starting to connect (to ProtocolVersion)
+ * normal - connected
+ * disconnect - starting to disconnect
+ * failed - abnormal disconnect
+ * fatal - failed to load page, or fatal error
+ *
+ * RFB protocol initialization states:
+ * ProtocolVersion
+ * Security
+ * Authentication
+ * password - waiting for password, not part of RFB
+ * SecurityResult
+ * ClientInitialization - not triggered by server message
+ * ServerInitialization (to normal)
+ */
+updateState = function(state, statusMsg) {
+ var func, cmsg, oldstate = rfb_state;
+
+ if (state === oldstate) {
+ /* Already here, ignore */
+ Util.Debug("Already in state '" + state + "', ignoring.");
+ return;
+ }
+
+ /*
+ * These are disconnected states. A previous connect may
+ * asynchronously cause a connection so make sure we are closed.
+ */
+ if (state in {'disconnected':1, 'loaded':1, 'connect':1,
+ 'disconnect':1, 'failed':1, 'fatal':1}) {
+ if (sendTimer) {
+ clearInterval(sendTimer);
+ sendTimer = null;
+ }
+
+ if (msgTimer) {
+ clearInterval(msgTimer);
+ msgTimer = null;
+ }
+
+ if (display && display.get_context()) {
+ keyboard.ungrab();
+ mouse.ungrab();
+ display.defaultCursor();
+ if ((Util.get_logging() !== 'debug') ||
+ (state === 'loaded')) {
+ // Show noVNC logo on load and when disconnected if
+ // debug is off
+ display.clear();
+ }
+ }
+
+ ws.close();
+ }
+
+ if (oldstate === 'fatal') {
+ Util.Error("Fatal error, cannot continue");
+ }
+
+ if ((state === 'failed') || (state === 'fatal')) {
+ func = Util.Error;
+ } else {
+ func = Util.Warn;
+ }
+
+ cmsg = typeof(statusMsg) !== 'undefined' ? (" Msg: " + statusMsg) : "";
+ func("New state '" + state + "', was '" + oldstate + "'." + cmsg);
+
+ if ((oldstate === 'failed') && (state === 'disconnected')) {
+ // Do disconnect action, but stay in failed state
+ rfb_state = 'failed';
+ } else {
+ rfb_state = state;
+ }
+
+ if (connTimer && (rfb_state !== 'connect')) {
+ Util.Debug("Clearing connect timer");
+ clearInterval(connTimer);
+ connTimer = null;
+ }
+
+ if (disconnTimer && (rfb_state !== 'disconnect')) {
+ Util.Debug("Clearing disconnect timer");
+ clearInterval(disconnTimer);
+ disconnTimer = null;
+ }
+
+ switch (state) {
+ case 'normal':
+ if ((oldstate === 'disconnected') || (oldstate === 'failed')) {
+ Util.Error("Invalid transition from 'disconnected' or 'failed' to 'normal'");
+ }
+
+ break;
+
+
+ case 'connect':
+
+ connTimer = setTimeout(function () {
+ fail("Connect timeout");
+ }, conf.connectTimeout * 1000);
+
+ init_vars();
+ connect();
+
+ // WebSocket.onopen transitions to 'ProtocolVersion'
+ break;
+
+
+ case 'disconnect':
+
+ if (! test_mode) {
+ disconnTimer = setTimeout(function () {
+ fail("Disconnect timeout");
+ }, conf.disconnectTimeout * 1000);
+ }
+
+ print_stats();
+
+ // WebSocket.onclose transitions to 'disconnected'
+ break;
+
+
+ case 'failed':
+ if (oldstate === 'disconnected') {
+ Util.Error("Invalid transition from 'disconnected' to 'failed'");
+ }
+ if (oldstate === 'normal') {
+ Util.Error("Error while connected.");
+ }
+ if (oldstate === 'init') {
+ Util.Error("Error while initializing.");
+ }
+
+ // Make sure we transition to disconnected
+ setTimeout(function() { updateState('disconnected'); }, 50);
+
+ break;
+
+
+ default:
+ // No state change action to take
+
+ }
+
+ if ((oldstate === 'failed') && (state === 'disconnected')) {
+ // Leave the failed message
+ conf.updateState(that, state, oldstate); // Obsolete
+ conf.onUpdateState(that, state, oldstate);
+ } else {
+ conf.updateState(that, state, oldstate, statusMsg); // Obsolete
+ conf.onUpdateState(that, state, oldstate, statusMsg);
+ }
+};
+
+fail = function(msg) {
+ updateState('failed', msg);
+ return false;
+};
+
+handle_message = function() {
+ //Util.Debug(">> handle_message ws.rQlen(): " + ws.rQlen());
+ //Util.Debug("ws.rQslice(0,20): " + ws.rQslice(0,20) + " (" + ws.rQlen() + ")");
+ if (ws.rQlen() === 0) {
+ Util.Warn("handle_message called on empty receive queue");
+ return;
+ }
+ switch (rfb_state) {
+ case 'disconnected':
+ case 'failed':
+ Util.Error("Got data while disconnected");
+ break;
+ case 'normal':
+ if (normal_msg() && ws.rQlen() > 0) {
+ // true means we can continue processing
+ // Give other events a chance to run
+ if (msgTimer === null) {
+ Util.Debug("More data to process, creating timer");
+ msgTimer = setTimeout(function () {
+ msgTimer = null;
+ handle_message();
+ }, 10);
+ } else {
+ Util.Debug("More data to process, existing timer");
+ }
+ }
+ break;
+ default:
+ init_msg();
+ break;
+ }
+};
+
+
+function genDES(password, challenge) {
+ var i, passwd = [];
+ for (i=0; i < password.length; i += 1) {
+ passwd.push(password.charCodeAt(i));
+ }
+ return (new DES(passwd)).encrypt(challenge);
+}
+
+function flushClient() {
+ if (mouse_arr.length > 0) {
+ //send(mouse_arr.concat(fbUpdateRequests()));
+ ws.send(mouse_arr);
+ setTimeout(function() {
+ ws.send(fbUpdateRequests());
+ }, 50);
+
+ mouse_arr = [];
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// overridable for testing
+checkEvents = function() {
+ var now;
+ if (rfb_state === 'normal' && !viewportDragging) {
+ if (! flushClient()) {
+ now = new Date().getTime();
+ if (now > last_req_time + conf.fbu_req_rate) {
+ last_req_time = now;
+ ws.send(fbUpdateRequests());
+ }
+ }
+ }
+ setTimeout(checkEvents, conf.check_rate);
+};
+
+keyPress = function(keysym, down) {
+ var arr;
+
+ if (conf.view_only) { return; } // View only, skip keyboard events
+
+ arr = keyEvent(keysym, down);
+ arr = arr.concat(fbUpdateRequests());
+ ws.send(arr);
+};
+
+mouseButton = function(x, y, down, bmask) {
+ if (down) {
+ mouse_buttonMask |= bmask;
+ } else {
+ mouse_buttonMask ^= bmask;
+ }
+
+ if (conf.viewportDrag) {
+ if (down && !viewportDragging) {
+ viewportDragging = true;
+ viewportDragPos = {'x': x, 'y': y};
+
+ // Skip sending mouse events
+ return;
+ } else {
+ viewportDragging = false;
+ ws.send(fbUpdateRequests()); // Force immediate redraw
+ }
+ }
+
+ if (conf.view_only) { return; } // View only, skip mouse events
+
+ mouse_arr = mouse_arr.concat(
+ pointerEvent(display.absX(x), display.absY(y)) );
+ flushClient();
+};
+
+mouseMove = function(x, y) {
+ //Util.Debug('>> mouseMove ' + x + "," + y);
+ var deltaX, deltaY;
+
+ if (viewportDragging) {
+ //deltaX = x - viewportDragPos.x; // drag viewport
+ deltaX = viewportDragPos.x - x; // drag frame buffer
+ //deltaY = y - viewportDragPos.y; // drag viewport
+ deltaY = viewportDragPos.y - y; // drag frame buffer
+ viewportDragPos = {'x': x, 'y': y};
+
+ display.viewportChange(deltaX, deltaY);
+
+ // Skip sending mouse events
+ return;
+ }
+
+ if (conf.view_only) { return; } // View only, skip mouse events
+
+ mouse_arr = mouse_arr.concat(
+ pointerEvent(display.absX(x), display.absY(y)) );
+};
+
+
+//
+// Server message handlers
+//
+
+// RFB/VNC initialisation message handler
+init_msg = function() {
+ //Util.Debug(">> init_msg [rfb_state '" + rfb_state + "']");
+
+ var strlen, reason, length, sversion, cversion, repeaterID,
+ i, types, num_types, challenge, response, bpp, depth,
+ big_endian, red_max, green_max, blue_max, red_shift,
+ green_shift, blue_shift, true_color, name_length, is_repeater;
+
+ //Util.Debug("ws.rQ (" + ws.rQlen() + ") " + ws.rQslice(0));
+ switch (rfb_state) {
+
+ case 'ProtocolVersion' :
+ if (ws.rQlen() < 12) {
+ return fail("Incomplete protocol version");
+ }
+ sversion = ws.rQshiftStr(12).substr(4,7);
+ Util.Info("Server ProtocolVersion: " + sversion);
+ is_repeater = 0;
+ switch (sversion) {
+ case "000.000": is_repeater = 1; break; // UltraVNC repeater
+ case "003.003": rfb_version = 3.3; break;
+ case "003.006": rfb_version = 3.3; break; // UltraVNC
+ case "003.889": rfb_version = 3.3; break; // Apple Remote Desktop
+ case "003.007": rfb_version = 3.7; break;
+ case "003.008": rfb_version = 3.8; break;
+ case "004.000": rfb_version = 3.8; break; // Intel AMT KVM
+ case "004.001": rfb_version = 3.8; break; // RealVNC 4.6
+ default:
+ return fail("Invalid server version " + sversion);
+ }
+ if (is_repeater) {
+ repeaterID = conf.repeaterID;
+ while (repeaterID.length < 250) {
+ repeaterID += "\0";
+ }
+ ws.send_string(repeaterID);
+ break;
+ }
+ if (rfb_version > rfb_max_version) {
+ rfb_version = rfb_max_version;
+ }
+
+ if (! test_mode) {
+ sendTimer = setInterval(function() {
+ // Send updates either at a rate of one update
+ // every 50ms, or whatever slower rate the network
+ // can handle.
+ ws.flush();
+ }, 50);
+ }
+
+ cversion = "00" + parseInt(rfb_version,10) +
+ ".00" + ((rfb_version * 10) % 10);
+ ws.send_string("RFB " + cversion + "\n");
+ updateState('Security', "Sent ProtocolVersion: " + cversion);
+ break;
+
+ case 'Security' :
+ if (rfb_version >= 3.7) {
+ // Server sends supported list, client decides
+ num_types = ws.rQshift8();
+ if (ws.rQwait("security type", num_types, 1)) { return false; }
+ if (num_types === 0) {
+ strlen = ws.rQshift32();
+ reason = ws.rQshiftStr(strlen);
+ return fail("Security failure: " + reason);
+ }
+ rfb_auth_scheme = 0;
+ types = ws.rQshiftBytes(num_types);
+ Util.Debug("Server security types: " + types);
+ for (i=0; i < types.length; i+=1) {
+ if ((types[i] > rfb_auth_scheme) && (types[i] < 3)) {
+ rfb_auth_scheme = types[i];
+ }
+ }
+ if (rfb_auth_scheme === 0) {
+ return fail("Unsupported security types: " + types);
+ }
+
+ ws.send([rfb_auth_scheme]);
+ } else {
+ // Server decides
+ if (ws.rQwait("security scheme", 4)) { return false; }
+ rfb_auth_scheme = ws.rQshift32();
+ }
+ updateState('Authentication',
+ "Authenticating using scheme: " + rfb_auth_scheme);
+ init_msg(); // Recursive fallthrough (workaround JSLint complaint)
+ break;
+
+ // Triggered by fallthough, not by server message
+ case 'Authentication' :
+ //Util.Debug("Security auth scheme: " + rfb_auth_scheme);
+ switch (rfb_auth_scheme) {
+ case 0: // connection failed
+ if (ws.rQwait("auth reason", 4)) { return false; }
+ strlen = ws.rQshift32();
+ reason = ws.rQshiftStr(strlen);
+ return fail("Auth failure: " + reason);
+ case 1: // no authentication
+ if (rfb_version >= 3.8) {
+ updateState('SecurityResult');
+ return;
+ }
+ // Fall through to ClientInitialisation
+ break;
+ case 2: // VNC authentication
+ if (rfb_password.length === 0) {
+ // Notify via both callbacks since it is kind of
+ // a RFB state change and a UI interface issue.
+ updateState('password', "Password Required");
+ conf.onPasswordRequired(that);
+ return;
+ }
+ if (ws.rQwait("auth challenge", 16)) { return false; }
+ challenge = ws.rQshiftBytes(16);
+ //Util.Debug("Password: " + rfb_password);
+ //Util.Debug("Challenge: " + challenge +
+ // " (" + challenge.length + ")");
+ response = genDES(rfb_password, challenge);
+ //Util.Debug("Response: " + response +
+ // " (" + response.length + ")");
+
+ //Util.Debug("Sending DES encrypted auth response");
+ ws.send(response);
+ updateState('SecurityResult');
+ return;
+ default:
+ fail("Unsupported auth scheme: " + rfb_auth_scheme);
+ return;
+ }
+ updateState('ClientInitialisation', "No auth required");
+ init_msg(); // Recursive fallthrough (workaround JSLint complaint)
+ break;
+
+ case 'SecurityResult' :
+ if (ws.rQwait("VNC auth response ", 4)) { return false; }
+ switch (ws.rQshift32()) {
+ case 0: // OK
+ // Fall through to ClientInitialisation
+ break;
+ case 1: // failed
+ if (rfb_version >= 3.8) {
+ length = ws.rQshift32();
+ if (ws.rQwait("SecurityResult reason", length, 8)) {
+ return false;
+ }
+ reason = ws.rQshiftStr(length);
+ fail(reason);
+ } else {
+ fail("Authentication failed");
+ }
+ return;
+ case 2: // too-many
+ return fail("Too many auth attempts");
+ }
+ updateState('ClientInitialisation', "Authentication OK");
+ init_msg(); // Recursive fallthrough (workaround JSLint complaint)
+ break;
+
+ // Triggered by fallthough, not by server message
+ case 'ClientInitialisation' :
+ ws.send([conf.shared ? 1 : 0]); // ClientInitialisation
+ updateState('ServerInitialisation', "Authentication OK");
+ break;
+
+ case 'ServerInitialisation' :
+ if (ws.rQwait("server initialization", 24)) { return false; }
+
+ /* Screen size */
+ fb_width = ws.rQshift16();
+ fb_height = ws.rQshift16();
+
+ /* PIXEL_FORMAT */
+ bpp = ws.rQshift8();
+ depth = ws.rQshift8();
+ big_endian = ws.rQshift8();
+ true_color = ws.rQshift8();
+
+ red_max = ws.rQshift16();
+ green_max = ws.rQshift16();
+ blue_max = ws.rQshift16();
+ red_shift = ws.rQshift8();
+ green_shift = ws.rQshift8();
+ blue_shift = ws.rQshift8();
+ ws.rQshiftStr(3); // padding
+
+ Util.Info("Screen: " + fb_width + "x" + fb_height +
+ ", bpp: " + bpp + ", depth: " + depth +
+ ", big_endian: " + big_endian +
+ ", true_color: " + true_color +
+ ", red_max: " + red_max +
+ ", green_max: " + green_max +
+ ", blue_max: " + blue_max +
+ ", red_shift: " + red_shift +
+ ", green_shift: " + green_shift +
+ ", blue_shift: " + blue_shift);
+
+ if (big_endian !== 0) {
+ Util.Warn("Server native endian is not little endian");
+ }
+ if (red_shift !== 16) {
+ Util.Warn("Server native red-shift is not 16");
+ }
+ if (blue_shift !== 0) {
+ Util.Warn("Server native blue-shift is not 0");
+ }
+
+ /* Connection name/title */
+ name_length = ws.rQshift32();
+ fb_name = ws.rQshiftStr(name_length);
+
+ if (conf.true_color && fb_name === "Intel(r) AMT KVM")
+ {
+ Util.Warn("Intel AMT KVM only support 8/16 bit depths. Disabling true color");
+ conf.true_color = false;
+ }
+
+ display.set_true_color(conf.true_color);
+ display.resize(fb_width, fb_height);
+ keyboard.grab();
+ mouse.grab();
+
+ if (conf.true_color) {
+ fb_Bpp = 4;
+ fb_depth = 3;
+ } else {
+ fb_Bpp = 1;
+ fb_depth = 1;
+ }
+
+ response = pixelFormat();
+ response = response.concat(clientEncodings());
+ response = response.concat(fbUpdateRequests());
+ timing.fbu_rt_start = (new Date()).getTime();
+ timing.pixels = 0;
+ ws.send(response);
+
+ /* Start pushing/polling */
+ setTimeout(checkEvents, conf.check_rate);
+
+ if (conf.encrypt) {
+ updateState('normal', "Connected (encrypted) to: " + fb_name);
+ } else {
+ updateState('normal', "Connected (unencrypted) to: " + fb_name);
+ }
+ break;
+ }
+ //Util.Debug("<< init_msg");
+};
+
+
+/* Normal RFB/VNC server message handler */
+normal_msg = function() {
+ //Util.Debug(">> normal_msg");
+
+ var ret = true, msg_type, length, text,
+ c, first_colour, num_colours, red, green, blue;
+
+ if (FBU.rects > 0) {
+ msg_type = 0;
+ } else {
+ msg_type = ws.rQshift8();
+ }
+ switch (msg_type) {
+ case 0: // FramebufferUpdate
+ ret = framebufferUpdate(); // false means need more data
+ break;
+ case 1: // SetColourMapEntries
+ Util.Debug("SetColourMapEntries");
+ ws.rQshift8(); // Padding
+ first_colour = ws.rQshift16(); // First colour
+ num_colours = ws.rQshift16();
+ if (ws.rQwait("SetColourMapEntries", num_colours*6, 6)) { return false; }
+
+ for (c=0; c < num_colours; c+=1) {
+ red = ws.rQshift16();
+ //Util.Debug("red before: " + red);
+ red = parseInt(red / 256, 10);
+ //Util.Debug("red after: " + red);
+ green = parseInt(ws.rQshift16() / 256, 10);
+ blue = parseInt(ws.rQshift16() / 256, 10);
+ display.set_colourMap([blue, green, red], first_colour + c);
+ }
+ Util.Debug("colourMap: " + display.get_colourMap());
+ Util.Info("Registered " + num_colours + " colourMap entries");
+ //Util.Debug("colourMap: " + display.get_colourMap());
+ break;
+ case 2: // Bell
+ Util.Debug("Bell");
+ conf.onBell(that);
+ break;
+ case 3: // ServerCutText
+ Util.Debug("ServerCutText");
+ if (ws.rQwait("ServerCutText header", 7, 1)) { return false; }
+ ws.rQshiftBytes(3); // Padding
+ length = ws.rQshift32();
+ if (ws.rQwait("ServerCutText", length, 8)) { return false; }
+
+ text = ws.rQshiftStr(length);
+ conf.clipboardReceive(that, text); // Obsolete
+ conf.onClipboard(that, text);
+ break;
+ default:
+ fail("Disconnected: illegal server message type " + msg_type);
+ Util.Debug("ws.rQslice(0,30):" + ws.rQslice(0,30));
+ break;
+ }
+ //Util.Debug("<< normal_msg");
+ return ret;
+};
+
+framebufferUpdate = function() {
+ var now, hdr, fbu_rt_diff, ret = true;
+
+ if (FBU.rects === 0) {
+ //Util.Debug("New FBU: ws.rQslice(0,20): " + ws.rQslice(0,20));
+ if (ws.rQwait("FBU header", 3)) {
+ ws.rQunshift8(0); // FBU msg_type
+ return false;
+ }
+ ws.rQshift8(); // padding
+ FBU.rects = ws.rQshift16();
+ //Util.Debug("FramebufferUpdate, rects:" + FBU.rects);
+ FBU.bytes = 0;
+ timing.cur_fbu = 0;
+ if (timing.fbu_rt_start > 0) {
+ now = (new Date()).getTime();
+ Util.Info("First FBU latency: " + (now - timing.fbu_rt_start));
+ }
+ }
+
+ while (FBU.rects > 0) {
+ if (rfb_state !== "normal") {
+ return false;
+ }
+ if (ws.rQwait("FBU", FBU.bytes)) { return false; }
+ if (FBU.bytes === 0) {
+ if (ws.rQwait("rect header", 12)) { return false; }
+ /* New FramebufferUpdate */
+
+ hdr = ws.rQshiftBytes(12);
+ FBU.x = (hdr[0] << 8) + hdr[1];
+ FBU.y = (hdr[2] << 8) + hdr[3];
+ FBU.width = (hdr[4] << 8) + hdr[5];
+ FBU.height = (hdr[6] << 8) + hdr[7];
+ FBU.encoding = parseInt((hdr[8] << 24) + (hdr[9] << 16) +
+ (hdr[10] << 8) + hdr[11], 10);
+
+ conf.onFBUReceive(that,
+ {'x': FBU.x, 'y': FBU.y,
+ 'width': FBU.width, 'height': FBU.height,
+ 'encoding': FBU.encoding,
+ 'encodingName': encNames[FBU.encoding]});
+
+ if (encNames[FBU.encoding]) {
+ // Debug:
+ /*
+ var msg = "FramebufferUpdate rects:" + FBU.rects;
+ msg += " x: " + FBU.x + " y: " + FBU.y;
+ msg += " width: " + FBU.width + " height: " + FBU.height;
+ msg += " encoding:" + FBU.encoding;
+ msg += "(" + encNames[FBU.encoding] + ")";
+ msg += ", ws.rQlen(): " + ws.rQlen();
+ Util.Debug(msg);
+ */
+ } else {
+ fail("Disconnected: unsupported encoding " +
+ FBU.encoding);
+ return false;
+ }
+ }
+
+ timing.last_fbu = (new Date()).getTime();
+
+ ret = encHandlers[FBU.encoding]();
+
+ now = (new Date()).getTime();
+ timing.cur_fbu += (now - timing.last_fbu);
+
+ if (ret) {
+ encStats[FBU.encoding][0] += 1;
+ encStats[FBU.encoding][1] += 1;
+ timing.pixels += FBU.width * FBU.height;
+ }
+
+ if (timing.pixels >= (fb_width * fb_height)) {
+ if (((FBU.width === fb_width) &&
+ (FBU.height === fb_height)) ||
+ (timing.fbu_rt_start > 0)) {
+ timing.full_fbu_total += timing.cur_fbu;
+ timing.full_fbu_cnt += 1;
+ Util.Info("Timing of full FBU, cur: " +
+ timing.cur_fbu + ", total: " +
+ timing.full_fbu_total + ", cnt: " +
+ timing.full_fbu_cnt + ", avg: " +
+ (timing.full_fbu_total /
+ timing.full_fbu_cnt));
+ }
+ if (timing.fbu_rt_start > 0) {
+ fbu_rt_diff = now - timing.fbu_rt_start;
+ timing.fbu_rt_total += fbu_rt_diff;
+ timing.fbu_rt_cnt += 1;
+ Util.Info("full FBU round-trip, cur: " +
+ fbu_rt_diff + ", total: " +
+ timing.fbu_rt_total + ", cnt: " +
+ timing.fbu_rt_cnt + ", avg: " +
+ (timing.fbu_rt_total /
+ timing.fbu_rt_cnt));
+ timing.fbu_rt_start = 0;
+ }
+ }
+ if (! ret) {
+ return ret; // false ret means need more data
+ }
+ }
+
+ conf.onFBUComplete(that,
+ {'x': FBU.x, 'y': FBU.y,
+ 'width': FBU.width, 'height': FBU.height,
+ 'encoding': FBU.encoding,
+ 'encodingName': encNames[FBU.encoding]});
+
+ return true; // We finished this FBU
+};
+
+//
+// FramebufferUpdate encodings
+//
+
+encHandlers.RAW = function display_raw() {
+ //Util.Debug(">> display_raw (" + ws.rQlen() + " bytes)");
+
+ var cur_y, cur_height;
+
+ if (FBU.lines === 0) {
+ FBU.lines = FBU.height;
+ }
+ FBU.bytes = FBU.width * fb_Bpp; // At least a line
+ if (ws.rQwait("RAW", FBU.bytes)) { return false; }
+ cur_y = FBU.y + (FBU.height - FBU.lines);
+ cur_height = Math.min(FBU.lines,
+ Math.floor(ws.rQlen()/(FBU.width * fb_Bpp)));
+ display.blitImage(FBU.x, cur_y, FBU.width, cur_height,
+ ws.get_rQ(), ws.get_rQi());
+ ws.rQshiftBytes(FBU.width * cur_height * fb_Bpp);
+ FBU.lines -= cur_height;
+
+ if (FBU.lines > 0) {
+ FBU.bytes = FBU.width * fb_Bpp; // At least another line
+ } else {
+ FBU.rects -= 1;
+ FBU.bytes = 0;
+ }
+ //Util.Debug("<< display_raw (" + ws.rQlen() + " bytes)");
+ return true;
+};
+
+encHandlers.COPYRECT = function display_copy_rect() {
+ //Util.Debug(">> display_copy_rect");
+
+ var old_x, old_y;
+
+ if (ws.rQwait("COPYRECT", 4)) { return false; }
+ display.renderQ_push({
+ 'type': 'copy',
+ 'old_x': ws.rQshift16(),
+ 'old_y': ws.rQshift16(),
+ 'x': FBU.x,
+ 'y': FBU.y,
+ 'width': FBU.width,
+ 'height': FBU.height});
+ FBU.rects -= 1;
+ FBU.bytes = 0;
+ return true;
+};
+
+encHandlers.RRE = function display_rre() {
+ //Util.Debug(">> display_rre (" + ws.rQlen() + " bytes)");
+ var color, x, y, width, height, chunk;
+
+ if (FBU.subrects === 0) {
+ if (ws.rQwait("RRE", 4+fb_Bpp)) { return false; }
+ FBU.subrects = ws.rQshift32();
+ color = ws.rQshiftBytes(fb_Bpp); // Background
+ display.fillRect(FBU.x, FBU.y, FBU.width, FBU.height, color);
+ }
+ while ((FBU.subrects > 0) && (ws.rQlen() >= (fb_Bpp + 8))) {
+ color = ws.rQshiftBytes(fb_Bpp);
+ x = ws.rQshift16();
+ y = ws.rQshift16();
+ width = ws.rQshift16();
+ height = ws.rQshift16();
+ display.fillRect(FBU.x + x, FBU.y + y, width, height, color);
+ FBU.subrects -= 1;
+ }
+ //Util.Debug(" display_rre: rects: " + FBU.rects +
+ // ", FBU.subrects: " + FBU.subrects);
+
+ if (FBU.subrects > 0) {
+ chunk = Math.min(rre_chunk_sz, FBU.subrects);
+ FBU.bytes = (fb_Bpp + 8) * chunk;
+ } else {
+ FBU.rects -= 1;
+ FBU.bytes = 0;
+ }
+ //Util.Debug("<< display_rre, FBU.bytes: " + FBU.bytes);
+ return true;
+};
+
+encHandlers.HEXTILE = function display_hextile() {
+ //Util.Debug(">> display_hextile");
+ var subencoding, subrects, color, cur_tile,
+ tile_x, x, w, tile_y, y, h, xy, s, sx, sy, wh, sw, sh,
+ rQ = ws.get_rQ(), rQi = ws.get_rQi();
+
+ if (FBU.tiles === 0) {
+ FBU.tiles_x = Math.ceil(FBU.width/16);
+ FBU.tiles_y = Math.ceil(FBU.height/16);
+ FBU.total_tiles = FBU.tiles_x * FBU.tiles_y;
+ FBU.tiles = FBU.total_tiles;
+ }
+
+ /* FBU.bytes comes in as 1, ws.rQlen() at least 1 */
+ while (FBU.tiles > 0) {
+ FBU.bytes = 1;
+ if (ws.rQwait("HEXTILE subencoding", FBU.bytes)) { return false; }
+ subencoding = rQ[rQi]; // Peek
+ if (subencoding > 30) { // Raw
+ fail("Disconnected: illegal hextile subencoding " + subencoding);
+ //Util.Debug("ws.rQslice(0,30):" + ws.rQslice(0,30));
+ return false;
+ }
+ subrects = 0;
+ cur_tile = FBU.total_tiles - FBU.tiles;
+ tile_x = cur_tile % FBU.tiles_x;
+ tile_y = Math.floor(cur_tile / FBU.tiles_x);
+ x = FBU.x + tile_x * 16;
+ y = FBU.y + tile_y * 16;
+ w = Math.min(16, (FBU.x + FBU.width) - x);
+ h = Math.min(16, (FBU.y + FBU.height) - y);
+
+ /* Figure out how much we are expecting */
+ if (subencoding & 0x01) { // Raw
+ //Util.Debug(" Raw subencoding");
+ FBU.bytes += w * h * fb_Bpp;
+ } else {
+ if (subencoding & 0x02) { // Background
+ FBU.bytes += fb_Bpp;
+ }
+ if (subencoding & 0x04) { // Foreground
+ FBU.bytes += fb_Bpp;
+ }
+ if (subencoding & 0x08) { // AnySubrects
+ FBU.bytes += 1; // Since we aren't shifting it off
+ if (ws.rQwait("hextile subrects header", FBU.bytes)) { return false; }
+ subrects = rQ[rQi + FBU.bytes-1]; // Peek
+ if (subencoding & 0x10) { // SubrectsColoured
+ FBU.bytes += subrects * (fb_Bpp + 2);
+ } else {
+ FBU.bytes += subrects * 2;
+ }
+ }
+ }
+
+ /*
+ Util.Debug(" tile:" + cur_tile + "/" + (FBU.total_tiles - 1) +
+ " (" + tile_x + "," + tile_y + ")" +
+ " [" + x + "," + y + "]@" + w + "x" + h +
+ ", subenc:" + subencoding +
+ "(last: " + FBU.lastsubencoding + "), subrects:" +
+ subrects +
+ ", ws.rQlen():" + ws.rQlen() + ", FBU.bytes:" + FBU.bytes +
+ " last:" + ws.rQslice(FBU.bytes-10, FBU.bytes) +
+ " next:" + ws.rQslice(FBU.bytes-1, FBU.bytes+10));
+ */
+ if (ws.rQwait("hextile", FBU.bytes)) { return false; }
+
+ /* We know the encoding and have a whole tile */
+ FBU.subencoding = rQ[rQi];
+ rQi += 1;
+ if (FBU.subencoding === 0) {
+ if (FBU.lastsubencoding & 0x01) {
+ /* Weird: ignore blanks after RAW */
+ Util.Debug(" Ignoring blank after RAW");
+ } else {
+ display.fillRect(x, y, w, h, FBU.background);
+ }
+ } else if (FBU.subencoding & 0x01) { // Raw
+ display.blitImage(x, y, w, h, rQ, rQi);
+ rQi += FBU.bytes - 1;
+ } else {
+ if (FBU.subencoding & 0x02) { // Background
+ FBU.background = rQ.slice(rQi, rQi + fb_Bpp);
+ rQi += fb_Bpp;
+ }
+ if (FBU.subencoding & 0x04) { // Foreground
+ FBU.foreground = rQ.slice(rQi, rQi + fb_Bpp);
+ rQi += fb_Bpp;
+ }
+
+ display.startTile(x, y, w, h, FBU.background);
+ if (FBU.subencoding & 0x08) { // AnySubrects
+ subrects = rQ[rQi];
+ rQi += 1;
+ for (s = 0; s < subrects; s += 1) {
+ if (FBU.subencoding & 0x10) { // SubrectsColoured
+ color = rQ.slice(rQi, rQi + fb_Bpp);
+ rQi += fb_Bpp;
+ } else {
+ color = FBU.foreground;
+ }
+ xy = rQ[rQi];
+ rQi += 1;
+ sx = (xy >> 4);
+ sy = (xy & 0x0f);
+
+ wh = rQ[rQi];
+ rQi += 1;
+ sw = (wh >> 4) + 1;
+ sh = (wh & 0x0f) + 1;
+
+ display.subTile(sx, sy, sw, sh, color);
+ }
+ }
+ display.finishTile();
+ }
+ ws.set_rQi(rQi);
+ FBU.lastsubencoding = FBU.subencoding;
+ FBU.bytes = 0;
+ FBU.tiles -= 1;
+ }
+
+ if (FBU.tiles === 0) {
+ FBU.rects -= 1;
+ }
+
+ //Util.Debug("<< display_hextile");
+ return true;
+};
+
+
+// Get 'compact length' header and data size
+getTightCLength = function (arr) {
+ var header = 1, data = 0;
+ data += arr[0] & 0x7f;
+ if (arr[0] & 0x80) {
+ header += 1;
+ data += (arr[1] & 0x7f) << 7;
+ if (arr[1] & 0x80) {
+ header += 1;
+ data += arr[2] << 14;
+ }
+ }
+ return [header, data];
+};
+
+function display_tight(isTightPNG) {
+ //Util.Debug(">> display_tight");
+
+ if (fb_depth === 1) {
+ fail("Tight protocol handler only implements true color mode");
+ }
+
+ var ctl, cmode, clength, color, img, data;
+ var filterId = -1, resetStreams = 0, streamId = -1;
+ var rQ = ws.get_rQ(), rQi = ws.get_rQi();
+
+ FBU.bytes = 1; // compression-control byte
+ if (ws.rQwait("TIGHT compression-control", FBU.bytes)) { return false; }
+
+ var checksum = function(data) {
+ var sum=0, i;
+ for (i=0; i<data.length;i++) {
+ sum += data[i];
+ if (sum > 65536) sum -= 65536;
+ }
+ return sum;
+ }
+
+ var decompress = function(data) {
+ for (var i=0; i<4; i++) {
+ if ((resetStreams >> i) & 1) {
+ FBU.zlibs[i].reset();
+ Util.Info("Reset zlib stream " + i);
+ }
+ }
+ var uncompressed = FBU.zlibs[streamId].uncompress(data, 0);
+ if (uncompressed.status !== 0) {
+ Util.Error("Invalid data in zlib stream");
+ }
+ //Util.Warn("Decompressed " + data.length + " to " +
+ // uncompressed.data.length + " checksums " +
+ // checksum(data) + ":" + checksum(uncompressed.data));
+
+ return uncompressed.data;
+ }
+
+ var handlePalette = function() {
+ var numColors = rQ[rQi + 2] + 1;
+ var paletteSize = numColors * fb_depth;
+ FBU.bytes += paletteSize;
+ if (ws.rQwait("TIGHT palette " + cmode, FBU.bytes)) { return false; }
+
+ var bpp = (numColors <= 2) ? 1 : 8;
+ var rowSize = Math.floor((FBU.width * bpp + 7) / 8);
+ var raw = false;
+ if (rowSize * FBU.height < 12) {
+ raw = true;
+ clength = [0, rowSize * FBU.height];
+ } else {
+ clength = getTightCLength(ws.rQslice(3 + paletteSize,
+ 3 + paletteSize + 3));
+ }
+ FBU.bytes += clength[0] + clength[1];
+ if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; }
+
+ // Shift ctl, filter id, num colors, palette entries, and clength off
+ ws.rQshiftBytes(3);
+ var palette = ws.rQshiftBytes(paletteSize);
+ ws.rQshiftBytes(clength[0]);
+
+ if (raw) {
+ data = ws.rQshiftBytes(clength[1]);
+ } else {
+ data = decompress(ws.rQshiftBytes(clength[1]));
+ }
+
+ // Convert indexed (palette based) image data to RGB
+ // TODO: reduce number of calculations inside loop
+ var dest = [];
+ var x, y, b, w, w1, dp, sp;
+ if (numColors === 2) {
+ w = Math.floor((FBU.width + 7) / 8);
+ w1 = Math.floor(FBU.width / 8);
+ for (y = 0; y < FBU.height; y++) {
+ for (x = 0; x < w1; x++) {
+ for (b = 7; b >= 0; b--) {
+ dp = (y*FBU.width + x*8 + 7-b) * 3;
+ sp = (data[y*w + x] >> b & 1) * 3;
+ dest[dp ] = palette[sp ];
+ dest[dp+1] = palette[sp+1];
+ dest[dp+2] = palette[sp+2];
+ }
+ }
+ for (b = 7; b >= 8 - FBU.width % 8; b--) {
+ dp = (y*FBU.width + x*8 + 7-b) * 3;
+ sp = (data[y*w + x] >> b & 1) * 3;
+ dest[dp ] = palette[sp ];
+ dest[dp+1] = palette[sp+1];
+ dest[dp+2] = palette[sp+2];
+ }
+ }
+ } else {
+ for (y = 0; y < FBU.height; y++) {
+ for (x = 0; x < FBU.width; x++) {
+ dp = (y*FBU.width + x) * 3;
+ sp = data[y*FBU.width + x] * 3;
+ dest[dp ] = palette[sp ];
+ dest[dp+1] = palette[sp+1];
+ dest[dp+2] = palette[sp+2];
+ }
+ }
+ }
+
+ display.renderQ_push({
+ 'type': 'blitRgb',
+ 'data': dest,
+ 'x': FBU.x,
+ 'y': FBU.y,
+ 'width': FBU.width,
+ 'height': FBU.height});
+ return true;
+ }
+
+ var handleCopy = function() {
+ var raw = false;
+ var uncompressedSize = FBU.width * FBU.height * fb_depth;
+ if (uncompressedSize < 12) {
+ raw = true;
+ clength = [0, uncompressedSize];
+ } else {
+ clength = getTightCLength(ws.rQslice(1, 4));
+ }
+ FBU.bytes = 1 + clength[0] + clength[1];
+ if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; }
+
+ // Shift ctl, clength off
+ ws.rQshiftBytes(1 + clength[0]);
+
+ if (raw) {
+ data = ws.rQshiftBytes(clength[1]);
+ } else {
+ data = decompress(ws.rQshiftBytes(clength[1]));
+ }
+
+ display.renderQ_push({
+ 'type': 'blitRgb',
+ 'data': data,
+ 'x': FBU.x,
+ 'y': FBU.y,
+ 'width': FBU.width,
+ 'height': FBU.height});
+ return true;
+ }
+
+ ctl = ws.rQpeek8();
+
+ // Keep tight reset bits
+ resetStreams = ctl & 0xF;
+
+ // Figure out filter
+ ctl = ctl >> 4;
+ streamId = ctl & 0x3;
+
+ if (ctl === 0x08) cmode = "fill";
+ else if (ctl === 0x09) cmode = "jpeg";
+ else if (ctl === 0x0A) cmode = "png";
+ else if (ctl & 0x04) cmode = "filter";
+ else if (ctl < 0x04) cmode = "copy";
+ else return fail("Illegal tight compression received, ctl: " + ctl);
+
+ if (isTightPNG && (cmode === "filter" || cmode === "copy")) {
+ return fail("filter/copy received in tightPNG mode");
+ }
+
+ switch (cmode) {
+ // fill uses fb_depth because TPIXELs drop the padding byte
+ case "fill": FBU.bytes += fb_depth; break; // TPIXEL
+ case "jpeg": FBU.bytes += 3; break; // max clength
+ case "png": FBU.bytes += 3; break; // max clength
+ case "filter": FBU.bytes += 2; break; // filter id + num colors if palette
+ case "copy": break;
+ }
+
+ if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; }
+
+ //Util.Debug(" ws.rQslice(0,20): " + ws.rQslice(0,20) + " (" + ws.rQlen() + ")");
+ //Util.Debug(" cmode: " + cmode);
+
+ // Determine FBU.bytes
+ switch (cmode) {
+ case "fill":
+ ws.rQshift8(); // shift off ctl
+ color = ws.rQshiftBytes(fb_depth);
+ display.renderQ_push({
+ 'type': 'fill',
+ 'x': FBU.x,
+ 'y': FBU.y,
+ 'width': FBU.width,
+ 'height': FBU.height,
+ 'color': [color[2], color[1], color[0]] });
+ break;
+ case "png":
+ case "jpeg":
+ clength = getTightCLength(ws.rQslice(1, 4));
+ FBU.bytes = 1 + clength[0] + clength[1]; // ctl + clength size + jpeg-data
+ if (ws.rQwait("TIGHT " + cmode, FBU.bytes)) { return false; }
+
+ // We have everything, render it
+ //Util.Debug(" jpeg, ws.rQlen(): " + ws.rQlen() + ", clength[0]: " +
+ // clength[0] + ", clength[1]: " + clength[1]);
+ ws.rQshiftBytes(1 + clength[0]); // shift off ctl + compact length
+ img = new Image();
+ img.src = "data:image/" + cmode +
+ extract_data_uri(ws.rQshiftBytes(clength[1]));
+ display.renderQ_push({
+ 'type': 'img',
+ 'img': img,
+ 'x': FBU.x,
+ 'y': FBU.y});
+ img = null;
+ break;
+ case "filter":
+ filterId = rQ[rQi + 1];
+ if (filterId === 1) {
+ if (!handlePalette()) { return false; }
+ } else {
+ // Filter 0, Copy could be valid here, but servers don't send it as an explicit filter
+ // Filter 2, Gradient is valid but not used if jpeg is enabled
+ throw("Unsupported tight subencoding received, filter: " + filterId);
+ }
+ break;
+ case "copy":
+ if (!handleCopy()) { return false; }
+ break;
+ }
+
+ FBU.bytes = 0;
+ FBU.rects -= 1;
+ //Util.Debug(" ending ws.rQslice(0,20): " + ws.rQslice(0,20) + " (" + ws.rQlen() + ")");
+ //Util.Debug("<< display_tight_png");
+ return true;
+}
+
+extract_data_uri = function(arr) {
+ //var i, stra = [];
+ //for (i=0; i< arr.length; i += 1) {
+ // stra.push(String.fromCharCode(arr[i]));
+ //}
+ //return "," + escape(stra.join(''));
+ return ";base64," + Base64.encode(arr);
+};
+
+encHandlers.TIGHT = function () { return display_tight(false); };
+encHandlers.TIGHT_PNG = function () { return display_tight(true); };
+
+encHandlers.last_rect = function last_rect() {
+ //Util.Debug(">> last_rect");
+ FBU.rects = 0;
+ //Util.Debug("<< last_rect");
+ return true;
+};
+
+encHandlers.DesktopSize = function set_desktopsize() {
+ Util.Debug(">> set_desktopsize");
+ fb_width = FBU.width;
+ fb_height = FBU.height;
+ display.resize(fb_width, fb_height);
+ timing.fbu_rt_start = (new Date()).getTime();
+ // Send a new non-incremental request
+ ws.send(fbUpdateRequests());
+
+ FBU.bytes = 0;
+ FBU.rects -= 1;
+
+ Util.Debug("<< set_desktopsize");
+ return true;
+};
+
+encHandlers.Cursor = function set_cursor() {
+ var x, y, w, h, pixelslength, masklength;
+ Util.Debug(">> set_cursor");
+ x = FBU.x; // hotspot-x
+ y = FBU.y; // hotspot-y
+ w = FBU.width;
+ h = FBU.height;
+
+ pixelslength = w * h * fb_Bpp;
+ masklength = Math.floor((w + 7) / 8) * h;
+
+ FBU.bytes = pixelslength + masklength;
+ if (ws.rQwait("cursor encoding", FBU.bytes)) { return false; }
+
+ //Util.Debug(" set_cursor, x: " + x + ", y: " + y + ", w: " + w + ", h: " + h);
+
+ display.changeCursor(ws.rQshiftBytes(pixelslength),
+ ws.rQshiftBytes(masklength),
+ x, y, w, h);
+
+ FBU.bytes = 0;
+ FBU.rects -= 1;
+
+ Util.Debug("<< set_cursor");
+ return true;
+};
+
+encHandlers.JPEG_quality_lo = function set_jpeg_quality() {
+ Util.Error("Server sent jpeg_quality pseudo-encoding");
+};
+
+encHandlers.compress_lo = function set_compress_level() {
+ Util.Error("Server sent compress level pseudo-encoding");
+};
+
+/*
+ * Client message routines
+ */
+
+pixelFormat = function() {
+ //Util.Debug(">> pixelFormat");
+ var arr;
+ arr = [0]; // msg-type
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+
+ arr.push8(fb_Bpp * 8); // bits-per-pixel
+ arr.push8(fb_depth * 8); // depth
+ arr.push8(0); // little-endian
+ arr.push8(conf.true_color ? 1 : 0); // true-color
+
+ arr.push16(255); // red-max
+ arr.push16(255); // green-max
+ arr.push16(255); // blue-max
+ arr.push8(16); // red-shift
+ arr.push8(8); // green-shift
+ arr.push8(0); // blue-shift
+
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+ //Util.Debug("<< pixelFormat");
+ return arr;
+};
+
+clientEncodings = function() {
+ //Util.Debug(">> clientEncodings");
+ var arr, i, encList = [];
+
+ for (i=0; i<encodings.length; i += 1) {
+ if ((encodings[i][0] === "Cursor") &&
+ (! conf.local_cursor)) {
+ Util.Debug("Skipping Cursor pseudo-encoding");
+ } else {
+ //Util.Debug("Adding encoding: " + encodings[i][0]);
+ encList.push(encodings[i][1]);
+ }
+ }
+
+ arr = [2]; // msg-type
+ arr.push8(0); // padding
+
+ arr.push16(encList.length); // encoding count
+ for (i=0; i < encList.length; i += 1) {
+ arr.push32(encList[i]);
+ }
+ //Util.Debug("<< clientEncodings: " + arr);
+ return arr;
+};
+
+fbUpdateRequest = function(incremental, x, y, xw, yw) {
+ //Util.Debug(">> fbUpdateRequest");
+ if (typeof(x) === "undefined") { x = 0; }
+ if (typeof(y) === "undefined") { y = 0; }
+ if (typeof(xw) === "undefined") { xw = fb_width; }
+ if (typeof(yw) === "undefined") { yw = fb_height; }
+ var arr;
+ arr = [3]; // msg-type
+ arr.push8(incremental);
+ arr.push16(x);
+ arr.push16(y);
+ arr.push16(xw);
+ arr.push16(yw);
+ //Util.Debug("<< fbUpdateRequest");
+ return arr;
+};
+
+// Based on clean/dirty areas, generate requests to send
+fbUpdateRequests = function() {
+ var cleanDirty = display.getCleanDirtyReset(),
+ arr = [], i, cb, db;
+
+ cb = cleanDirty.cleanBox;
+ if (cb.w > 0 && cb.h > 0) {
+ // Request incremental for clean box
+ arr = arr.concat(fbUpdateRequest(1, cb.x, cb.y, cb.w, cb.h));
+ }
+ for (i = 0; i < cleanDirty.dirtyBoxes.length; i++) {
+ db = cleanDirty.dirtyBoxes[i];
+ // Force all (non-incremental for dirty box
+ arr = arr.concat(fbUpdateRequest(0, db.x, db.y, db.w, db.h));
+ }
+ return arr;
+};
+
+
+
+keyEvent = function(keysym, down) {
+ //Util.Debug(">> keyEvent, keysym: " + keysym + ", down: " + down);
+ var arr;
+ arr = [4]; // msg-type
+ arr.push8(down);
+ arr.push16(0);
+ arr.push32(keysym);
+ //Util.Debug("<< keyEvent");
+ return arr;
+};
+
+pointerEvent = function(x, y) {
+ //Util.Debug(">> pointerEvent, x,y: " + x + "," + y +
+ // " , mask: " + mouse_buttonMask);
+ var arr;
+ arr = [5]; // msg-type
+ arr.push8(mouse_buttonMask);
+ arr.push16(x);
+ arr.push16(y);
+ //Util.Debug("<< pointerEvent");
+ return arr;
+};
+
+clientCutText = function(text) {
+ //Util.Debug(">> clientCutText");
+ var arr, i, n;
+ arr = [6]; // msg-type
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+ arr.push8(0); // padding
+ arr.push32(text.length);
+ n = text.length;
+ for (i=0; i < n; i+=1) {
+ arr.push(text.charCodeAt(i));
+ }
+ //Util.Debug("<< clientCutText:" + arr);
+ return arr;
+};
+
+
+
+//
+// Public API interface functions
+//
+
+that.connect = function(host, port, password, path) {
+ //Util.Debug(">> connect");
+
+ rfb_host = host;
+ rfb_port = port;
+ rfb_password = (password !== undefined) ? password : "";
+ rfb_path = (path !== undefined) ? path : "";
+
+ if ((!rfb_host) || (!rfb_port)) {
+ return fail("Must set host and port");
+ }
+
+ updateState('connect');
+ //Util.Debug("<< connect");
+
+};
+
+that.disconnect = function() {
+ //Util.Debug(">> disconnect");
+ updateState('disconnect', 'Disconnecting');
+ //Util.Debug("<< disconnect");
+};
+
+that.sendPassword = function(passwd) {
+ rfb_password = passwd;
+ rfb_state = "Authentication";
+ setTimeout(init_msg, 1);
+};
+
+that.sendCtrlAltDel = function() {
+ if (rfb_state !== "normal" || conf.view_only) { return false; }
+ Util.Info("Sending Ctrl-Alt-Del");
+ var arr = [];
+ arr = arr.concat(keyEvent(0xFFE3, 1)); // Control
+ arr = arr.concat(keyEvent(0xFFE9, 1)); // Alt
+ arr = arr.concat(keyEvent(0xFFFF, 1)); // Delete
+ arr = arr.concat(keyEvent(0xFFFF, 0)); // Delete
+ arr = arr.concat(keyEvent(0xFFE9, 0)); // Alt
+ arr = arr.concat(keyEvent(0xFFE3, 0)); // Control
+ arr = arr.concat(fbUpdateRequests());
+ ws.send(arr);
+};
+
+// Send a key press. If 'down' is not specified then send a down key
+// followed by an up key.
+that.sendKey = function(code, down) {
+ if (rfb_state !== "normal" || conf.view_only) { return false; }
+ var arr = [];
+ if (typeof down !== 'undefined') {
+ Util.Info("Sending key code (" + (down ? "down" : "up") + "): " + code);
+ arr = arr.concat(keyEvent(code, down ? 1 : 0));
+ } else {
+ Util.Info("Sending key code (down + up): " + code);
+ arr = arr.concat(keyEvent(code, 1));
+ arr = arr.concat(keyEvent(code, 0));
+ }
+ arr = arr.concat(fbUpdateRequests());
+ ws.send(arr);
+};
+
+that.clipboardPasteFrom = function(text) {
+ if (rfb_state !== "normal") { return; }
+ //Util.Debug(">> clipboardPasteFrom: " + text.substr(0,40) + "...");
+ ws.send(clientCutText(text));
+ //Util.Debug("<< clipboardPasteFrom");
+};
+
+// Override internal functions for testing
+that.testMode = function(override_send) {
+ test_mode = true;
+ that.recv_message = ws.testMode(override_send);
+
+ checkEvents = function () { /* Stub Out */ };
+ that.connect = function(host, port, password) {
+ rfb_host = host;
+ rfb_port = port;
+ rfb_password = password;
+ updateState('ProtocolVersion', "Starting VNC handshake");
+ };
+};
+
+
+return constructor(); // Return the public API interface
+
+} // End of RFB()

diff --git a/noVNC/include/ui.js b/noVNC/include/ui.js
new file mode 100644
index 0000000..dc837e6
--- /dev/null
+++ b/noVNC/include/ui.js
@@ -0,0 +1,659 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ */
+
+"use strict";
+/*jslint white: false, browser: true */
+/*global window, $D, Util, WebUtil, RFB, Display */
+
+var UI = {
+
+rfb_state : 'loaded',
+settingsOpen : false,
+connSettingsOpen : false,
+clipboardOpen: false,
+keyboardVisible: false,
+
+// Render default UI and initialize settings menu
+load: function() {
+ var html = '', i, sheet, sheets, llevels;
+
+ // Stylesheet selection dropdown
+ sheet = WebUtil.selectStylesheet();
+ sheets = WebUtil.getStylesheets();
+ for (i = 0; i < sheets.length; i += 1) {
+ UI.addOption($D('noVNC_stylesheet'),sheets[i].title, sheets[i].title);
+ }
+
+ // Logging selection dropdown
+ llevels = ['error', 'warn', 'info', 'debug'];
+ for (i = 0; i < llevels.length; i += 1) {
+ UI.addOption($D('noVNC_logging'),llevels[i], llevels[i]);
+ }
+
+ // Settings with immediate effects
+ UI.initSetting('logging', 'warn');
+ WebUtil.init_logging(UI.getSetting('logging'));
+
+ UI.initSetting('stylesheet', 'default');
+ WebUtil.selectStylesheet(null);
+ // call twice to get around webkit bug
+ WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
+
+ /* Populate the controls if defaults are provided in the URL */
+ UI.initSetting('host', window.location.hostname);
+ UI.initSetting('port', window.location.port);
+ UI.initSetting('password', '');
+ UI.initSetting('encrypt', (window.location.protocol === "https:"));
+ UI.initSetting('true_color', true);
+ UI.initSetting('cursor', false);
+ UI.initSetting('shared', true);
+ UI.initSetting('view_only', false);
+ UI.initSetting('connectTimeout', 2);
+ UI.initSetting('path', 'websockify');
+ UI.initSetting('repeaterID', '');
+
+ UI.rfb = RFB({'target': $D('noVNC_canvas'),
+ 'onUpdateState': UI.updateState,
+ 'onClipboard': UI.clipReceive});
+ UI.updateVisualState();
+
+ // Unfocus clipboard when over the VNC area
+ //$D('VNC_screen').onmousemove = function () {
+ // var keyboard = UI.rfb.get_keyboard();
+ // if ((! keyboard) || (! keyboard.get_focused())) {
+ // $D('VNC_clipboard_text').blur();
+ // }
+ // };
+
+ // Show mouse selector buttons on touch screen devices
+ if ('ontouchstart' in document.documentElement) {
+ // Show mobile buttons
+ $D('noVNC_mobile_buttons').style.display = "inline";
+ UI.setMouseButton();
+ // Remove the address bar
+ setTimeout(function() { window.scrollTo(0, 1); }, 100);
+ UI.forceSetting('clip', true);
+ $D('noVNC_clip').disabled = true;
+ } else {
+ UI.initSetting('clip', false);
+ }
+
+ //iOS Safari does not support CSS position:fixed.
+ //This detects iOS devices and enables javascript workaround.
+ if ((navigator.userAgent.match(/iPhone/i)) ||
+ (navigator.userAgent.match(/iPod/i)) ||
+ (navigator.userAgent.match(/iPad/i))) {
+ //UI.setOnscroll();
+ //UI.setResize();
+ }
+
+ $D('noVNC_host').focus();
+
+ UI.setViewClip();
+ Util.addEvent(window, 'resize', UI.setViewClip);
+
+ Util.addEvent(window, 'beforeunload', function () {
+ if (UI.rfb_state === 'normal') {
+ return "You are currently connected.";
+ }
+ } );
+
+ // Show description by default when hosted at for kanaka.github.com
+ if (location.host === "kanaka.github.com") {
+ // Open the description dialog
+ $D('noVNC_description').style.display = "block";
+ } else {
+ // Open the connect panel on first load
+ UI.toggleConnectPanel();
+ }
+},
+
+// Read form control compatible setting from cookie
+getSetting: function(name) {
+ var val, ctrl = $D('noVNC_' + name);
+ val = WebUtil.readCookie(name);
+ if (ctrl.type === 'checkbox') {
+ if (val.toLowerCase() in {'0':1, 'no':1, 'false':1}) {
+ val = false;
+ } else {
+ val = true;
+ }
+ }
+ return val;
+},
+
+// Update cookie and form control setting. If value is not set, then
+// updates from control to current cookie setting.
+updateSetting: function(name, value) {
+
+ var i, ctrl = $D('noVNC_' + name);
+ // Save the cookie for this session
+ if (typeof value !== 'undefined') {
+ WebUtil.createCookie(name, value);
+ }
+
+ // Update the settings control
+ value = UI.getSetting(name);
+
+ if (ctrl.type === 'checkbox') {
+ ctrl.checked = value;
+
+ } else if (typeof ctrl.options !== 'undefined') {
+ for (i = 0; i < ctrl.options.length; i += 1) {
+ if (ctrl.options[i].value === value) {
+ ctrl.selectedIndex = i;
+ break;
+ }
+ }
+ } else {
+ /*Weird IE9 error leads to 'null' appearring
+ in textboxes instead of ''.*/
+ if (value === null) {
+ value = "";
+ }
+ ctrl.value = value;
+ }
+},
+
+// Save control setting to cookie
+saveSetting: function(name) {
+ var val, ctrl = $D('noVNC_' + name);
+ if (ctrl.type === 'checkbox') {
+ val = ctrl.checked;
+ } else if (typeof ctrl.options !== 'undefined') {
+ val = ctrl.options[ctrl.selectedIndex].value;
+ } else {
+ val = ctrl.value;
+ }
+ WebUtil.createCookie(name, val);
+ //Util.Debug("Setting saved '" + name + "=" + val + "'");
+ return val;
+},
+
+// Initial page load read/initialization of settings
+initSetting: function(name, defVal) {
+ var val;
+
+ // Check Query string followed by cookie
+ val = WebUtil.getQueryVar(name);
+ if (val === null) {
+ val = WebUtil.readCookie(name, defVal);
+ }
+ UI.updateSetting(name, val);
+ //Util.Debug("Setting '" + name + "' initialized to '" + val + "'");
+ return val;
+},
+
+// Force a setting to be a certain value
+forceSetting: function(name, val) {
+ UI.updateSetting(name, val);
+ return val;
+},
+
+
+// Show the clipboard panel
+toggleClipboardPanel: function() {
+ // Close the description panel
+ $D('noVNC_description').style.display = "none";
+ //Close settings if open
+ if (UI.settingsOpen === true) {
+ UI.settingsApply();
+ UI.closeSettingsMenu();
+ }
+ //Close connection settings if open
+ if (UI.connSettingsOpen === true) {
+ UI.toggleConnectPanel();
+ }
+ //Toggle Clipboard Panel
+ if (UI.clipboardOpen === true) {
+ $D('noVNC_clipboard').style.display = "none";
+ $D('clipboardButton').className = "noVNC_status_button";
+ UI.clipboardOpen = false;
+ } else {
+ $D('noVNC_clipboard').style.display = "block";
+ $D('clipboardButton').className = "noVNC_status_button_selected";
+ UI.clipboardOpen = true;
+ }
+},
+
+// Show the connection settings panel/menu
+toggleConnectPanel: function() {
+ // Close the description panel
+ $D('noVNC_description').style.display = "none";
+ //Close connection settings if open
+ if (UI.settingsOpen === true) {
+ UI.settingsApply();
+ UI.closeSettingsMenu();
+ $D('connectButton').className = "noVNC_status_button";
+ }
+ if (UI.clipboardOpen === true) {
+ UI.toggleClipboardPanel();
+ }
+
+ //Toggle Connection Panel
+ if (UI.connSettingsOpen === true) {
+ $D('noVNC_controls').style.display = "none";
+ $D('connectButton').className = "noVNC_status_button";
+ UI.connSettingsOpen = false;
+ } else {
+ $D('noVNC_controls').style.display = "block";
+ $D('connectButton').className = "noVNC_status_button_selected";
+ UI.connSettingsOpen = true;
+ $D('noVNC_host').focus();
+ }
+},
+
+// Toggle the settings menu:
+// On open, settings are refreshed from saved cookies.
+// On close, settings are applied
+toggleSettingsPanel: function() {
+ // Close the description panel
+ $D('noVNC_description').style.display = "none";
+ if (UI.settingsOpen) {
+ UI.settingsApply();
+ UI.closeSettingsMenu();
+ } else {
+ UI.updateSetting('encrypt');
+ UI.updateSetting('true_color');
+ if (UI.rfb.get_display().get_cursor_uri()) {
+ UI.updateSetting('cursor');
+ } else {
+ UI.updateSetting('cursor', false);
+ $D('noVNC_cursor').disabled = true;
+ }
+ UI.updateSetting('clip');
+ UI.updateSetting('shared');
+ UI.updateSetting('view_only');
+ UI.updateSetting('connectTimeout');
+ UI.updateSetting('path');
+ UI.updateSetting('repeaterID');
+ UI.updateSetting('stylesheet');
+ UI.updateSetting('logging');
+
+ UI.openSettingsMenu();
+ }
+},
+
+// Open menu
+openSettingsMenu: function() {
+ // Close the description panel
+ $D('noVNC_description').style.display = "none";
+ if (UI.clipboardOpen === true) {
+ UI.toggleClipboardPanel();
+ }
+ //Close connection settings if open
+ if (UI.connSettingsOpen === true) {
+ UI.toggleConnectPanel();
+ }
+ $D('noVNC_settings').style.display = "block";
+ $D('settingsButton').className = "noVNC_status_button_selected";
+ UI.settingsOpen = true;
+},
+
+// Close menu (without applying settings)
+closeSettingsMenu: function() {
+ $D('noVNC_settings').style.display = "none";
+ $D('settingsButton').className = "noVNC_status_button";
+ UI.settingsOpen = false;
+},
+
+// Save/apply settings when 'Apply' button is pressed
+settingsApply: function() {
+ //Util.Debug(">> settingsApply");
+ UI.saveSetting('encrypt');
+ UI.saveSetting('true_color');
+ if (UI.rfb.get_display().get_cursor_uri()) {
+ UI.saveSetting('cursor');
+ }
+ UI.saveSetting('clip');
+ UI.saveSetting('shared');
+ UI.saveSetting('view_only');
+ UI.saveSetting('connectTimeout');
+ UI.saveSetting('path');
+ UI.saveSetting('repeaterID');
+ UI.saveSetting('stylesheet');
+ UI.saveSetting('logging');
+
+ // Settings with immediate (non-connected related) effect
+ WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
+ WebUtil.init_logging(UI.getSetting('logging'));
+ UI.setViewClip();
+ UI.setViewDrag(UI.rfb.get_viewportDrag());
+ //Util.Debug("<< settingsApply");
+},
+
+
+
+setPassword: function() {
+ UI.rfb.sendPassword($D('noVNC_password').value);
+ //Reset connect button.
+ $D('noVNC_connect_button').value = "Connect";
+ $D('noVNC_connect_button').onclick = UI.Connect;
+ //Hide connection panel.
+ UI.toggleConnectPanel();
+ return false;
+},
+
+sendCtrlAltDel: function() {
+ UI.rfb.sendCtrlAltDel();
+},
+
+setMouseButton: function(num) {
+ var b, blist = [0, 1,2,4], button;
+
+ if (typeof num === 'undefined') {
+ // Disable mouse buttons
+ num = -1;
+ }
+ if (UI.rfb) {
+ UI.rfb.get_mouse().set_touchButton(num);
+ }
+
+ for (b = 0; b < blist.length; b++) {
+ button = $D('noVNC_mouse_button' + blist[b]);
+ if (blist[b] === num) {
+ button.style.display = "";
+ } else {
+ button.style.display = "none";
+ /*
+ button.style.backgroundColor = "black";
+ button.style.color = "lightgray";
+ button.style.backgroundColor = "";
+ button.style.color = "";
+ */
+ }
+ }
+},
+
+updateState: function(rfb, state, oldstate, msg) {
+ var s, sb, c, d, cad, vd, klass;
+ UI.rfb_state = state;
+ s = $D('noVNC_status');
+ sb = $D('noVNC_status_bar');
+ switch (state) {
+ case 'failed':
+ case 'fatal':
+ klass = "noVNC_status_error";
+ break;
+ case 'normal':
+ klass = "noVNC_status_normal";
+ break;
+ case 'disconnected':
+ $D('noVNC_logo').style.display = "block";
+ // Fall through
+ case 'loaded':
+ klass = "noVNC_status_normal";
+ break;
+ case 'password':
+ UI.toggleConnectPanel();
+
+ $D('noVNC_connect_button').value = "Send Password";
+ $D('noVNC_connect_button').onclick = UI.setPassword;
+ $D('noVNC_password').focus();
+
+ klass = "noVNC_status_warn";
+ break;
+ default:
+ klass = "noVNC_status_warn";
+ break;
+ }
+
+ if (typeof(msg) !== 'undefined') {
+ s.setAttribute("class", klass);
+ sb.setAttribute("class", klass);
+ s.innerHTML = msg;
+ }
+
+ UI.updateVisualState();
+},
+
+// Disable/enable controls depending on connection state
+updateVisualState: function() {
+ var connected = UI.rfb_state === 'normal' ? true : false;
+
+ //Util.Debug(">> updateVisualState");
+ $D('noVNC_encrypt').disabled = connected;
+ $D('noVNC_true_color').disabled = connected;
+ if (UI.rfb && UI.rfb.get_display() &&
+ UI.rfb.get_display().get_cursor_uri()) {
+ $D('noVNC_cursor').disabled = connected;
+ } else {
+ UI.updateSetting('cursor', false);
+ $D('noVNC_cursor').disabled = true;
+ }
+ $D('noVNC_shared').disabled = connected;
+ $D('noVNC_view_only').disabled = connected;
+ $D('noVNC_connectTimeout').disabled = connected;
+ $D('noVNC_path').disabled = connected;
+ $D('noVNC_repeaterID').disabled = connected;
+
+ if (connected) {
+ UI.setViewClip();
+ UI.setMouseButton(1);
+ $D('clipboardButton').style.display = "inline";
+ $D('showKeyboard').style.display = "inline";
+ $D('sendCtrlAltDelButton').style.display = "inline";
+ } else {
+ UI.setMouseButton();
+ $D('clipboardButton').style.display = "none";
+ $D('showKeyboard').style.display = "none";
+ $D('sendCtrlAltDelButton').style.display = "none";
+ }
+ // State change disables viewport dragging.
+ // It is enabled (toggled) by direct click on the button
+ UI.setViewDrag(false);
+
+ switch (UI.rfb_state) {
+ case 'fatal':
+ case 'failed':
+ case 'loaded':
+ case 'disconnected':
+ $D('connectButton').style.display = "";
+ $D('disconnectButton').style.display = "none";
+ break;
+ default:
+ $D('connectButton').style.display = "none";
+ $D('disconnectButton').style.display = "";
+ break;
+ }
+
+ //Util.Debug("<< updateVisualState");
+},
+
+
+clipReceive: function(rfb, text) {
+ Util.Debug(">> UI.clipReceive: " + text.substr(0,40) + "...");
+ $D('noVNC_clipboard_text').value = text;
+ Util.Debug("<< UI.clipReceive");
+},
+
+
+connect: function() {
+ var host, port, password, path;
+
+ UI.closeSettingsMenu();
+ UI.toggleConnectPanel();
+
+ host = $D('noVNC_host').value;
+ port = $D('noVNC_port').value;
+ password = $D('noVNC_password').value;
+ path = $D('noVNC_path').value;
+ if ((!host) || (!port)) {
+ throw("Must set host and port");
+ }
+
+ UI.rfb.set_encrypt(UI.getSetting('encrypt'));
+ UI.rfb.set_true_color(UI.getSetting('true_color'));
+ UI.rfb.set_local_cursor(UI.getSetting('cursor'));
+ UI.rfb.set_shared(UI.getSetting('shared'));
+ UI.rfb.set_view_only(UI.getSetting('view_only'));
+ UI.rfb.set_connectTimeout(UI.getSetting('connectTimeout'));
+ UI.rfb.set_repeaterID(UI.getSetting('repeaterID'));
+
+ UI.rfb.connect(host, port, password, path);
+
+ //Close dialog.
+ setTimeout(UI.setBarPosition, 100);
+ $D('noVNC_logo').style.display = "none";
+},
+
+disconnect: function() {
+ UI.closeSettingsMenu();
+ UI.rfb.disconnect();
+
+ $D('noVNC_logo').style.display = "block";
+ UI.connSettingsOpen = false;
+ UI.toggleConnectPanel();
+},
+
+displayBlur: function() {
+ UI.rfb.get_keyboard().set_focused(false);
+ UI.rfb.get_mouse().set_focused(false);
+},
+
+displayFocus: function() {
+ UI.rfb.get_keyboard().set_focused(true);
+ UI.rfb.get_mouse().set_focused(true);
+},
+
+clipClear: function() {
+ $D('noVNC_clipboard_text').value = "";
+ UI.rfb.clipboardPasteFrom("");
+},
+
+clipSend: function() {
+ var text = $D('noVNC_clipboard_text').value;
+ Util.Debug(">> UI.clipSend: " + text.substr(0,40) + "...");
+ UI.rfb.clipboardPasteFrom(text);
+ Util.Debug("<< UI.clipSend");
+},
+
+
+// Enable/disable and configure viewport clipping
+setViewClip: function(clip) {
+ var display, cur_clip, pos, new_w, new_h;
+
+ if (UI.rfb) {
+ display = UI.rfb.get_display();
+ } else {
+ return;
+ }
+
+ cur_clip = display.get_viewport();
+
+ if (typeof(clip) !== 'boolean') {
+ // Use current setting
+ clip = UI.getSetting('clip');
+ }
+
+ if (clip && !cur_clip) {
+ // Turn clipping on
+ UI.updateSetting('clip', true);
+ } else if (!clip && cur_clip) {
+ // Turn clipping off
+ UI.updateSetting('clip', false);
+ display.set_viewport(false);
+ $D('noVNC_canvas').style.position = 'static';
+ display.viewportChange();
+ }
+ if (UI.getSetting('clip')) {
+ // If clipping, update clipping settings
+ $D('noVNC_canvas').style.position = 'absolute';
+ pos = Util.getPosition($D('noVNC_canvas'));
+ new_w = window.innerWidth - pos.x;
+ new_h = window.innerHeight - pos.y;
+ display.set_viewport(true);
+ display.viewportChange(0, 0, new_w, new_h);
+ }
+},
+
+// Toggle/set/unset the viewport drag/move button
+setViewDrag: function(drag) {
+ var vmb = $D('noVNC_view_drag_button');
+ if (!UI.rfb) { return; }
+
+ if (UI.rfb_state === 'normal' &&
+ UI.rfb.get_display().get_viewport()) {
+ vmb.style.display = "inline";
+ } else {
+ vmb.style.display = "none";
+ }
+
+ if (typeof(drag) === "undefined") {
+ // If not specified, then toggle
+ drag = !UI.rfb.get_viewportDrag();
+ }
+ if (drag) {
+ vmb.className = "noVNC_status_button_selected";
+ UI.rfb.set_viewportDrag(true);
+ } else {
+ vmb.className = "noVNC_status_button";
+ UI.rfb.set_viewportDrag(false);
+ }
+},
+
+// On touch devices, show the OS keyboard
+showKeyboard: function() {
+ if(UI.keyboardVisible === false) {
+ $D('keyboardinput').focus();
+ UI.keyboardVisible = true;
+ $D('showKeyboard').className = "noVNC_status_button_selected";
+ } else if(UI.keyboardVisible === true) {
+ $D('keyboardinput').blur();
+ $D('showKeyboard').className = "noVNC_status_button";
+ UI.keyboardVisible = false;
+ }
+},
+
+keyInputBlur: function() {
+ $D('showKeyboard').className = "noVNC_status_button";
+ //Weird bug in iOS if you change keyboardVisible
+ //here it does not actually occur so next time
+ //you click keyboard icon it doesnt work.
+ setTimeout(function() { UI.setKeyboard(); },100);
+},
+
+setKeyboard: function() {
+ UI.keyboardVisible = false;
+},
+
+// iOS < Version 5 does not support position fixed. Javascript workaround:
+setOnscroll: function() {
+ window.onscroll = function() {
+ UI.setBarPosition();
+ };
+},
+
+setResize: function () {
+ window.onResize = function() {
+ UI.setBarPosition();
+ };
+},
+
+//Helper to add options to dropdown.
+addOption: function(selectbox,text,value )
+{
+ var optn = document.createElement("OPTION");
+ optn.text = text;
+ optn.value = value;
+ selectbox.options.add(optn);
+},
+
+setBarPosition: function() {
+ $D('noVNC-control-bar').style.top = (window.pageYOffset) + 'px';
+ $D('noVNC_mobile_buttons').style.left = (window.pageXOffset) + 'px';
+
+ var vncwidth = $D('noVNC_screen').style.offsetWidth;
+ $D('noVNC-control-bar').style.width = vncwidth + 'px';
+}
+
+};
+
+
+
+

diff --git a/noVNC/include/util.js b/noVNC/include/util.js
new file mode 100644
index 0000000..57ccb54
--- /dev/null
+++ b/noVNC/include/util.js
@@ -0,0 +1,320 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ */
+
+"use strict";
+/*jslint bitwise: false, white: false */
+/*global window, console, document, navigator, ActiveXObject */
+
+// Globals defined here
+var Util = {};
+
+
+/*
+ * Make arrays quack
+ */
+
+Array.prototype.push8 = function (num) {
+ this.push(num & 0xFF);
+};
+
+Array.prototype.push16 = function (num) {
+ this.push((num >> 8) & 0xFF,
+ (num ) & 0xFF );
+};
+Array.prototype.push32 = function (num) {
+ this.push((num >> 24) & 0xFF,
+ (num >> 16) & 0xFF,
+ (num >> 8) & 0xFF,
+ (num ) & 0xFF );
+};
+
+// IE does not support map (even in IE9)
+//This prototype is provided by the Mozilla foundation and
+//is distributed under the MIT license.
+//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
+if (!Array.prototype.map)
+{
+ Array.prototype.map = function(fun /*, thisp*/)
+ {
+ var len = this.length;
+ if (typeof fun != "function")
+ throw new TypeError();
+
+ var res = new Array(len);
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++)
+ {
+ if (i in this)
+ res[i] = fun.call(thisp, this[i], i, this);
+ }
+
+ return res;
+ };
+}
+
+//
+// requestAnimationFrame shim with setTimeout fallback
+//
+
+window.requestAnimFrame = (function(){
+ return window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ function(callback){
+ window.setTimeout(callback, 1000 / 60);
+ };
+})();
+
+/*
+ * ------------------------------------------------------
+ * Namespaced in Util
+ * ------------------------------------------------------
+ */
+
+/*
+ * Logging/debug routines
+ */
+
+Util._log_level = 'warn';
+Util.init_logging = function (level) {
+ if (typeof level === 'undefined') {
+ level = Util._log_level;
+ } else {
+ Util._log_level = level;
+ }
+ if (typeof window.console === "undefined") {
+ if (typeof window.opera !== "undefined") {
+ window.console = {
+ 'log' : window.opera.postError,
+ 'warn' : window.opera.postError,
+ 'error': window.opera.postError };
+ } else {
+ window.console = {
+ 'log' : function(m) {},
+ 'warn' : function(m) {},
+ 'error': function(m) {}};
+ }
+ }
+
+ Util.Debug = Util.Info = Util.Warn = Util.Error = function (msg) {};
+ switch (level) {
+ case 'debug': Util.Debug = function (msg) { console.log(msg); };
+ case 'info': Util.Info = function (msg) { console.log(msg); };
+ case 'warn': Util.Warn = function (msg) { console.warn(msg); };
+ case 'error': Util.Error = function (msg) { console.error(msg); };
+ case 'none':
+ break;
+ default:
+ throw("invalid logging type '" + level + "'");
+ }
+};
+Util.get_logging = function () {
+ return Util._log_level;
+};
+// Initialize logging level
+Util.init_logging();
+
+
+// Set configuration default for Crockford style function namespaces
+Util.conf_default = function(cfg, api, defaults, v, mode, type, defval, desc) {
+ var getter, setter;
+
+ // Default getter function
+ getter = function (idx) {
+ if ((type in {'arr':1, 'array':1}) &&
+ (typeof idx !== 'undefined')) {
+ return cfg[v][idx];
+ } else {
+ return cfg[v];
+ }
+ };
+
+ // Default setter function
+ setter = function (val, idx) {
+ if (type in {'boolean':1, 'bool':1}) {
+ if ((!val) || (val in {'0':1, 'no':1, 'false':1})) {
+ val = false;
+ } else {
+ val = true;
+ }
+ } else if (type in {'integer':1, 'int':1}) {
+ val = parseInt(val, 10);
+ } else if (type === 'str') {
+ val = String(val);
+ } else if (type === 'func') {
+ if (!val) {
+ val = function () {};
+ }
+ }
+ if (typeof idx !== 'undefined') {
+ cfg[v][idx] = val;
+ } else {
+ cfg[v] = val;
+ }
+ };
+
+ // Set the description
+ api[v + '_description'] = desc;
+
+ // Set the getter function
+ if (typeof api['get_' + v] === 'undefined') {
+ api['get_' + v] = getter;
+ }
+
+ // Set the setter function with extra sanity checks
+ if (typeof api['set_' + v] === 'undefined') {
+ api['set_' + v] = function (val, idx) {
+ if (mode in {'RO':1, 'ro':1}) {
+ throw(v + " is read-only");
+ } else if ((mode in {'WO':1, 'wo':1}) &&
+ (typeof cfg[v] !== 'undefined')) {
+ throw(v + " can only be set once");
+ }
+ setter(val, idx);
+ };
+ }
+
+ // Set the default value
+ if (typeof defaults[v] !== 'undefined') {
+ defval = defaults[v];
+ } else if ((type in {'arr':1, 'array':1}) &&
+ (! (defval instanceof Array))) {
+ defval = [];
+ }
+ // Coerce existing setting to the right type
+ //Util.Debug("v: " + v + ", defval: " + defval + ", defaults[v]: " + defaults[v]);
+ setter(defval);
+};
+
+// Set group of configuration defaults
+Util.conf_defaults = function(cfg, api, defaults, arr) {
+ var i;
+ for (i = 0; i < arr.length; i++) {
+ Util.conf_default(cfg, api, defaults, arr[i][0], arr[i][1],
+ arr[i][2], arr[i][3], arr[i][4]);
+ }
+};
+
+
+/*
+ * Cross-browser routines
+ */
+
+// Get DOM element position on page
+Util.getPosition = function (obj) {
+ var x = 0, y = 0;
+ if (obj.offsetParent) {
+ do {
+ x += obj.offsetLeft;
+ y += obj.offsetTop;
+ obj = obj.offsetParent;
+ } while (obj);
+ }
+ return {'x': x, 'y': y};
+};
+
+// Get mouse event position in DOM element
+Util.getEventPosition = function (e, obj, scale) {
+ var evt, docX, docY, pos;
+ //if (!e) evt = window.event;
+ evt = (e ? e : window.event);
+ evt = (evt.changedTouches ? evt.changedTouches[0] : evt.touches ? evt.touches[0] : evt);
+ if (evt.pageX || evt.pageY) {
+ docX = evt.pageX;
+ docY = evt.pageY;
+ } else if (evt.clientX || evt.clientY) {
+ docX = evt.clientX + document.body.scrollLeft +
+ document.documentElement.scrollLeft;
+ docY = evt.clientY + document.body.scrollTop +
+ document.documentElement.scrollTop;
+ }
+ pos = Util.getPosition(obj);
+ if (typeof scale === "undefined") {
+ scale = 1;
+ }
+ return {'x': (docX - pos.x) / scale, 'y': (docY - pos.y) / scale};
+};
+
+
+// Event registration. Based on: http://www.scottandrew.com/weblog/articles/cbs-events
+Util.addEvent = function (obj, evType, fn){
+ if (obj.attachEvent){
+ var r = obj.attachEvent("on"+evType, fn);
+ return r;
+ } else if (obj.addEventListener){
+ obj.addEventListener(evType, fn, false);
+ return true;
+ } else {
+ throw("Handler could not be attached");
+ }
+};
+
+Util.removeEvent = function(obj, evType, fn){
+ if (obj.detachEvent){
+ var r = obj.detachEvent("on"+evType, fn);
+ return r;
+ } else if (obj.removeEventListener){
+ obj.removeEventListener(evType, fn, false);
+ return true;
+ } else {
+ throw("Handler could not be removed");
+ }
+};
+
+Util.stopEvent = function(e) {
+ if (e.stopPropagation) { e.stopPropagation(); }
+ else { e.cancelBubble = true; }
+
+ if (e.preventDefault) { e.preventDefault(); }
+ else { e.returnValue = false; }
+};
+
+
+// Set browser engine versions. Based on mootools.
+Util.Features = {xpath: !!(document.evaluate), air: !!(window.runtime), query: !!(document.querySelector)};
+
+Util.Engine = {
+ // Version detection break in Opera 11.60 (errors on arguments.callee.caller reference)
+ //'presto': (function() {
+ // return (!window.opera) ? false : ((arguments.callee.caller) ? 960 : ((document.getElementsByClassName) ? 950 : 925)); }()),
+ 'presto': (function() { return (!window.opera) ? false : true; }()),
+
+ 'trident': (function() {
+ return (!window.ActiveXObject) ? false : ((window.XMLHttpRequest) ? ((document.querySelectorAll) ? 6 : 5) : 4); }()),
+ 'webkit': (function() {
+ try { return (navigator.taintEnabled) ? false : ((Util.Features.xpath) ? ((Util.Features.query) ? 525 : 420) : 419); } catch (e) { return false; } }()),
+ //'webkit': (function() {
+ // return ((typeof navigator.taintEnabled !== "unknown") && navigator.taintEnabled) ? false : ((Util.Features.xpath) ? ((Util.Features.query) ? 525 : 420) : 419); }()),
+ 'gecko': (function() {
+ return (!document.getBoxObjectFor && window.mozInnerScreenX == null) ? false : ((document.getElementsByClassName) ? 19 : 18); }())
+};
+if (Util.Engine.webkit) {
+ // Extract actual webkit version if available
+ Util.Engine.webkit = (function(v) {
+ var re = new RegExp('WebKit/([0-9\.]*) ');
+ v = (navigator.userAgent.match(re) || ['', v])[1];
+ return parseFloat(v, 10);
+ })(Util.Engine.webkit);
+}
+
+Util.Flash = (function(){
+ var v, version;
+ try {
+ v = navigator.plugins['Shockwave Flash'].description;
+ } catch(err1) {
+ try {
+ v = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version');
+ } catch(err2) {
+ v = '0 r0';
+ }
+ }
+ version = v.match(/\d+/g);
+ return {version: parseInt(version[0] || 0 + '.' + version[1], 10) || 0, build: parseInt(version[2], 10) || 0};
+}());

diff --git a/noVNC/include/vnc.js b/noVNC/include/vnc.js
new file mode 100644
index 0000000..7679d84
--- /dev/null
+++ b/noVNC/include/vnc.js
@@ -0,0 +1,43 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ */
+
+/*jslint evil: true */
+/*global window, document, INCLUDE_URI */
+
+/*
+ * Load supporting scripts
+ */
+function get_INCLUDE_URI() {
+ return (typeof INCLUDE_URI !== "undefined") ? INCLUDE_URI : "include/";
+}
+
+(function () {
+ "use strict";
+
+ var extra = "", start, end;
+
+ start = "<script src='" + get_INCLUDE_URI();
+ end = "'><\/script>";
+
+ // Uncomment to activate firebug lite
+ //extra += "<script src='http://getfirebug.com/releases/lite/1.2/" +
+ // "firebug-lite-compressed.js'><\/script>";
+
+ extra += start + "util.js" + end;
+ extra += start + "webutil.js" + end;
+ extra += start + "base64.js" + end;
+ extra += start + "websock.js" + end;
+ extra += start + "des.js" + end;
+ extra += start + "input.js" + end;
+ extra += start + "display.js" + end;
+ extra += start + "rfb.js" + end;
+ extra += start + "jsunzip.js" + end;
+
+ document.write(extra);
+}());
+

diff --git a/noVNC/include/web-socket-js/README.txt b/noVNC/include/web-socket-js/README.txt
new file mode 100644
index 0000000..2e32ea7
--- /dev/null
+++ b/noVNC/include/web-socket-js/README.txt
@@ -0,0 +1,109 @@
+* How to try
+
+Assuming you have Web server (e.g. Apache) running at http://example.com/ .
+
+- Download web_socket.rb from:
+ http://github.com/gimite/web-socket-ruby/tree/master
+- Run sample Web Socket server (echo server) in example.com with: (#1)
+ $ ruby web-socket-ruby/samples/echo_server.rb example.com 10081
+- If your server already provides socket policy file at port 843, modify the file to allow access to port 10081. Otherwise you can skip this step. See below for details.
+- Publish the web-socket-js directory with your Web server (e.g. put it in ~/public_html).
+- Change ws://localhost:10081 to ws://example.com:10081 in sample.html.
+- Open sample.html in your browser.
+- After "onopen" is shown, input something, click [Send] and confirm echo back.
+
+#1: First argument of echo_server.rb means that it accepts Web Socket connection from HTML pages in example.com.
+
+
+* Troubleshooting
+
+If it doesn't work, try these:
+
+1. Try Chrome and Firefox 3.x.
+- It doesn't work on Chrome:
+-- It's likely an issue of your code or the server. Debug your code as usual e.g. using console.log.
+- It works on Chrome but it doesn't work on Firefox:
+-- It's likely an issue of web-socket-js specific configuration (e.g. 3 and 4 below).
+- It works on both Chrome and Firefox, but it doesn't work on your browser:
+-- Check "Supported environment" section below. Your browser may not be supported by web-socket-js.
+
+2. Add this line before your code:
+ WEB_SOCKET_DEBUG = true;
+and use Developer Tools (Chrome/Safari) or Firebug (Firefox) to see if console.log outputs any errors.
+
+3. Make sure you do NOT open your HTML page as local file e.g. file:///.../sample.html. web-socket-js doesn't work on local file. Open it via Web server e.g. http:///.../sample.html.
+
+4. If you are NOT using web-socket-ruby as your WebSocket server, you need to place Flash socket policy file on your server. See "Flash socket policy file" section below for details.
+
+5. Check if sample.html bundled with web-socket-js works.
+
+6. Make sure the port used for WebSocket (10081 in example above) is not blocked by your server/client's firewall.
+
+7. Install debugger version of Flash Player available here to see Flash errors:
+http://www.adobe.com/support/flashplayer/downloads.html
+
+
+* Supported environments
+
+It should work on:
+- Google Chrome 4 or later (just uses native implementation)
+- Firefox 3.x, Internet Explorer 8 + Flash Player 9 or later
+
+It may or may not work on other browsers such as Safari, Opera or IE 6. Patch for these browsers are appreciated, but I will not work on fixing issues specific to these browsers by myself.
+
+
+* Flash socket policy file
+
+This implementation uses Flash's socket, which means that your server must provide Flash socket policy file to declare the server accepts connections from Flash.
+
+If you use web-socket-ruby available at
+http://github.com/gimite/web-socket-ruby/tree/master
+, you don't need anything special, because web-socket-ruby handles Flash socket policy file request. But if you already provide socket policy file at port 843, you need to modify the file to allow access to Web Socket port, because it precedes what web-socket-ruby provides.
+
+If you use other Web Socket server implementation, you need to provide socket policy file yourself. See
+http://www.lightsphere.com/dev/articles/flash_socket_policy.html
+for details and sample script to run socket policy file server. node.js implementation is available here:
+http://github.com/LearnBoost/Socket.IO-node/blob/master/lib/socket.io/transports/flashsocket.js
+
+Actually, it's still better to provide socket policy file at port 843 even if you use web-socket-ruby. Flash always try to connect to port 843 first, so providing the file at port 843 makes startup faster.
+
+
+* Cookie considerations
+
+Cookie is sent if Web Socket host is the same as the origin of JavaScript. Otherwise it is not sent, because I don't know way to send right Cookie (which is Cookie of the host of Web Socket, I heard).
+
+Note that it's technically possible that client sends arbitrary string as Cookie and any other headers (by modifying this library for example) once you place Flash socket policy file in your server. So don't trust Cookie and other headers if you allow connection from untrusted origin.
+
+
+* Proxy considerations
+
+The WebSocket spec (http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol) specifies instructions for User Agents to support proxied connections by implementing the HTTP CONNECT method.
+
+The AS3 Socket class doesn't implement this mechanism, which renders it useless for the scenarios where the user trying to open a socket is behind a proxy.
+
+The class RFC2817Socket (by Christian Cantrell) effectively lets us implement this, as long as the proxy settings are known and provided by the interface that instantiates the WebSocket. As such, if you want to support proxied conncetions, you'll have to supply this information to the WebSocket constructor when Flash is being used. One way to go about it would be to ask the user for proxy settings information if the initial connection fails.
+
+
+* How to host HTML file and SWF file in different domains
+
+By default, HTML file and SWF file must be in the same domain. You can follow steps below to allow hosting them in different domain.
+
+WARNING: If you use the method below, HTML files in ANY domains can send arbitrary TCP data to your WebSocket server, regardless of configuration in Flash socket policy file. Arbitrary TCP data means that they can even fake request headers including Origin and Cookie.
+
+- Unzip WebSocketMainInsecure.zip to extract WebSocketMainInsecure.swf.
+- Put WebSocketMainInsecure.swf on your server, instead of WebSocketMain.swf.
+- In JavaScript, set WEB_SOCKET_SWF_LOCATION to URL of your WebSocketMainInsecure.swf.
+
+
+* How to build WebSocketMain.swf
+
+Install Flex 4 SDK:
+http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4
+
+$ cd flash-src
+$ ./build.sh
+
+
+* License
+
+New BSD License.

diff --git a/noVNC/include/web-socket-js/WebSocketMain.swf b/noVNC/include/web-socket-js/WebSocketMain.swf
new file mode 100644
index 0000000..244c445
Binary files /dev/null and b/noVNC/include/web-socket-js/WebSocketMain.swf differ

diff --git a/noVNC/include/web-socket-js/swfobject.js b/noVNC/include/web-socket-js/swfobject.js
new file mode 100644
index 0000000..8eafe9d
--- /dev/null
+++ b/noVNC/include/web-socket-js/swfobject.js
@@ -0,0 +1,4 @@
+/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
+ is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
+*/
+var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace
(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("
body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[a
f].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(
){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.pare
ntNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'
" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}r
eturn X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z
=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(
var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}ret
urn""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
\ No newline at end of file

diff --git a/noVNC/include/web-socket-js/web_socket.js b/noVNC/include/web-socket-js/web_socket.js
new file mode 100644
index 0000000..a133013
--- /dev/null
+++ b/noVNC/include/web-socket-js/web_socket.js
@@ -0,0 +1,341 @@
+// Copyright: Hiroshi Ichikawa <http://gimite.net/en/>
+// License: New BSD License
+// Reference: http://dev.w3.org/html5/websockets/
+// Reference: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
+
+(function() {
+
+ if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) return;
+
+ var console = window.console;
+ if (!console || !console.log || !console.error) {
+ console = {log: function(){ }, error: function(){ }};
+ }
+
+ if (!swfobject.hasFlashPlayerVersion("10.0.0")) {
+ console.error("Flash Player >= 10.0.0 is required.");
+ return;
+ }
+ if (location.protocol == "file:") {
+ console.error(
+ "WARNING: web-socket-js doesn't work in file:///... URL " +
+ "unless you set Flash Security Settings properly. " +
+ "Open the page via Web server i.e. http://...");
+ }
+
+ /**
+ * This class represents a faux web socket.
+ * @param {string} url
+ * @param {string} protocol
+ * @param {string} proxyHost
+ * @param {int} proxyPort
+ * @param {string} headers
+ */
+ WebSocket = function(url, protocol, proxyHost, proxyPort, headers) {
+ var self = this;
+ self.__id = WebSocket.__nextId++;
+ WebSocket.__instances[self.__id] = self;
+ self.readyState = WebSocket.CONNECTING;
+ self.bufferedAmount = 0;
+ self.__events = {};
+ // 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.
+ setTimeout(function() {
+ WebSocket.__addTask(function() {
+ WebSocket.__flash.create(
+ self.__id, url, protocol, proxyHost || null, proxyPort || 0, headers || null);
+ });
+ }, 0);
+ };
+
+ /**
+ * Send data to the web socket.
+ * @param {string} data The data to send to the socket.
+ * @return {boolean} True for success, false for failure.
+ */
+ WebSocket.prototype.send = function(data) {
+ if (this.readyState == WebSocket.CONNECTING) {
+ throw "INVALID_STATE_ERR: Web Socket connection has not been established";
+ }
+ // We use encodeURIComponent() here, because FABridge doesn't work if
+ // the argument includes some characters. We don't use escape() here
+ // because of this:
+ // https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Functions#escape_and_unescape_Functions
+ // But it looks decodeURIComponent(encodeURIComponent(s)) doesn't
+ // preserve all Unicode characters either e.g. "\uffff" in Firefox.
+ // Note by wtritch: Hopefully this will not be necessary using ExternalInterface. Will require
+ // additional testing.
+ var result = WebSocket.__flash.send(this.__id, encodeURIComponent(data));
+ if (result < 0) { // success
+ return true;
+ } else {
+ this.bufferedAmount += result;
+ return false;
+ }
+ };
+
+ /**
+ * Close this web socket gracefully.
+ */
+ WebSocket.prototype.close = function() {
+ if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
+ return;
+ }
+ this.readyState = WebSocket.CLOSING;
+ WebSocket.__flash.close(this.__id);
+ };
+
+ /**
+ * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
+ *
+ * @param {string} type
+ * @param {function} listener
+ * @param {boolean} useCapture
+ * @return void
+ */
+ WebSocket.prototype.addEventListener = function(type, listener, useCapture) {
+ if (!(type in this.__events)) {
+ this.__events[type] = [];
+ }
+ this.__events[type].push(listener);
+ };
+
+ /**
+ * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
+ *
+ * @param {string} type
+ * @param {function} listener
+ * @param {boolean} useCapture
+ * @return void
+ */
+ WebSocket.prototype.removeEventListener = function(type, listener, useCapture) {
+ if (!(type in this.__events)) return;
+ var events = this.__events[type];
+ for (var i = events.length - 1; i >= 0; --i) {
+ if (events[i] === listener) {
+ events.splice(i, 1);
+ break;
+ }
+ }
+ };
+
+ /**
+ * Implementation of {@link <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-registration">DOM 2 EventTarget Interface</a>}
+ *
+ * @param {Event} event
+ * @return void
+ */
+ WebSocket.prototype.dispatchEvent = function(event) {
+ var events = this.__events[event.type] || [];
+ for (var i = 0; i < events.length; ++i) {
+ events[i](event);
+ }
+ var handler = this["on" + event.type];
+ if (handler) handler(event);
+ };
+
+ /**
+ * Handles an event from Flash.
+ * @param {Object} flashEvent
+ */
+ WebSocket.prototype.__handleEvent = function(flashEvent) {
+ if ("readyState" in flashEvent) {
+ this.readyState = flashEvent.readyState;
+ }
+
+ var jsEvent;
+ if (flashEvent.type == "open" || flashEvent.type == "error") {
+ jsEvent = this.__createSimpleEvent(flashEvent.type);
+ } else if (flashEvent.type == "close") {
+ // TODO implement jsEvent.wasClean
+ jsEvent = this.__createSimpleEvent("close");
+ } else if (flashEvent.type == "message") {
+ var data = decodeURIComponent(flashEvent.message);
+ jsEvent = this.__createMessageEvent("message", data);
+ } else {
+ throw "unknown event type: " + flashEvent.type;
+ }
+
+ this.dispatchEvent(jsEvent);
+ };
+
+ WebSocket.prototype.__createSimpleEvent = function(type) {
+ if (document.createEvent && window.Event) {
+ var event = document.createEvent("Event");
+ event.initEvent(type, false, false);
+ return event;
+ } else {
+ return {type: type, bubbles: false, cancelable: false};
+ }
+ };
+
+ WebSocket.prototype.__createMessageEvent = function(type, data) {
+ if (document.createEvent && window.MessageEvent && !window.opera) {
+ var event = document.createEvent("MessageEvent");
+ event.initMessageEvent("message", false, false, data, null, null, window, null);
+ return event;
+ } else {
+ // IE and Opera, the latter one truncates the data parameter after any 0x00 bytes.
+ return {type: type, data: data, bubbles: false, cancelable: false};
+ }
+ };
+
+ /**
+ * Define the WebSocket readyState enumeration.
+ */
+ WebSocket.CONNECTING = 0;
+ WebSocket.OPEN = 1;
+ WebSocket.CLOSING = 2;
+ WebSocket.CLOSED = 3;
+
+ WebSocket.__flash = null;
+ WebSocket.__instances = {};
+ WebSocket.__tasks = [];
+ WebSocket.__nextId = 0;
+
+ /**
+ * Load a new flash security policy file.
+ * @param {string} url
+ */
+ WebSocket.loadFlashPolicyFile = function(url){
+ WebSocket.__addTask(function() {
+ WebSocket.__flash.loadManualPolicyFile(url);
+ });
+ };
+
+ /**
+ * Loads WebSocketMain.swf and creates WebSocketMain object in Flash.
+ */
+ WebSocket.__initialize = function() {
+ if (WebSocket.__flash) return;
+
+ if (WebSocket.__swfLocation) {
+ // For backword compatibility.
+ window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
+ }
+ if (!window.WEB_SOCKET_SWF_LOCATION) {
+ console.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
+ return;
+ }
+ var container = document.createElement("div");
+ container.id = "webSocketContainer";
+ // Hides Flash box. We cannot use display: none or visibility: hidden because it prevents
+ // Flash from loading at least in IE. So we move it out of the screen at (-100, -100).
+ // But this even doesn't work with Flash Lite (e.g. in Droid Incredible). So with Flash
+ // Lite, we put it at (0, 0). This shows 1x1 box visible at left-top corner but this is
+ // the best we can do as far as we know now.
+ container.style.position = "absolute";
+ if (WebSocket.__isFlashLite()) {
+ container.style.left = "0px";
+ container.style.top = "0px";
+ } else {
+ container.style.left = "-100px";
+ container.style.top = "-100px";
+ }
+ var holder = document.createElement("div");
+ holder.id = "webSocketFlash";
+ container.appendChild(holder);
+ document.body.appendChild(container);
+ // See this article for hasPriority:
+ // http://help.adobe.com/en_US/as3/mobile/WS4bebcd66a74275c36cfb8137124318eebc6-7ffd.html
+ swfobject.embedSWF(
+ WEB_SOCKET_SWF_LOCATION,
+ "webSocketFlash",
+ "1" /* width */,
+ "1" /* height */,
+ "10.0.0" /* SWF version */,
+ null,
+ null,
+ {hasPriority: true, swliveconnect : true, allowScriptAccess: "always"},
+ null,
+ function(e) {
+ if (!e.success) {
+ console.error("[WebSocket] swfobject.embedSWF failed");
+ }
+ });
+ };
+
+ /**
+ * Called by Flash to notify JS that it's fully loaded and ready
+ * for communication.
+ */
+ WebSocket.__onFlashInitialized = function() {
+ // We need to set a timeout here to avoid round-trip calls
+ // to flash during the initialization process.
+ setTimeout(function() {
+ WebSocket.__flash = document.getElementById("webSocketFlash");
+ WebSocket.__flash.setCallerUrl(location.href);
+ WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);
+ for (var i = 0; i < WebSocket.__tasks.length; ++i) {
+ WebSocket.__tasks[i]();
+ }
+ WebSocket.__tasks = [];
+ }, 0);
+ };
+
+ /**
+ * Called by Flash to notify WebSockets events are fired.
+ */
+ WebSocket.__onFlashEvent = function() {
+ setTimeout(function() {
+ try {
+ // Gets events using receiveEvents() instead of getting it from event object
+ // of Flash event. This is to make sure to keep message order.
+ // It seems sometimes Flash events don't arrive in the same order as they are sent.
+ var events = WebSocket.__flash.receiveEvents();
+ for (var i = 0; i < events.length; ++i) {
+ WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]);
+ }
+ } catch (e) {
+ console.error(e);
+ }
+ }, 0);
+ return true;
+ };
+
+ // Called by Flash.
+ WebSocket.__log = function(message) {
+ console.log(decodeURIComponent(message));
+ };
+
+ // Called by Flash.
+ WebSocket.__error = function(message) {
+ console.error(decodeURIComponent(message));
+ };
+
+ WebSocket.__addTask = function(task) {
+ if (WebSocket.__flash) {
+ task();
+ } else {
+ WebSocket.__tasks.push(task);
+ }
+ };
+
+ /**
+ * Test if the browser is running flash lite.
+ * @return {boolean} True if flash lite is running, false otherwise.
+ */
+ WebSocket.__isFlashLite = function() {
+ if (!window.navigator || !window.navigator.mimeTypes) {
+ return false;
+ }
+ var mimeType = window.navigator.mimeTypes["application/x-shockwave-flash"];
+ if (!mimeType || !mimeType.enabledPlugin || !mimeType.enabledPlugin.filename) {
+ return false;
+ }
+ return mimeType.enabledPlugin.filename.match(/flashlite/i) ? true : false;
+ };
+
+ if (!window.WEB_SOCKET_DISABLE_AUTO_INITIALIZATION) {
+ if (window.addEventListener) {
+ window.addEventListener("load", function(){
+ WebSocket.__initialize();
+ }, false);
+ } else {
+ window.attachEvent("onload", function(){
+ WebSocket.__initialize();
+ });
+ }
+ }
+
+})();

diff --git a/noVNC/include/websock.js b/noVNC/include/websock.js
new file mode 100644
index 0000000..20d51d6
--- /dev/null
+++ b/noVNC/include/websock.js
@@ -0,0 +1,360 @@
+/*
+ * Websock: high-performance binary WebSockets
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * Websock is similar to the standard WebSocket object but Websock
+ * enables communication with raw TCP sockets (i.e. the binary stream)
+ * via websockify. This is accomplished by base64 encoding the data
+ * stream between Websock and websockify.
+ *
+ * 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.
+ */
+
+/*jslint browser: true, bitwise: false, plusplus: false */
+/*global Util, Base64 */
+
+
+// Load Flash WebSocket emulator if needed
+
+// To force WebSocket emulator even when native WebSocket available
+//window.WEB_SOCKET_FORCE_FLASH = true;
+// To enable WebSocket emulator debug:
+//window.WEB_SOCKET_DEBUG=1;
+
+if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
+ Websock_native = true;
+} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
+ Websock_native = true;
+ window.WebSocket = window.MozWebSocket;
+} else {
+ /* no builtin WebSocket so load web_socket.js */
+
+ Websock_native = false;
+ (function () {
+ function get_INCLUDE_URI() {
+ return (typeof INCLUDE_URI !== "undefined") ?
+ INCLUDE_URI : "include/";
+ }
+
+ var start = "<script src='" + get_INCLUDE_URI(),
+ end = "'><\/script>", extra = "";
+
+ window.WEB_SOCKET_SWF_LOCATION = get_INCLUDE_URI() +
+ "web-socket-js/WebSocketMain.swf";
+ if (Util.Engine.trident) {
+ Util.Debug("Forcing uncached load of WebSocketMain.swf");
+ window.WEB_SOCKET_SWF_LOCATION += "?" + Math.random();
+ }
+ extra += start + "web-socket-js/swfobject.js" + end;
+ extra += start + "web-socket-js/web_socket.js" + end;
+ document.write(extra);
+ }());
+}
+
+
+function Websock() {
+"use strict";
+
+var api = {}, // Public API
+ websocket = null, // WebSocket object
+ rQ = [], // Receive queue
+ rQi = 0, // Receive queue index
+ rQmax = 10000, // Max receive queue size before compacting
+ sQ = [], // Send queue
+
+ eventHandlers = {
+ 'message' : function() {},
+ 'open' : function() {},
+ 'close' : function() {},
+ 'error' : function() {}
+ },
+
+ test_mode = false;
+
+
+//
+// Queue public functions
+//
+
+function get_sQ() {
+ return sQ;
+}
+
+function get_rQ() {
+ return rQ;
+}
+function get_rQi() {
+ return rQi;
+}
+function set_rQi(val) {
+ rQi = val;
+}
+
+function rQlen() {
+ return rQ.length - rQi;
+}
+
+function rQpeek8() {
+ return (rQ[rQi] );
+}
+function rQshift8() {
+ return (rQ[rQi++] );
+}
+function rQunshift8(num) {
+ if (rQi === 0) {
+ rQ.unshift(num);
+ } else {
+ rQi -= 1;
+ rQ[rQi] = num;
+ }
+
+}
+function rQshift16() {
+ return (rQ[rQi++] << 8) +
+ (rQ[rQi++] );
+}
+function rQshift32() {
+ return (rQ[rQi++] << 24) +
+ (rQ[rQi++] << 16) +
+ (rQ[rQi++] << 8) +
+ (rQ[rQi++] );
+}
+function rQshiftStr(len) {
+ if (typeof(len) === 'undefined') { len = rQlen(); }
+ var arr = rQ.slice(rQi, rQi + len);
+ rQi += len;
+ return arr.map(function (num) {
+ return String.fromCharCode(num); } ).join('');
+
+}
+function rQshiftBytes(len) {
+ if (typeof(len) === 'undefined') { len = rQlen(); }
+ rQi += len;
+ return rQ.slice(rQi-len, rQi);
+}
+
+function rQslice(start, end) {
+ if (end) {
+ return rQ.slice(rQi + start, rQi + end);
+ } else {
+ return rQ.slice(rQi + start);
+ }
+}
+
+// Check to see if we must wait for 'num' bytes (default to FBU.bytes)
+// to be available in the receive queue. Return true if we need to
+// wait (and possibly print a debug message), otherwise false.
+function rQwait(msg, num, goback) {
+ var rQlen = rQ.length - rQi; // Skip rQlen() function call
+ if (rQlen < num) {
+ if (goback) {
+ if (rQi < goback) {
+ throw("rQwait cannot backup " + goback + " bytes");
+ }
+ rQi -= goback;
+ }
+ //Util.Debug(" waiting for " + (num-rQlen) +
+ // " " + msg + " byte(s)");
+ return true; // true means need more data
+ }
+ return false;
+}
+
+//
+// Private utility routines
+//
+
+function encode_message() {
+ /* base64 encode */
+ return Base64.encode(sQ);
+}
+
+function decode_message(data) {
+ //Util.Debug(">> decode_message: " + data);
+ /* base64 decode */
+ rQ = rQ.concat(Base64.decode(data, 0));
+ //Util.Debug(">> decode_message, rQ: " + rQ);
+}
+
+
+//
+// Public Send functions
+//
+
+function flush() {
+ if (websocket.bufferedAmount !== 0) {
+ Util.Debug("bufferedAmount: " + websocket.bufferedAmount);
+ }
+ if (websocket.bufferedAmount < api.maxBufferedAmount) {
+ //Util.Debug("arr: " + arr);
+ //Util.Debug("sQ: " + sQ);
+ if (sQ.length > 0) {
+ websocket.send(encode_message(sQ));
+ sQ = [];
+ }
+ return true;
+ } else {
+ Util.Info("Delaying send, bufferedAmount: " +
+ websocket.bufferedAmount);
+ return false;
+ }
+}
+
+// overridable for testing
+function send(arr) {
+ //Util.Debug(">> send_array: " + arr);
+ sQ = sQ.concat(arr);
+ return flush();
+}
+
+function send_string(str) {
+ //Util.Debug(">> send_string: " + str);
+ api.send(str.split('').map(
+ function (chr) { return chr.charCodeAt(0); } ) );
+}
+
+//
+// Other public functions
+
+function recv_message(e) {
+ //Util.Debug(">> recv_message: " + e.data.length);
+
+ try {
+ decode_message(e.data);
+ if (rQlen() > 0) {
+ eventHandlers.message();
+ // Compact the receive queue
+ if (rQ.length > rQmax) {
+ //Util.Debug("Compacting receive queue");
+ rQ = rQ.slice(rQi);
+ rQi = 0;
+ }
+ } else {
+ Util.Debug("Ignoring empty message");
+ }
+ } catch (exc) {
+ if (typeof exc.stack !== 'undefined') {
+ Util.Warn("recv_message, caught exception: " + exc.stack);
+ } else if (typeof exc.description !== 'undefined') {
+ Util.Warn("recv_message, caught exception: " + exc.description);
+ } else {
+ Util.Warn("recv_message, caught exception:" + exc);
+ }
+ if (typeof exc.name !== 'undefined') {
+ eventHandlers.error(exc.name + ": " + exc.message);
+ } else {
+ eventHandlers.error(exc);
+ }
+ }
+ //Util.Debug("<< recv_message");
+}
+
+
+// Set event handlers
+function on(evt, handler) {
+ eventHandlers[evt] = handler;
+}
+
+function init() {
+ rQ = [];
+ rQi = 0;
+ sQ = [];
+ websocket = null;
+}
+
+function open(uri) {
+ init();
+
+ if (test_mode) {
+ websocket = {};
+ } else {
+ websocket = new WebSocket(uri, 'base64');
+ // TODO: future native binary support
+ //websocket = new WebSocket(uri, ['binary', 'base64']);
+ }
+
+ websocket.onmessage = recv_message;
+ websocket.onopen = function() {
+ Util.Debug(">> WebSock.onopen");
+ if (websocket.protocol) {
+ Util.Info("Server chose sub-protocol: " + websocket.protocol);
+ } else {
+ Util.Error("Server select no sub-protocol!: " + websocket.protocol);
+ }
+ eventHandlers.open();
+ Util.Debug("<< WebSock.onopen");
+ };
+ websocket.onclose = function(e) {
+ Util.Debug(">> WebSock.onclose");
+ eventHandlers.close(e);
+ Util.Debug("<< WebSock.onclose");
+ };
+ websocket.onerror = function(e) {
+ Util.Debug(">> WebSock.onerror: " + e);
+ eventHandlers.error(e);
+ Util.Debug("<< WebSock.onerror");
+ };
+}
+
+function close() {
+ if (websocket) {
+ if ((websocket.readyState === WebSocket.OPEN) ||
+ (websocket.readyState === WebSocket.CONNECTING)) {
+ Util.Info("Closing WebSocket connection");
+ websocket.close();
+ }
+ websocket.onmessage = function (e) { return; };
+ }
+}
+
+// Override internal functions for testing
+// Takes a send function, returns reference to recv function
+function testMode(override_send) {
+ test_mode = true;
+ api.send = override_send;
+ api.close = function () {};
+ return recv_message;
+}
+
+function constructor() {
+ // Configuration settings
+ api.maxBufferedAmount = 200;
+
+ // Direct access to send and receive queues
+ api.get_sQ = get_sQ;
+ api.get_rQ = get_rQ;
+ api.get_rQi = get_rQi;
+ api.set_rQi = set_rQi;
+
+ // Routines to read from the receive queue
+ api.rQlen = rQlen;
+ api.rQpeek8 = rQpeek8;
+ api.rQshift8 = rQshift8;
+ api.rQunshift8 = rQunshift8;
+ api.rQshift16 = rQshift16;
+ api.rQshift32 = rQshift32;
+ api.rQshiftStr = rQshiftStr;
+ api.rQshiftBytes = rQshiftBytes;
+ api.rQslice = rQslice;
+ api.rQwait = rQwait;
+
+ api.flush = flush;
+ api.send = send;
+ api.send_string = send_string;
+
+ api.on = on;
+ api.init = init;
+ api.open = open;
+ api.close = close;
+ api.testMode = testMode;
+
+ return api;
+}
+
+return constructor();
+
+}

diff --git a/noVNC/include/webutil.js b/noVNC/include/webutil.js
new file mode 100644
index 0000000..6722fe3
--- /dev/null
+++ b/noVNC/include/webutil.js
@@ -0,0 +1,148 @@
+/*
+ * noVNC: HTML5 VNC client
+ * Copyright (C) 2012 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ *
+ * See README.md for usage and integration instructions.
+ */
+
+"use strict";
+/*jslint bitwise: false, white: false */
+/*global Util, window, document */
+
+// Globals defined here
+var WebUtil = {}, $D;
+
+/*
+ * Simple DOM selector by ID
+ */
+if (!window.$D) {
+ window.$D = function (id) {
+ if (document.getElementById) {
+ return document.getElementById(id);
+ } else if (document.all) {
+ return document.all[id];
+ } else if (document.layers) {
+ return document.layers[id];
+ }
+ return undefined;
+ };
+}
+
+
+/*
+ * ------------------------------------------------------
+ * Namespaced in WebUtil
+ * ------------------------------------------------------
+ */
+
+// init log level reading the logging HTTP param
+WebUtil.init_logging = function() {
+ Util._log_level = (document.location.href.match(
+ /logging=([A-Za-z0-9\._\-]*)/) ||
+ ['', Util._log_level])[1];
+
+ Util.init_logging();
+};
+WebUtil.init_logging();
+
+
+WebUtil.dirObj = function (obj, depth, parent) {
+ var i, msg = "", val = "";
+ if (! depth) { depth=2; }
+ if (! parent) { parent= ""; }
+
+ // Print the properties of the passed-in object
+ for (i in obj) {
+ if ((depth > 1) && (typeof obj[i] === "object")) {
+ // Recurse attributes that are objects
+ msg += WebUtil.dirObj(obj[i], depth-1, parent + "." + i);
+ } else {
+ //val = new String(obj[i]).replace("\n", " ");
+ if (typeof(obj[i]) === "undefined") {
+ val = "undefined";
+ } else {
+ val = obj[i].toString().replace("\n", " ");
+ }
+ if (val.length > 30) {
+ val = val.substr(0,30) + "...";
+ }
+ msg += parent + "." + i + ": " + val + "\n";
+ }
+ }
+ return msg;
+};
+
+// Read a query string variable
+WebUtil.getQueryVar = function(name, defVal) {
+ var re = new RegExp('[?][^#]*' + name + '=([^&#]*)');
+ if (typeof defVal === 'undefined') { defVal = null; }
+ return (document.location.href.match(re) || ['',defVal])[1];
+};
+
+
+/*
+ * Cookie handling. Dervied from: http://www.quirksmode.org/js/cookies.html
+ */
+
+// No days means only for this browser session
+WebUtil.createCookie = function(name,value,days) {
+ var date, expires;
+ if (days) {
+ date = new Date();
+ date.setTime(date.getTime()+(days*24*60*60*1000));
+ expires = "; expires="+date.toGMTString();
+ }
+ else {
+ expires = "";
+ }
+ document.cookie = name+"="+value+expires+"; path=/";
+};
+
+WebUtil.readCookie = function(name, defaultValue) {
+ var i, c, nameEQ = name + "=", ca = document.cookie.split(';');
+ for(i=0; i < ca.length; i += 1) {
+ c = ca[i];
+ while (c.charAt(0) === ' ') { c = c.substring(1,c.length); }
+ if (c.indexOf(nameEQ) === 0) { return c.substring(nameEQ.length,c.length); }
+ }
+ return (typeof defaultValue !== 'undefined') ? defaultValue : null;
+};
+
+WebUtil.eraseCookie = function(name) {
+ WebUtil.createCookie(name,"",-1);
+};
+
+/*
+ * Alternate stylesheet selection
+ */
+WebUtil.getStylesheets = function() { var i, links, sheets = [];
+ links = document.getElementsByTagName("link");
+ for (i = 0; i < links.length; i += 1) {
+ if (links[i].title &&
+ links[i].rel.toUpperCase().indexOf("STYLESHEET") > -1) {
+ sheets.push(links[i]);
+ }
+ }
+ return sheets;
+};
+
+// No sheet means try and use value from cookie, null sheet used to
+// clear all alternates.
+WebUtil.selectStylesheet = function(sheet) {
+ var i, link, sheets = WebUtil.getStylesheets();
+ if (typeof sheet === 'undefined') {
+ sheet = 'default';
+ }
+ for (i=0; i < sheets.length; i += 1) {
+ link = sheets[i];
+ if (link.title === sheet) {
+ Util.Debug("Using stylesheet " + sheet);
+ link.disabled = false;
+ } else {
+ //Util.Debug("Skipping stylesheet " + link.title);
+ link.disabled = true;
+ }
+ }
+ return sheet;
+};

diff --git a/noVNC/tests/arrays.html b/noVNC/tests/arrays.html
new file mode 100644
index 0000000..257df26
--- /dev/null
+++ b/noVNC/tests/arrays.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Javascript Arrays Performance Test</title>
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="browser.js"></script>
+ <script src="stats.js"></script>
+ <script src="arrays.js"></script>
+ </head>
+ <body>
+ <h3>Javascript Arrays Performance Test</h3>
+ Iterations: <input id='iterations' style='width:50'>&nbsp;
+ Array Size: <input id='arraySize' style='width:40'>*1024&nbsp;
+
+ <input id='startButton' type='button' value='Run Tests'
+ onclick="begin();">&nbsp;
+
+ <br><br>
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=50></textarea>
+ </br>
+ <canvas id="canvas" style="display: none;"></canvas>
+
+ </body>
+
+ <script>
+ var verbose = true;
+ window.onload = function() {
+ vmessage("in onload");
+ init();
+
+ }
+ </script>
+</html>

diff --git a/noVNC/tests/arrays.js b/noVNC/tests/arrays.js
new file mode 100644
index 0000000..5f6a8c4
--- /dev/null
+++ b/noVNC/tests/arrays.js
@@ -0,0 +1,375 @@
+/*
+ * Javascript binary array performance tests
+ * Copyright (C) 2011 Joel Martin
+ * Licensed under LGPL-3 (see LICENSE.txt)
+ */
+
+var ctx, i, j, randlist,
+ new_normal, new_imageData, new_arrayBuffer,
+ browser = Browser.browser + " " +
+ Browser.version + " on " +
+ Browser.OS,
+ do_imageData = false,
+ do_arrayBuffer = false,
+ conf = {
+ 'create_cnt' : 2000,
+ 'read_cnt' : 5000000,
+ 'write_cnt' : 5000000,
+ 'iterations' : 0,
+ 'order_l1' : [browser],
+ 'order_l2' : ['normal',
+ 'imageData',
+ 'arrayBuffer'],
+ 'order_l3' : ['create',
+ 'sequentialRead',
+ 'randomRead',
+ 'sequentialWrite']
+ },
+ stats = {},
+ testFunc = {},
+ iteration, arraySize;
+
+var newline = "\n";
+if (Util.Engine.trident) {
+ var newline = "<br>\n";
+}
+function message(str) {
+ //console.log(str);
+ cell = $D('messages');
+ cell.innerHTML += str + newline;
+ cell.scrollTop = cell.scrollHeight;
+}
+
+function vmessage(str) {
+ if (verbose) {
+ message(str);
+ } else {
+ console.log(str);
+ }
+}
+
+new_normal = function() {
+ var arr = [], i;
+ for (i = 0; i < arraySize; i++) {
+ arr[i] = 0;
+ }
+ return arr;
+}
+
+/* Will be overridden with real function */
+new_imageData = function() {
+ throw("imageData not supported");
+};
+
+new_imageData_createImageData = function() {
+ var imageData = ctx.createImageData(1024/4, arraySize / 1024);
+ return imageData.data;
+};
+
+new_imageData_getImageData = function() {
+ var imageData = ctx.getImageData(0, 0, 1024/4, arraySize / 1024),
+ arr = imageData.data;
+ for (i = 0; i < arraySize; i++) {
+ arr[i] = 0;
+ }
+ return arr;
+};
+
+new_arrayBuffer = function() {
+ var arr = new ArrayBuffer(arraySize);
+ return new Uint8Array(arr);
+}
+
+function init_randlist() {
+ randlist = [];
+ for (var i=0; i < arraySize; i++) {
+ randlist[i] = parseInt(Math.random() * 256, 10);
+ }
+}
+function copy_randlist(arr) {
+ for (var i=0; i < arraySize; i++) {
+ arr[i] = randlist[i];
+ }
+}
+
+function begin() {
+ var i, j;
+ conf.iterations = parseInt($D('iterations').value, 10);
+ arraySize = parseInt($D('arraySize').value, 10) * 1024;
+
+ init_randlist();
+
+ // TODO: randomize test_list
+
+ stats = {};
+ for (i = 0; i < conf.order_l2.length; i++) {
+ stats[conf.order_l2[i]] = {};
+ for (j = 0; j < conf.order_l3.length; j++) {
+ stats[conf.order_l2[i]][conf.order_l3[j]] = [];
+ }
+ }
+
+ $D('startButton').value = "Running";
+ $D('startButton').disabled = true;
+
+ message("running " + conf.iterations + " test iterations");
+ iteration = 1;
+ setTimeout(run_next_iteration, 250);
+}
+
+function finish() {
+ var totalTime, arrayType, testType, times;
+ message("tests finished");
+
+ for (j = 0; j < conf.order_l3.length; j++) {
+ testType = conf.order_l3[j];
+ message("Test '" + testType + "'");
+ for (i = 0; i < conf.order_l2.length; i++) {
+ arrayType = conf.order_l2[i];
+ message(" Array Type '" + arrayType);
+ times = stats[arrayType][testType];
+ message(" Average : " + times.mean() + "ms" +
+ " (Total: " + times.sum() + "ms)");
+ message(" Min/Max : " + times.min() + "ms/" +
+ times.max() + "ms");
+ message(" StdDev : " + times.stdDev() + "ms");
+ }
+ }
+
+ vmessage("array_chart.py JSON data:");
+ chart_data = {'conf' : conf, 'stats' : { } };
+ chart_data.stats[browser] = stats;
+ chart_data.stats['next_browser'] = {};
+ vmessage(JSON.stringify(chart_data, null, 2));
+
+ $D('startButton').disabled = false;
+ $D('startButton').value = "Run Tests";
+}
+
+function run_next_iteration() {
+ var arrayType, testType, deltaTime;
+
+ for (i = 0; i < conf.order_l2.length; i++) {
+ arrayType = conf.order_l2[i];
+ if (arrayType === 'imageData' && (!do_imageData)) {
+ continue;
+ }
+ if (arrayType === 'arrayBuffer' && (!do_arrayBuffer)) {
+ continue;
+ }
+ for (j = 0; j < conf.order_l3.length; j++) {
+ testType = conf.order_l3[j];
+
+ deltaTime = testFunc[arrayType + "_" + testType]();
+
+ stats[arrayType][testType].push(deltaTime);
+ vmessage("test " + (arrayType + "_" + testType) +
+ " time: " + (deltaTime) + "ms");
+ }
+ }
+
+ message("finished test iteration " + iteration);
+ if (iteration >= conf.iterations) {
+ setTimeout(finish, 1);
+ return;
+ }
+ iteration++;
+ setTimeout(run_next_iteration, 1);
+}
+
+/*
+ * Test functions
+ */
+
+testFunc["normal_create"] = function() {
+ var cnt, arrNormal, startTime, endTime;
+ vmessage("create normal array " + conf.create_cnt + "x, initialized to 0");
+
+ startTime = (new Date()).getTime();
+ for (cnt = 0; cnt < conf.create_cnt; cnt++) {
+ arrNormal = new_normal();
+ }
+ endTime = (new Date()).getTime();
+
+ return endTime - startTime;
+};
+
+testFunc["imageData_create"] = function() {
+ var cnt, arrImage, startTime, endTime;
+ vmessage("create imageData array " + conf.create_cnt + "x, initialized to 0");
+
+ startTime = (new Date()).getTime();
+ for (cnt = 0; cnt < conf.create_cnt; cnt++) {
+ arrImage = new_imageData();
+ }
+ endTime = (new Date()).getTime();
+
+ if (arrImage[103] !== 0) {
+ message("Initialization failed, arrImage[103] is: " + arrImage[103]);
+ throw("Initialization failed, arrImage[103] is: " + arrImage[103]);
+ }
+ return endTime - startTime;
+};
+
+testFunc["arrayBuffer_create"] = function() {
+ var cnt, arrBuffer, startTime, endTime;
+ vmessage("create arrayBuffer array " + conf.create_cnt + "x, initialized to 0");
+
+ startTime = (new Date()).getTime();
+ for (cnt = 0; cnt < conf.create_cnt; cnt++) {
+ arrBuffer = new_arrayBuffer();
+ }
+ endTime = (new Date()).getTime();
+
+ if (arrBuffer[103] !== 0) {
+ message("Initialization failed, arrBuffer[103] is: " + arrBuffer[103]);
+ throw("Initialization failed, arrBuffer[103] is: " + arrBuffer[103]);
+ }
+ return endTime - startTime;
+};
+
+function test_sequentialRead(arr) {
+ var i, j, cnt, startTime, endTime;
+ /* Initialize the array */
+ copy_randlist(arr);
+
+ startTime = (new Date()).getTime();
+ i = 0;
+ j = 0;
+ for (cnt = 0; cnt < conf.read_cnt; cnt++) {
+ j = arr[i];
+ i++;
+ if (i >= arraySize) {
+ i = 0;
+ }
+ }
+ endTime = (new Date()).getTime();
+
+ return endTime - startTime;
+}
+
+function test_randomRead(arr) {
+ var i, cnt, startTime, endTime;
+ /* Initialize the array */
+ copy_randlist(arr); // used as jumplist
+
+ startTime = (new Date()).getTime();
+ i = 0;
+ for (cnt = 0; cnt < conf.read_cnt; cnt++) {
+ i = (arr[i] + cnt) % arraySize;
+ }
+ endTime = (new Date()).getTime();
+
+ return endTime - startTime;
+}
+
+function test_sequentialWrite(arr) {
+ var i, cnt, startTime, endTime;
+ /* Initialize the array */
+ copy_randlist(arr);
+
+ startTime = (new Date()).getTime();
+ i = 0;
+ for (cnt = 0; cnt < conf.write_cnt; cnt++) {
+ arr[i] = (cnt % 256);
+ i++;
+ if (i >= arraySize) {
+ i = 0;
+ }
+ }
+ endTime = (new Date()).getTime();
+
+ return endTime - startTime;
+}
+
+/* Sequential Read Tests */
+testFunc["normal_sequentialRead"] = function() {
+ vmessage("read normal array " + conf.read_cnt + "x");
+ return test_sequentialRead(new_normal());
+};
+
+testFunc["imageData_sequentialRead"] = function() {
+ vmessage("read imageData array " + conf.read_cnt + "x");
+ return test_sequentialRead(new_imageData());
+};
+
+testFunc["arrayBuffer_sequentialRead"] = function() {
+ vmessage("read arrayBuffer array " + conf.read_cnt + "x");
+ return test_sequentialRead(new_arrayBuffer());
+};
+
+
+/* Random Read Tests */
+testFunc["normal_randomRead"] = function() {
+ vmessage("read normal array " + conf.read_cnt + "x");
+ return test_randomRead(new_normal());
+};
+
+testFunc["imageData_randomRead"] = function() {
+ vmessage("read imageData array " + conf.read_cnt + "x");
+ return test_randomRead(new_imageData());
+};
+
+testFunc["arrayBuffer_randomRead"] = function() {
+ vmessage("read arrayBuffer array " + conf.read_cnt + "x");
+ return test_randomRead(new_arrayBuffer());
+};
+
+
+/* Sequential Write Tests */
+testFunc["normal_sequentialWrite"] = function() {
+ vmessage("write normal array " + conf.write_cnt + "x");
+ return test_sequentialWrite(new_normal());
+};
+
+testFunc["imageData_sequentialWrite"] = function() {
+ vmessage("write imageData array " + conf.write_cnt + "x");
+ return test_sequentialWrite(new_imageData());
+};
+
+testFunc["arrayBuffer_sequentialWrite"] = function() {
+ vmessage("write arrayBuffer array " + conf.write_cnt + "x");
+ return test_sequentialWrite(new_arrayBuffer());
+};
+
+init = function() {
+ vmessage(">> init");
+
+ $D('iterations').value = 10;
+ $D('arraySize').value = 10;
+ arraySize = parseInt($D('arraySize').value, 10) * 1024;
+
+ message("Browser: " + browser);
+
+ /* Determine browser binary array support */
+ try {
+ ctx = $D('canvas').getContext('2d');
+ new_imageData = new_imageData_createImageData;
+ new_imageData();
+ do_imageData = true;
+ } catch (exc) {
+ vmessage("createImageData not supported: " + exc);
+ try {
+ ctx = $D('canvas').getContext('2d');
+ new_imageData = new_imageData_getImageData;
+ blah = new_imageData();
+ do_imageData = true;
+ } catch (exc) {
+ vmessage("getImageData not supported: " + exc);
+ }
+ }
+ if (! do_imageData) {
+ message("imageData arrays not supported");
+ }
+
+ try {
+ new_arrayBuffer();
+ do_arrayBuffer = true;
+ } catch (exc) {
+ vmessage("Typed Arrays not supported: " + exc);
+ }
+ if (! do_arrayBuffer) {
+ message("Typed Arrays (ArrayBuffers) not suppoted");
+ }
+ vmessage("<< init");
+}

diff --git a/noVNC/tests/base64.html b/noVNC/tests/base64.html
new file mode 100644
index 0000000..dc45fdd
--- /dev/null
+++ b/noVNC/tests/base64.html
@@ -0,0 +1,91 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Native Base64 Tests</title>
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="../include/base64.js"></script>
+ </head>
+ <body>
+ <h1>Native Base64 Tests</h1>
+
+ <br>
+ Messages:<br>
+ <textarea id="debug" style="font-size: 9px;" cols=80 rows=25></textarea>
+
+ <br>
+ </body>
+
+<script>
+ function debug(str) {
+ console.log(str);
+ cell = $D('debug');
+ cell.innerHTML += str + "\n";
+ cell.scrollTop = cell.scrollHeight;
+ }
+
+ function assertRun(code, result) {
+ try {
+ var actual = eval(code);
+ } catch (exc) {
+ debug("FAIL: '" + code + "' threw an exception");
+ fail += 1;
+ return false;
+ }
+ if (actual !== result) {
+ debug("FAIL: '" + code + "' returned '" + actual + "', expected '" + result + "'");
+ fail += 1;
+ return false;
+ }
+ debug("PASS: '" + code + "' returned expected '" + result +"'");
+ pass += 1;
+ return true;
+ }
+
+ function Base64_decode(data) {
+ var arr = Base64.decode (data);
+ return arr.map(function (num) {
+ return String.fromCharCode(num); } ).join('');
+
+ }
+
+ window.onload = function() {
+ var str;
+ debug('onload');
+ fail = 0;
+ pass = 0;
+ assertRun('window.btoa("hello world")', 'aGVsbG8gd29ybGQ=');
+ assertRun('window.btoa("a")', 'YQ==');
+ assertRun('window.btoa("ab")', 'YWI=');
+ assertRun('window.btoa("abc")', 'YWJj');
+ assertRun('window.btoa("abcd")', 'YWJjZA==');
+ assertRun('window.btoa("abcde")', 'YWJjZGU=');
+ assertRun('window.btoa("abcdef")', 'YWJjZGVm');
+ assertRun('window.btoa("abcdefg")', 'YWJjZGVmZw==');
+ assertRun('window.btoa("abcdefgh")', 'YWJjZGVmZ2g=');
+
+ assertRun('window.atob("aGVsbG8gd29ybGQ=")', 'hello world');
+ assertRun('Base64_decode("aGVsbG8gd29ybGQ=")', 'hello world');
+ assertRun('window.atob("YQ==")', 'a');
+ assertRun('Base64_decode("YQ==")', 'a');
+ assertRun('window.atob("YWI=")', 'ab');
+ assertRun('Base64_decode("YWI=")', 'ab');
+ assertRun('window.atob("YWJj")', 'abc');
+ assertRun('Base64_decode("YWJj")', 'abc');
+ assertRun('window.atob("YWJjZA==")', 'abcd');
+ assertRun('Base64_decode("YWJjZA==")', 'abcd');
+ assertRun('window.atob("YWJjZGU=")', 'abcde');
+ assertRun('Base64_decode("YWJjZGU=")', 'abcde');
+ assertRun('window.atob("YWJjZGVm")', 'abcdef');
+ assertRun('Base64_decode("YWJjZGVm")', 'abcdef');
+
+ assertRun('typeof window.btoa', 'function');
+ assertRun('window.btoa("")', '');
+ assertRun('window.btoa(null)', '');
+ assertRun('window.atob(window.btoa(window))', window.toString()); // "[object DOMWindow]"
+ assertRun('window.btoa("\\u0080\\u0081")', 'gIE=');
+
+ debug("Tests failed: " + fail);
+ debug("Tests passed: " + pass);
+ }
+</script>

diff --git a/noVNC/tests/base64.js b/noVNC/tests/base64.js
new file mode 100644
index 0000000..6ade00a
--- /dev/null
+++ b/noVNC/tests/base64.js
@@ -0,0 +1,12 @@
+// The following results in 'hello [MANGLED]'
+//
+// Filed as https://github.com/ry/node/issues/issue/402
+
+var sys = require("sys"),
+ buf = new Buffer(1024), len,
+ str1 = "aGVsbG8g", // 'hello '
+ str2 = "d29ybGQ=", // 'world'
+
+len = buf.write(str1, 0, 'base64');
+len += buf.write(str2, len, 'base64');
+sys.log("decoded result: " + buf.toString('binary', 0, len));

diff --git a/noVNC/tests/browser.js b/noVNC/tests/browser.js
new file mode 100644
index 0000000..7cf8279
--- /dev/null
+++ b/noVNC/tests/browser.js
@@ -0,0 +1,134 @@
+/*
+ * From:
+ * http://www.quirksmode.org/js/detect.html
+ */
+
+var Browser = {
+ init: function () {
+ this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
+ this.version = this.searchVersion(navigator.userAgent)
+ || this.searchVersion(navigator.appVersion)
+ || "an unknown version";
+ this.majorVersion = this.searchMajorVersion(navigator.userAgent)
+ || this.searchMajorVersion(navigator.appVersion)
+ || "an unknown version";
+ this.fullVersion = this.searchFullVersion(navigator.userAgent)
+ || this.searchFullVersion(navigator.appVersion)
+ || "an unknown version";
+ this.OS = this.searchString(this.dataOS) || "an unknown OS";
+ },
+ searchString: function (data) {
+ for (var i=0;i<data.length;i++) {
+ var dataString = data[i].string;
+ var dataProp = data[i].prop;
+ this.versionSearchString = data[i].versionSearch || data[i].identity;
+ if (dataString) {
+ if (dataString.indexOf(data[i].subString) != -1)
+ return data[i].identity;
+ }
+ else if (dataProp)
+ return data[i].identity;
+ }
+ },
+ searchFullVersion: function (dataString) {
+ var index = dataString.indexOf(this.versionSearchString);
+ if (index == -1) return;
+ return dataString.substring(index+this.versionSearchString.length+1);
+ },
+ searchVersion: function (dataString) {
+ return this.searchFullVersion(dataString).split(" ")[0];
+ },
+ searchMajorVersion: function (dataString) {
+ return parseFloat(this.searchFullVersion(dataString).split(".")[0]);
+ },
+ dataBrowser: [
+ {
+ string: navigator.userAgent,
+ subString: "Chrome",
+ identity: "Chrome"
+ },
+ { string: navigator.userAgent,
+ subString: "OmniWeb",
+ versionSearch: "OmniWeb/",
+ identity: "OmniWeb"
+ },
+ {
+ string: navigator.vendor,
+ subString: "Apple",
+ identity: "Safari",
+ versionSearch: "Version"
+ },
+ {
+ prop: window.opera,
+ identity: "Opera",
+ versionSearch: "Version"
+ },
+ {
+ string: navigator.vendor,
+ subString: "iCab",
+ identity: "iCab"
+ },
+ {
+ string: navigator.vendor,
+ subString: "KDE",
+ identity: "Konqueror"
+ },
+ {
+ string: navigator.userAgent,
+ subString: "Firefox",
+ identity: "Firefox"
+ },
+ {
+ string: navigator.vendor,
+ subString: "Camino",
+ identity: "Camino"
+ },
+ { // for newer Netscapes (6+)
+ string: navigator.userAgent,
+ subString: "Netscape",
+ identity: "Netscape"
+ },
+ {
+ string: navigator.userAgent,
+ subString: "MSIE",
+ identity: "Explorer",
+ versionSearch: "MSIE"
+ },
+ {
+ string: navigator.userAgent,
+ subString: "Gecko",
+ identity: "Mozilla",
+ versionSearch: "rv"
+ },
+ { // for older Netscapes (4-)
+ string: navigator.userAgent,
+ subString: "Mozilla",
+ identity: "Netscape",
+ versionSearch: "Mozilla"
+ }
+ ],
+ dataOS : [
+ {
+ string: navigator.platform,
+ subString: "Win",
+ identity: "Windows"
+ },
+ {
+ string: navigator.platform,
+ subString: "Mac",
+ identity: "Mac"
+ },
+ {
+ string: navigator.userAgent,
+ subString: "iPhone",
+ identity: "iPhone/iPod"
+ },
+ {
+ string: navigator.platform,
+ subString: "Linux",
+ identity: "Linux"
+ }
+ ]
+
+};
+Browser.init();

diff --git a/noVNC/tests/canvas.html b/noVNC/tests/canvas.html
new file mode 100644
index 0000000..010e8f3
--- /dev/null
+++ b/noVNC/tests/canvas.html
@@ -0,0 +1,148 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Canvas Performance Test</title>
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="../include/base64.js"></script>
+ <script src="../include/display.js"></script>
+ <script src="face.png.js"></script>
+ </head>
+ <body>
+ Iterations: <input id='iterations' style='width:50' value="100">&nbsp;
+
+ Width: <input id='width' style='width:50' value="640">&nbsp;
+ Height: <input id='height' style='width:50' value="480">&nbsp;
+
+ <input id='startButton' type='button' value='Do Performance Test'
+ style='width:150px' onclick="begin();">&nbsp;
+
+ <br><br>
+
+ <b>Canvas</b> (should see three squares and two happy faces):<br>
+ <canvas id="canvas" width="200" height="100"
+ style="border-style: dotted; border-width: 1px;">
+ Canvas not supported.
+ </canvas>
+
+ <br>
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=25></textarea>
+ </body>
+
+ <script>
+ var msg_cnt = 0;
+ var display, start_width = 300, start_height = 100;
+ var iterations;
+
+ function message(str) {
+ console.log(str);
+ cell = $D('messages');
+ cell.innerHTML += msg_cnt + ": " + str + "\n";
+ cell.scrollTop = cell.scrollHeight;
+ msg_cnt += 1;
+ }
+
+ function test_functions () {
+ var img, x, y, w, h, ctx = display.get_context();
+ w = display.get_width();
+ h = display.get_height();
+ display.fillRect(0, 0, w, h, [240,240,240]);
+
+ display.blitStringImage("data:image/png;base64," + face64, 150, 10);
+
+ var himg = new Image();
+ himg.onload = function () {
+ ctx.drawImage(himg, 200, 40); };
+ himg.src = "face.png";
+
+ /* Test array image data */
+ data = [];
+ for (y=0; y< 50; y++) {
+ for (x=0; x< 50; x++) {
+ data[(y*50 + x)*4 + 0] = 255 - parseInt((255 / 50) * y, 10);
+ data[(y*50 + x)*4 + 1] = parseInt((255 / 50) * y, 10);
+ data[(y*50 + x)*4 + 2] = parseInt((255 / 50) * x, 10);
+ data[(y*50 + x)*4 + 3] = 255;
+ }
+ }
+ display.blitImage(30, 10, 50, 50, data, 0);
+
+ img = display.getTile(5,5,16,16,[0,128,128]);
+ display.putTile(img);
+
+ img = display.getTile(90,15,16,16,[0,0,0]);
+ display.setSubTile(img, 0,0,16,16,[128,128,0]);
+ display.putTile(img);
+ }
+
+ function begin () {
+ $D('startButton').value = "Running";
+ $D('startButton').disabled = true;
+ setTimeout(start_delayed, 250);
+ iterations = $D('iterations').value;
+ }
+
+ function start_delayed () {
+ var ret;
+
+ ret = display.set_prefer_js(true);
+ if (ret) {
+ message("Running test: prefer Javascript ops");
+ var time1 = run_test();
+ message("prefer Javascript ops: " + time1 + "ms total, " +
+ (time1 / iterations) + "ms per frame");
+ } else {
+ message("Could not run: prefer Javascript ops");
+ }
+
+ display.set_prefer_js(false);
+ message("Running test: prefer Canvas ops");
+ var time2 = run_test();
+ message("prefer Canvas ops: " + time2 + "ms total, " +
+ (time2 / iterations) + "ms per frame");
+
+ if (Util.get_logging() !== 'debug') {
+ display.resize(start_width, start_height, true);
+ test_functions();
+ }
+ $D('startButton').disabled = false;
+ $D('startButton').value = "Do Performance Test";
+ }
+
+ function run_test () {
+ var width, height;
+ width = $D('width').value;
+ height = $D('height').value;
+ display.resize(width, height);
+ var color, start_time = (new Date()).getTime(), w, h;
+ for (var i=0; i < iterations; i++) {
+ color = [128, 128, (255 / iterations) * i, 0];
+ for (var x=0; x < width; x = x + 16) {
+ for (var y=0; y < height; y = y + 16) {
+ w = Math.min(16, width - x);
+ h = Math.min(16, height - y);
+ var tile = display.getTile(x, y, w, h, color);
+ display.setSubTile(tile, 0, 0, w, h, color);
+ display.putTile(tile);
+ }
+ }
+ }
+ var end_time = (new Date()).getTime();
+ return (end_time - start_time);
+ }
+
+ window.onload = function() {
+ message("in onload");
+ $D('iterations').value = 10;
+ display = new Display({'target' : $D('canvas')});
+ display.resize(start_width, start_height, true);
+ message("Canvas initialized");
+ test_functions();
+ }
+ </script>
+</html>

diff --git a/noVNC/tests/cursor.html b/noVNC/tests/cursor.html
new file mode 100644
index 0000000..91e621b
--- /dev/null
+++ b/noVNC/tests/cursor.html
@@ -0,0 +1,135 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>Cursor Change test</title>
+ <meta charset="UTF-8">
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="../include/base64.js"></script>
+ <script src="../include/canvas.js"></script>
+ </head>
+ <body>
+ <h1>Roll over the buttons to test cursors</h1>
+ <br>
+ <input id=button1 type="button" value="Cursor from file (smiley face)">
+ <input id=button2 type="button" value="Data URI cursor (crosshair)">
+
+ <br>
+ <br>
+ <br>
+ Debug:<br>
+ <textarea id="debug" style="font-size: 9px;" cols=80 rows=25></textarea>
+ <br>
+ <br>
+ <canvas id="testcanvas" width="100px" height="20px">
+ Canvas not supported.
+ </canvas>
+
+ </body>
+
+ <script>
+ function debug(str) {
+ console.log(str);
+ cell = $D('debug');
+ cell.innerHTML += str + "\n";
+ cell.scrollTop = cell.scrollHeight;
+ }
+
+ function makeCursor() {
+ var arr = [], x, y, w = 32, h = 32, hx = 16, hy = 16;
+
+ var IHDRsz = 40;
+ var ANDsz = w * h * 4;
+ var XORsz = Math.ceil( (w * h) / 8.0 );
+
+ // Push multi-byte little-endian values
+ arr.push16le = function (num) {
+ this.push((num ) & 0xFF,
+ (num >> 8) & 0xFF );
+ };
+ arr.push32le = function (num) {
+ this.push((num ) & 0xFF,
+ (num >> 8) & 0xFF,
+ (num >> 16) & 0xFF,
+ (num >> 24) & 0xFF );
+ };
+
+ // Main header
+ arr.push16le(0); // Reserved
+ arr.push16le(2); // .CUR type
+ arr.push16le(1); // Number of images, 1 for non-animated arr
+
+ // Cursor #1
+ arr.push(w); // width
+ arr.push(h); // height
+ arr.push(0); // colors, 0 -> true-color
+ arr.push(0); // reserved
+ arr.push16le(hx); // hotspot x coordinate
+ arr.push16le(hy); // hotspot y coordinate
+ arr.push32le(IHDRsz + XORsz + ANDsz); // cursor data byte size
+ arr.push32le(22); // offset of cursor data in the file
+
+ // Infoheader for Cursor #1
+ arr.push32le(IHDRsz); // Infoheader size
+ arr.push32le(w); // Cursor width
+ arr.push32le(h*2); // XOR+AND height
+ arr.push16le(1); // number of planes
+ arr.push16le(32); // bits per pixel
+ arr.push32le(0); // type of compression
+ arr.push32le(XORsz + ANDsz); // Size of Image
+ arr.push32le(0);
+ arr.push32le(0);
+ arr.push32le(0);
+ arr.push32le(0);
+
+ // XOR/color data
+ for (y = h-1; y >= 0; y--) {
+ for (x = 0; x < w; x++) {
+ //if ((x === hx) || (y === (h-hy-1))) {
+ if ((x === hx) || (y === hy)) {
+ arr.push(0xe0); // blue
+ arr.push(0x00); // green
+ arr.push(0x00); // red
+ arr.push(0xff); // alpha
+ } else {
+ arr.push(0x05); // blue
+ arr.push(0xe6); // green
+ arr.push(0x00); // red
+ arr.push(0x80); // alpha
+ }
+ }
+ }
+
+ // AND/bitmask data (seems to be ignored)
+ for (y = 0; y < h; y++) {
+ for (x = 0; x < Math.ceil(w / 8); x++) {
+ arr.push(0x00);
+ }
+ }
+
+ debug("cursor generated");
+ return arr;
+ }
+
+ window.onload = function() {
+ debug("onload");
+ var canvas, cross, cursor, cursor64;
+
+ canvas = new Canvas({'target' : $D("testcanvas")});
+ debug("canvas indicates Data URI cursor support is: " + canvas.get_cursor_uri());
+
+ $D('button1').style.cursor="url(face.png), default";
+
+ cursor = makeCursor();
+ cursor64 = Base64.encode(cursor);
+ //debug("cursor: " + cursor.slice(0,100) + " (" + cursor.length + ")");
+ //debug("cursor64: " + cursor64.slice(0,100) + " (" + cursor64.length + ")");
+ $D('button2').style.cursor="url(data:image/x-icon;base64," + cursor64 + "), default";
+
+ debug("onload complete");
+ }
+ </script>

diff --git a/noVNC/tests/face.png b/noVNC/tests/face.png
new file mode 100644
index 0000000..74c30d8
Binary files /dev/null and b/noVNC/tests/face.png differ

diff --git a/noVNC/tests/face.png.js b/noVNC/tests/face.png.js
new file mode 100644
index 0000000..e0b5d6c
--- /dev/null
+++ b/noVNC/tests/face.png.js
@@ -0,0 +1 @@
+var face64 = 'iVBORw0KGgoAAAANSUhEUgAAACMAAAAjCAIAAACRuyQOAAAAA3NCSVQICAjb4U/gAAAAGXRFWHRTb2Z0d2FyZQBnbm9tZS1zY3JlZW5zaG907wO/PgAACJJJREFUSIm1lltsXMUdxr8558zZq9d3OxebJDYhJLhNIAmUWyFKIBUtVaGqSgtUlIJKeahoEahgIZU+VC0oQiVVC60obckDgVIp3KRCQkmhhIhA4oY4wjg2ufmS9drec/bc5vbvw9prJwq85dP/YWfP7Pfb/8w3s8v6339l2fkrbMvGuZQ2mkUTA0bpc4qpyjrX3dTkAATQ5z0WUrqcAwjL/eXirmBqj0yKSTTBwNxMM0+15JuurG/dlClcOH/yWcVEaVBKUR3Eidizr2946Nhr/9q5b//BsudZzDLG5DK4sDt3443XrFm34bkX9x4ZPimkWNBa/+MfrB84+O7rbxz4+JPQD8liljY6n8t9uWfld2/++vp1F3ct6cikU2eSnvr7P7e99OqC9vaTJ0ccMtl8loyJ4igKwzAIK0GglersWv7sM08VCrk4joY/O/rLXz3mTYzmcnnXdZXWcRzHURwEQRCEHUuXdS/vnp4qP/CT2zdvuAKAQwCB4kRse+m1LY//Wojkscd/57opKUQUJ8wyzFaOq7OGGGPcdZ/f/sKbu3YT0YZrr3JT7pq1l3qeH4SBqgRETBljDKXSqXyh/i9PP/W/Q31btz59zVXrUpxb1dYsixUK+c7Fi59/YUdz2yInnbXcLHfTtpu23ZRlu4ZZiRBTp8Z37HjlhW1/evnFZ9/a+VZdLsecFOMpx83ydJan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z/7/nzHOOThcImPoNBIIAMNpJMtiNcBZDZ3PfVIjgtkWsy3riyZ9AaFGMlozhuqCnDsxxv4PC7uS+QV5eeoAAAAASUVORK5CYII=';

diff --git a/noVNC/tests/input.html b/noVNC/tests/input.html
new file mode 100644
index 0000000..248d24e
--- /dev/null
+++ b/noVNC/tests/input.html
@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<html>
+ <head><title>Input Test</title></head>
+ <body>
+ <br><br>
+
+ Canvas:
+ <span id="button-selection" style="display: none;">
+ <input id="button1" type="button" value="L"><input id="button2" type="button" value="M"><input id="button4" type="button" value="R">
+ </span>
+ <br>
+ <canvas id="canvas" width="640" height="20"
+ style="border-style: dotted; border-width: 1px;">
+ Canvas not supported.
+ </canvas>
+
+ <br>
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=25></textarea>
+ </body>
+
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="../include/base64.js"></script>
+ <script src="../include/input.js"></script>
+ <script src="../include/display.js"></script>
+ <script>
+ var msg_cnt = 0, iterations,
+ width = 400, height = 200,
+ canvas, keyboard, mouse;
+
+ var newline = "\n";
+ if (Util.Engine.trident) {
+ var newline = "<br>\n";
+ }
+
+ function message(str) {
+ console.log(str);
+ cell = $D('messages');
+ cell.innerHTML += msg_cnt + ": " + str + newline;
+ cell.scrollTop = cell.scrollHeight;
+ msg_cnt++;
+ }
+
+ function mouseButton(x, y, down, bmask) {
+ msg = 'mouse x,y: ' + x + ',' + y + ' down: ' + down;
+ msg += ' bmask: ' + bmask;
+ message(msg);
+ }
+
+ function mouseMove(x, y) {
+ msg = 'mouse x,y: ' + x + ',' + y;
+ //console.log(msg);
+ }
+
+ function keyPress(keysym, down, e) {
+ var d = down ? "down" : " up ";
+ msg = "keyPress " + d + " keysym: " + keysym +
+ " (key: " + e.keyCode + ", char: " + e.charCode +
+ ", which: " + e.which +")";
+ message(msg);
+ }
+
+ function selectButton(num) {
+ var b, blist = [1,2,4];
+
+ if (typeof num === 'undefined') {
+ // Show the default
+ num = mouse.get_touchButton();
+ } else if (num === mouse.get_touchButton()) {
+ // Set all buttons off (no clicks)
+ mouse.set_touchButton(0);
+ num = 0;
+ } else {
+ // Turn on one button
+ mouse.set_touchButton(num);
+ }
+
+ for (b = 0; b < blist.length; b++) {
+ if (blist[b] === num) {
+ $D('button' + blist[b]).style.backgroundColor = "black";
+ $D('button' + blist[b]).style.color = "lightgray";
+ } else {
+ $D('button' + blist[b]).style.backgroundColor = "";
+ $D('button' + blist[b]).style.color = "";
+ }
+ }
+ }
+
+ window.onload = function() {
+ canvas = new Display({'target' : $D('canvas')});
+ keyboard = new Keyboard({'target': document,
+ 'onKeyPress': keyPress});
+ mouse = new Mouse({'target': $D('canvas'),
+ 'onMouseButton': mouseButton,
+ 'onMouseMove': mouseMove});
+
+ canvas.resize(width, height, true);
+ keyboard.grab();
+ mouse.grab();
+ message("Display initialized");
+
+ if ('ontouchstart' in document.documentElement) {
+ message("Touch device detected");
+ $D('button-selection').style.display = "inline";
+ $D('button1').onclick = function(){ selectButton(1) };
+ $D('button2').onclick = function(){ selectButton(2) };
+ $D('button4').onclick = function(){ selectButton(4) };
+ selectButton();
+ }
+
+ }
+ </script>
+</html>

diff --git a/noVNC/tests/stats.js b/noVNC/tests/stats.js
new file mode 100644
index 0000000..cd3011c
--- /dev/null
+++ b/noVNC/tests/stats.js
@@ -0,0 +1,53 @@
+/*
+ * Define some useful statistical functions on arrays of numbers
+ */
+
+Array.prototype.sum = function() {
+ var i, sum = 0;
+ for (i = 0; i < this.length; i++) {
+ sum += this[i];
+ }
+ return sum;
+}
+
+Array.prototype.max = function() {
+ return Math.max.apply(null, this);
+}
+
+Array.prototype.min = function() {
+ return Math.min.apply(null, this);
+}
+
+Array.prototype.mean = function() {
+ return this.sum() / this.length;
+}
+Array.prototype.average = Array.prototype.mean;
+
+Array.prototype.median = function() {
+ var sorted = this.sort( function(a,b) { return a-b; }),
+ len = sorted.length;
+ if (len % 2) {
+ return sorted[Math.floor(len / 2)]; // Odd
+ } else {
+ return (sorted[len/2 - 1] + sorted[len/2]) / 2; // Even
+ }
+}
+
+Array.prototype.stdDev = function(sample) {
+ var i, sumSqr = 0, mean = this.mean(), N;
+
+ if (sample) {
+ // Population correction if this is a sample
+ N = this.length - 1;
+ } else {
+ // Standard deviation of just the array
+ N = this.length;
+ }
+
+ for (i = 0; i < this.length; i++) {
+ sumSqr += Math.pow(this[i] - mean, 2);
+ }
+
+ return Math.sqrt(sumSqr / N);
+}
+

diff --git a/noVNC/tests/viewport.css b/noVNC/tests/viewport.css
new file mode 100644
index 0000000..86f65ff
--- /dev/null
+++ b/noVNC/tests/viewport.css
@@ -0,0 +1,43 @@
+html,body {
+ margin: 0px;
+ padding: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.flex-layout {
+ width: 100%;
+ height: 100%;
+
+ display: box;
+ display: -webkit-box;
+ display: -moz-box;
+ display: -ms-box;
+
+ box-orient: vertical;
+ -webkit-box-orient: vertical;
+ -moz-box-orient: vertical;
+ -ms-box-orient: vertical;
+
+ box-align: stretch;
+ -webkit-box-align: stretch;
+ -moz-box-align: stretch;
+ -ms-box-align: stretch;
+}
+.flex-box {
+ box-flex: 1;
+ -webkit-box-flex: 1;
+ -moz-box-flex: 1;
+ -ms-box-flex: 1;
+}
+
+.container {
+ margin: 0px;
+ padding: 0px;
+}
+
+.canvas {
+ position: absolute;
+ border-style: dotted;
+ border-width: 1px;
+}

diff --git a/noVNC/tests/viewport.html b/noVNC/tests/viewport.html
new file mode 100644
index 0000000..1fb0a79
--- /dev/null
+++ b/noVNC/tests/viewport.html
@@ -0,0 +1,202 @@
+<!DOCTYPE html>
+<html>
+ <head><title>Viewport Test</title>
+ <link rel="stylesheet" href="viewport.css">
+ <!--
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ -->
+ <meta name=viewport content="width=device-width, initial-scale=1.0, user-scalable=no">
+ </head>
+ <body>
+ <div class="flex-layout">
+ <div>
+ Canvas:
+ <input id="move-selector" type="button" value="Move"
+ onclick="toggleMove();">
+ <br>
+ </div>
+ <div class="container flex-box">
+ <canvas id="canvas" class="canvas">
+ Canvas not supported.
+ </canvas>
+ <br>
+ </div>
+ <div>
+ <br>
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=8></textarea>
+ </div>
+ </div>
+ </body>
+
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="../include/util.js"></script>
+ <script src="../include/webutil.js"></script>
+ <script src="../include/base64.js"></script>
+ <script src="../include/input.js"></script>
+ <script src="../include/display.js"></script>
+ <script>
+ var msg_cnt = 0, iterations,
+ penDown = false, doMove = false,
+ inMove = false, lastPos = {},
+ padW = 0, padH = 0,
+ display, ctx, keyboard, mouse;
+
+ var newline = "\n";
+ if (Util.Engine.trident) {
+ var newline = "<br>\n";
+ }
+
+ function message(str) {
+ console.log(str);
+ cell = $D('messages');
+ cell.innerHTML += msg_cnt + ": " + str + newline;
+ cell.scrollTop = cell.scrollHeight;
+ msg_cnt++;
+ }
+
+ function mouseButton(x, y, down, bmask) {
+ //msg = 'mouse x,y: ' + x + ',' + y + ' down: ' + down;
+ //msg += ' bmask: ' + bmask;
+ //message(msg);
+
+ if (doMove) {
+ if (down && !inMove) {
+ inMove = true;
+ lastPos = {'x': x, 'y': y};
+ } else if (!down && inMove) {
+ inMove = false;
+ //dirtyRedraw();
+ }
+ return;
+ }
+
+ if (down && ! penDown) {
+ penDown = true;
+ ctx.beginPath();
+ ctx.moveTo(x, y);
+ } else if (!down && penDown) {
+ penDown = false;
+ ctx.closePath();
+ }
+ }
+
+ function mouseMove(x, y) {
+ var deltaX, deltaY;
+
+ if (inMove) {
+ //deltaX = x - lastPos.x; // drag viewport
+ deltaX = lastPos.x - x; // drag frame buffer
+ //deltaY = y - lastPos.y; // drag viewport
+ deltaY = lastPos.y - y; // drag frame buffer
+ lastPos = {'x': x, 'y': y};
+
+ display.viewportChange(deltaX, deltaY);
+ return;
+ }
+
+ if (penDown) {
+ ctx.lineTo(x, y);
+ ctx.stroke();
+ }
+ }
+
+ function dirtyRedraw() {
+ if (inMove) {
+ // Wait for user to stop moving viewport
+ return;
+ }
+
+ var d = display.getCleanDirtyReset();
+
+ for (i = 0; i < d.dirtyBoxes.length; i++) {
+ //showBox(d.dirtyBoxes[i], "dirty[" + i + "]: ");
+ drawArea(d.dirtyBoxes[i]);
+ }
+ }
+
+ function drawArea(b) {
+ var data = [], pixel, x, y;
+
+ //message("draw "+b.x+","+b.y+" ("+b.w+","+b.h+")");
+
+ for (var i = 0; i < b.w; i++) {
+ x = b.x + i;
+ for (var j = 0; j < b.h; j++) {
+ y = b.y + j;
+ pixel = (j * b.w * 4 + i * 4);
+ data[pixel + 0] = ((x * y) / 13) % 256;
+ data[pixel + 1] = ((x * y) + 392) % 256;
+ data[pixel + 2] = ((x + y) + 256) % 256;
+ data[pixel + 3] = 255;
+ }
+ }
+ //message("i: " + i + ", j: " + j + ", pixel: " + pixel);
+ display.blitImage(b.x, b.y, b.w, b.h, data, 0);
+ }
+
+ function toggleMove() {
+ if (doMove) {
+ doMove = false;
+ $D('move-selector').style.backgroundColor = "";
+ $D('move-selector').style.color = "";
+ } else {
+ doMove = true;
+ $D('move-selector').style.backgroundColor = "black";
+ $D('move-selector').style.color = "lightgray";
+ }
+ }
+
+ function detectPad() {
+ var c = $D('canvas'), p = c.parentNode;
+ c.width = 10;
+ c.height = 10;
+ padW = c.offsetWidth - 10;
+ padH = c.offsetHeight - 10;
+ message("padW: " + padW + ", padH: " + padH);
+ }
+
+ function doResize() {
+ var p = $D('canvas').parentNode;
+ message("doResize1: [" + (p.offsetWidth - padW) +
+ "," + (p.offsetHeight - padH) + "]");
+ display.viewportChange(0, 0,
+ p.offsetWidth - padW, p.offsetHeight - padH);
+ /*
+ var pos, new_w, new_h;pos
+ pos = Util.getPosition($D('canvas').parentNode);
+ new_w = window.innerWidth - pos.x;
+ new_h = window.innerHeight - pos.y;
+ display.viewportChange(0, 0, new_w, new_h);
+ */
+ }
+
+ window.onload = function() {
+ detectPad();
+
+ display = new Display({'target': $D('canvas')});
+ display.resize(1600, 1024);
+ display.set_viewport(true);
+ ctx = display.get_context();
+
+ mouse = new Mouse({'target': $D('canvas'),
+ 'onMouseButton': mouseButton,
+ 'onMouseMove': mouseMove});
+ mouse.grab();
+
+
+ Util.addEvent(window, 'resize', doResize);
+ // Shrink viewport for first resize call so that the
+ // scrollbars are disabled
+ display.viewportChange(0, 0, 10, 10);
+ setTimeout(doResize, 1);
+ setInterval(dirtyRedraw, 50);
+
+ message("Display initialized");
+ };
+ </script>
+</html>

diff --git a/noVNC/tests/vnc_perf.html b/noVNC/tests/vnc_perf.html
new file mode 100644
index 0000000..eda6fd0
--- /dev/null
+++ b/noVNC/tests/vnc_perf.html
@@ -0,0 +1,203 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>VNC Performance Benchmark</title>
+ <link rel="stylesheet" href="../include/base.css">
+ </head>
+ <body>
+
+ Passes: <input id='passes' style='width:50' value=3>&nbsp;
+
+ <input id='startButton' type='button' value='Start' style='width:100px'
+ onclick="do_test();" disabled>&nbsp;
+
+ <br><br>
+
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=15></textarea>
+
+ <br><br>
+
+ <div id="VNC_screen">
+ <div id="VNC_status_bar" class="VNC_status_bar" style="margin-top: 0px;">
+ <table border=0 width=100%><tr>
+ <td><div id="VNC_status">Loading</div></td>
+ </tr></table>
+ </div>
+ <canvas id="VNC_canvas" width="640px" height="20px">
+ Canvas not supported.
+ </canvas>
+ </div>
+
+ </body>
+
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+
+ <script type="text/javascript">
+ var INCLUDE_URI= "../include/";
+ </script>
+ <script src="../include/vnc.js"></script>
+ <script src="../include/playback.js"></script>
+ <script src="../data/multi.js"></script>
+
+ <script>
+ var start_time, VNC_frame_data, pass, passes, encIdx,
+ encOrder = ['raw', 'rre', 'hextile', 'tightpng', 'copyrect'],
+ encTot = {}, encMin = {}, encMax = {},
+ passCur, passTot, passMin, passMax;
+
+ function msg(str) {
+ console.log(str);
+ var cell = $D('messages');
+ cell.innerHTML += str + "\n";
+ cell.scrollTop = cell.scrollHeight;
+ }
+ function dbgmsg(str) {
+ if (Util.get_logging() === 'debug') {
+ msg(str);
+ }
+ }
+
+ updateState = function (rfb, state, oldstate, mesg) {
+ switch (state) {
+ case 'failed':
+ case 'fatal':
+ msg("noVNC sent '" + state +
+ "' state during pass " + pass +
+ ", iteration " + iteration +
+ " frame " + frame_idx);
+ test_state = 'failed';
+ break;
+ case 'loaded':
+ $D('startButton').disabled = false;
+ break;
+ }
+ if (typeof mesg !== 'undefined') {
+ $D('VNC_status').innerHTML = mesg;
+ }
+ }
+
+ function do_test() {
+ $D('startButton').value = "Running";
+ $D('startButton').disabled = true;
+
+ mode = 'perftest'; // full-speed
+ passes = $D('passes').value;
+ pass = 1;
+ encIdx = 0;
+
+ // Render each encoding once for each pass
+ iterations = 1;
+
+ // Initialize stats counters
+ for (i = 0; i < encOrder.length; i++) {
+ enc = encOrder[i];
+ encTot[i] = 0;
+ encMin[i] = 2<<23; // Something sufficiently large
+ encMax[i] = 0;
+ }
+ passCur = 0;
+ passTot = 0;
+ passMin = 2<<23;
+ passMax = 0;
+
+ // Fire away
+ next_encoding();
+ }
+
+ function next_encoding() {
+ var encName;
+
+ if (encIdx >= encOrder.length) {
+ // Accumulate pass stats
+ if (passCur < passMin) {
+ passMin = passCur;
+ }
+ if (passCur > passMax) {
+ passMax = passCur;
+ }
+ msg("Pass " + pass + " took " + passCur + " ms");
+
+ passCur = 0;
+ encIdx = 0;
+ pass += 1;
+ if (pass > passes) {
+ // We are finished
+ // Shut-off event interception
+ rfb.get_mouse().ungrab();
+ rfb.get_keyboard().ungrab();
+ $D('startButton').disabled = false;
+ $D('startButton').value = "Start";
+ finish_passes();
+ return; // We are finished, terminate
+ }
+ }
+
+ encName = encOrder[encIdx];
+ dbgmsg("Rendering pass " + pass + " encoding '" + encName + "'");
+
+ VNC_frame_data = VNC_frame_data_multi[encName];
+ iteration = 0;
+ start_time = (new Date()).getTime();
+
+ next_iteration();
+ }
+
+ // Finished rendering current encoding
+ function finish() {
+ var total_time, end_time = (new Date()).getTime();
+ total_time = end_time - start_time;
+
+ dbgmsg("Encoding " + encOrder[encIdx] + " took " + total_time + "ms");
+
+ passCur += total_time;
+ passTot += total_time;
+
+ // Accumulate stats
+ encTot[encIdx] += total_time;
+ if (total_time < encMin[encIdx]) {
+ encMin[encIdx] = total_time;
+ }
+ if (total_time > encMax[encIdx]) {
+ encMax[encIdx] = total_time;
+ }
+
+ encIdx += 1;
+ next_encoding();
+ }
+
+ function finish_passes() {
+ var i, enc, avg, passAvg;
+ msg("STATS (for " + passes + " passes)");
+ // Encoding stats
+ for (i = 0; i < encOrder.length; i++) {
+ enc = encOrder[i];
+ avg = (encTot[i] / passes).toFixed(1);
+ msg(" " + enc + ": " + encTot[i] + " ms, " +
+ encMin[i] + "/" + avg + "/" + encMax[i] +
+ " (min/avg/max)");
+
+ }
+ // Print pass stats
+ passAvg = (passTot / passes).toFixed(1);
+ msg("\n All passes: " + passTot + " ms, " +
+ passMin + "/" + passAvg + "/" + passMax +
+ " (min/avg/max)");
+ }
+
+ window.onload = function() {
+ var i, enc;
+ dbgmsg("Frame lengths:");
+ for (i = 0; i < encOrder.length; i++) {
+ enc = encOrder[i];
+ dbgmsg(" " + enc + ": " + VNC_frame_data_multi[enc].length);
+ }
+ rfb = new RFB({'target': $D('VNC_canvas'),
+ 'updateState': updateState});
+ rfb.testMode(send_array);
+ }
+ </script>
+</html>

diff --git a/noVNC/tests/vnc_playback.html b/noVNC/tests/vnc_playback.html
new file mode 100644
index 0000000..a258a47
--- /dev/null
+++ b/noVNC/tests/vnc_playback.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>VNC Playback</title>
+ <link rel="stylesheet" href="../include/plain.css">
+ </head>
+ <body>
+
+ Iterations: <input id='iterations' style='width:50'>&nbsp;
+ Perftest:<input type='radio' id='mode1' name='mode' checked>&nbsp;
+ Realtime:<input type='radio' id='mode2' name='mode'>&nbsp;&nbsp;
+
+ <input id='startButton' type='button' value='Start' style='width:100px'
+ onclick="start();" disabled>&nbsp;
+
+ <br><br>
+
+ Results:<br>
+ <textarea id="messages" style="font-size: 9;" cols=80 rows=25></textarea>
+
+ <br><br>
+
+ <div id="VNC_screen">
+ <div id="VNC_status_bar" class="VNC_status_bar" style="margin-top: 0px;">
+ <table border=0 width=100%><tr>
+ <td><div id="VNC_status">Loading</div></td>
+ </tr></table>
+ </div>
+ <canvas id="VNC_canvas" width="640px" height="20px">
+ Canvas not supported.
+ </canvas>
+ </div>
+
+ </body>
+
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+
+ <script type="text/javascript">
+ var INCLUDE_URI= "../include/";
+ </script>
+ <script src="../include/vnc.js"></script>
+ <script src="../include/playback.js"></script>
+
+ <script>
+ var fname, start_time;
+
+ function message(str) {
+ console.log(str);
+ var cell = $D('messages');
+ cell.innerHTML += str + "\n";
+ cell.scrollTop = cell.scrollHeight;
+ }
+
+ fname = WebUtil.getQueryVar('data', null);
+
+ if (fname) {
+ message("Loading " + fname);
+ document.write('<script src="' + fname + '"><\/script>');
+ } else {
+ message("Must specify data=FOO in query string.");
+ }
+
+ updateState = function (rfb, state, oldstate, msg) {
+ switch (state) {
+ case 'failed':
+ case 'fatal':
+ message("noVNC sent '" + state + "' state during iteration " + iteration + " frame " + frame_idx);
+ test_state = 'failed';
+ break;
+ case 'loaded':
+ $D('startButton').disabled = false;
+ break;
+ }
+ if (typeof msg !== 'undefined') {
+ $D('VNC_status').innerHTML = msg;
+ }
+ }
+
+ function start() {
+ $D('startButton').value = "Running";
+ $D('startButton').disabled = true;
+
+ iterations = $D('iterations').value;
+ iteration = 0;
+ start_time = (new Date()).getTime();
+
+ if ($D('mode1').checked) {
+ message("Starting performance playback (fullspeed) [" + iterations + " iteration(s)]");
+ mode = 'perftest';
+ } else {
+ message("Starting realtime playback [" + iterations + " iteration(s)]");
+ mode = 'realtime';
+ }
+
+ recv_message = rfb.testMode(send_array);
+ next_iteration();
+ }
+
+ function finish() {
+ // Finished with all iterations
+ var total_time, end_time = (new Date()).getTime();
+ total_time = end_time - start_time;
+
+ iter_time = parseInt(total_time / iterations, 10);
+ message(iterations + " iterations took " + total_time + "ms, " +
+ iter_time + "ms per iteration");
+ // Shut-off event interception
+ rfb.get_mouse().ungrab();
+ rfb.get_keyboard().ungrab();
+ $D('startButton').disabled = false;
+ $D('startButton').value = "Start";
+
+ }
+
+ window.onload = function() {
+ iterations = WebUtil.getQueryVar('iterations', 3);
+ $D('iterations').value = iterations;
+ mode = WebUtil.getQueryVar('mode', 3);
+ if (mode === 'realtime') {
+ $D('mode2').checked = true;
+ } else {
+ $D('mode1').checked = true;
+ }
+ if (fname) {
+ message("VNC_frame_data.length: " + VNC_frame_data.length);
+ rfb = new RFB({'target': $D('VNC_canvas'),
+ 'updateState': updateState});
+ }
+ }
+ </script>
+</html>

diff --git a/noVNC/utils/Makefile b/noVNC/utils/Makefile
new file mode 100644
index 0000000..7dc1bc4
--- /dev/null
+++ b/noVNC/utils/Makefile
@@ -0,0 +1,11 @@
+TARGETS=rebind.so
+CFLAGS += -fPIC
+
+all: $(TARGETS)
+
+rebind.so: rebind.o
+ $(CC) $(LDFLAGS) $^ -shared -fPIC -ldl -o $@
+
+clean:
+ rm -f rebind.o rebind.so
+

diff --git a/noVNC/utils/README.md b/noVNC/utils/README.md
new file mode 100644
index 0000000..0abbd0d
--- /dev/null
+++ b/noVNC/utils/README.md
@@ -0,0 +1,11 @@
+## WebSockets Proxy
+
+wsproxy has become [websockify](https://github.com/kanaka/websockify).
+A copy of the python version of websockify (named wsproxy.py) is kept
+here for ease of use. The other versions of websockify (C, Node.js)
+and the associated test programs have been moved to
+[websockify](https://github.com/kanaka/websockify).
+
+For more detailed description and usage information please refer to
+the [websockify README](https://github.com/kanaka/websockify/blob/master/README.md).
+

diff --git a/noVNC/utils/img2js.py b/noVNC/utils/img2js.py
new file mode 100644
index 0000000..3ba4598
--- /dev/null
+++ b/noVNC/utils/img2js.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+#
+# Convert image to Javascript compatible base64 Data URI
+# Copyright 2011 Joel Martin
+# Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
+#
+
+import sys, base64
+
+try:
+ from PIL import Image
+except:
+ print "python PIL module required (python-imaging package)"
+ sys.exit(1)
+
+
+if len(sys.argv) < 3:
+ print "Usage: %s IMAGE JS_VARIABLE" % sys.argv[0]
+ sys.exit(1)
+
+fname = sys.argv[1]
+var = sys.argv[2]
+
+ext = fname.lower().split('.')[-1]
+if ext == "png": mime = "image/png"
+elif ext in ["jpg", "jpeg"]: mime = "image/jpeg"
+elif ext == "gif": mime = "image/gif"
+else:
+ print "Only PNG, JPEG and GIF images are supported"
+ sys.exit(1)
+uri = "data:%s;base64," % mime
+
+im = Image.open(fname)
+w, h = im.size
+
+raw = open(fname).read()
+
+print '%s = {"width": %s, "height": %s, "data": "%s%s"};' % (
+ var, w, h, uri, base64.b64encode(raw))

diff --git a/noVNC/utils/json2graph.py b/noVNC/utils/json2graph.py
new file mode 100644
index 0000000..0f6a7ad
--- /dev/null
+++ b/noVNC/utils/json2graph.py
@@ -0,0 +1,206 @@
+#!/usr/bin/env python
+
+'''
+Use matplotlib to generate performance charts
+Copyright 2011 Joel Martin
+Licensed under GPL version 3 (see docs/LICENSE.GPL-3)
+'''
+
+# a bar plot with errorbars
+import sys, json, pprint
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.font_manager import FontProperties
+
+def usage():
+ print "%s json_file level1 level2 level3 [legend_height]\n\n" % sys.argv[0]
+ print "Description:\n"
+ print "level1, level2, and level3 are one each of the following:\n";
+ print " select=ITEM - select only ITEM at this level";
+ print " bar - each item on this level becomes a graph bar";
+ print " group - items on this level become groups of bars";
+ print "\n";
+ print "json_file is a file containing json data in the following format:\n"
+ print ' {';
+ print ' "conf": {';
+ print ' "order_l1": [';
+ print ' "level1_label1",';
+ print ' "level1_label2",';
+ print ' ...';
+ print ' ],';
+ print ' "order_l2": [';
+ print ' "level2_label1",';
+ print ' "level2_label2",';
+ print ' ...';
+ print ' ],';
+ print ' "order_l3": [';
+ print ' "level3_label1",';
+ print ' "level3_label2",';
+ print ' ...';
+ print ' ]';
+ print ' },';
+ print ' "stats": {';
+ print ' "level1_label1": {';
+ print ' "level2_label1": {';
+ print ' "level3_label1": [val1, val2, val3],';
+ print ' "level3_label2": [val1, val2, val3],';
+ print ' ...';
+ print ' },';
+ print ' "level2_label2": {';
+ print ' ...';
+ print ' },';
+ print ' },';
+ print ' "level1_label2": {';
+ print ' ...';
+ print ' },';
+ print ' ...';
+ print ' },';
+ print ' }';
+ sys.exit(2)
+
+def error(msg):
+ print msg
+ sys.exit(1)
+
+
+#colors = ['#ff0000', '#0863e9', '#00f200', '#ffa100',
+# '#800000', '#805100', '#013075', '#007900']
+colors = ['#ff0000', '#00ff00', '#0000ff',
+ '#dddd00', '#dd00dd', '#00dddd',
+ '#dd6622', '#dd2266', '#66dd22',
+ '#8844dd', '#44dd88', '#4488dd']
+
+if len(sys.argv) < 5:
+ usage()
+
+filename = sys.argv[1]
+L1 = sys.argv[2]
+L2 = sys.argv[3]
+L3 = sys.argv[4]
+if len(sys.argv) > 5:
+ legendHeight = float(sys.argv[5])
+else:
+ legendHeight = 0.75
+
+# Load the JSON data from the file
+data = json.loads(file(filename).read())
+conf = data['conf']
+stats = data['stats']
+
+# Sanity check data hierarchy
+if len(conf['order_l1']) != len(stats.keys()):
+ error("conf.order_l1 does not match stats level 1")
+for l1 in stats.keys():
+ if len(conf['order_l2']) != len(stats[l1].keys()):
+ error("conf.order_l2 does not match stats level 2 for %s" % l1)
+ if conf['order_l1'].count(l1) < 1:
+ error("%s not found in conf.order_l1" % l1)
+ for l2 in stats[l1].keys():
+ if len(conf['order_l3']) != len(stats[l1][l2].keys()):
+ error("conf.order_l3 does not match stats level 3")
+ if conf['order_l2'].count(l2) < 1:
+ error("%s not found in conf.order_l2" % l2)
+ for l3 in stats[l1][l2].keys():
+ if conf['order_l3'].count(l3) < 1:
+ error("%s not found in conf.order_l3" % l3)
+
+#
+# Generate the data based on the level specifications
+#
+bar_labels = None
+group_labels = None
+bar_vals = []
+bar_sdvs = []
+if L3.startswith("select="):
+ select_label = l3 = L3.split("=")[1]
+ bar_labels = conf['order_l1']
+ group_labels = conf['order_l2']
+ bar_vals = [[0]*len(group_labels) for i in bar_labels]
+ bar_sdvs = [[0]*len(group_labels) for i in bar_labels]
+ for b in range(len(bar_labels)):
+ l1 = bar_labels[b]
+ for g in range(len(group_labels)):
+ l2 = group_labels[g]
+ bar_vals[b][g] = np.mean(stats[l1][l2][l3])
+ bar_sdvs[b][g] = np.std(stats[l1][l2][l3])
+elif L2.startswith("select="):
+ select_label = l2 = L2.split("=")[1]
+ bar_labels = conf['order_l1']
+ group_labels = conf['order_l3']
+ bar_vals = [[0]*len(group_labels) for i in bar_labels]
+ bar_sdvs = [[0]*len(group_labels) for i in bar_labels]
+ for b in range(len(bar_labels)):
+ l1 = bar_labels[b]
+ for g in range(len(group_labels)):
+ l3 = group_labels[g]
+ bar_vals[b][g] = np.mean(stats[l1][l2][l3])
+ bar_sdvs[b][g] = np.std(stats[l1][l2][l3])
+elif L1.startswith("select="):
+ select_label = l1 = L1.split("=")[1]
+ bar_labels = conf['order_l2']
+ group_labels = conf['order_l3']
+ bar_vals = [[0]*len(group_labels) for i in bar_labels]
+ bar_sdvs = [[0]*len(group_labels) for i in bar_labels]
+ for b in range(len(bar_labels)):
+ l2 = bar_labels[b]
+ for g in range(len(group_labels)):
+ l3 = group_labels[g]
+ bar_vals[b][g] = np.mean(stats[l1][l2][l3])
+ bar_sdvs[b][g] = np.std(stats[l1][l2][l3])
+else:
+ usage()
+
+# If group is before bar then flip (zip) the data
+if [L1, L2, L3].index("group") < [L1, L2, L3].index("bar"):
+ bar_labels, group_labels = group_labels, bar_labels
+ bar_vals = zip(*bar_vals)
+ bar_sdvs = zip(*bar_sdvs)
+
+print "bar_vals:", bar_vals
+
+#
+# Now render the bar graph
+#
+ind = np.arange(len(group_labels)) # the x locations for the groups
+width = 0.8 * (1.0/len(bar_labels)) # the width of the bars
+
+fig = plt.figure(figsize=(10,6), dpi=80)
+plot = fig.add_subplot(1, 1, 1)
+
+rects = []
+for i in range(len(bar_vals)):
+ rects.append(plot.bar(ind+width*i, bar_vals[i], width, color=colors[i],
+ yerr=bar_sdvs[i], align='center'))
+
+# add some
+plot.set_ylabel('Milliseconds (less is better)')
+plot.set_title("Javascript array test: %s" % select_label)
+plot.set_xticks(ind+width)
+plot.set_xticklabels( group_labels )
+
+fontP = FontProperties()
+fontP.set_size('small')
+plot.legend( [r[0] for r in rects], bar_labels, prop=fontP,
+ loc = 'center right', bbox_to_anchor = (1.0, legendHeight))
+
+def autolabel(rects):
+ # attach some text labels
+ for rect in rects:
+ height = rect.get_height()
+ if np.isnan(height):
+ height = 0.0
+ plot.text(rect.get_x()+rect.get_width()/2., height+20, '%d'%int(height),
+ ha='center', va='bottom', size='7')
+
+for rect in rects:
+ autolabel(rect)
+
+# Adjust axis sizes
+axis = list(plot.axis())
+axis[0] = -width # Make sure left side has enough for bar
+#axis[1] = axis[1] * 1.20 # Add 20% to the right to make sure it fits
+axis[2] = 0 # Make y-axis start at 0
+axis[3] = axis[3] * 1.10 # Add 10% to the top
+plot.axis(axis)
+
+plt.show()

diff --git a/noVNC/utils/launch.sh b/noVNC/utils/launch.sh
new file mode 100644
index 0000000..26a3532
--- /dev/null
+++ b/noVNC/utils/launch.sh
@@ -0,0 +1,108 @@
+#!/usr/bin/env bash
+
+usage() {
+ if [ "$*" ]; then
+ echo "$*"
+ echo
+ fi
+ echo "Usage: ${NAME} [--listen PORT] [--vnc VNC_HOST:PORT] [--cert CERT]"
+ echo
+ echo "Starts the WebSockets proxy and a mini-webserver and "
+ echo "provides a cut-and-paste URL to go to."
+ echo
+ echo " --listen PORT Port for proxy/webserver to listen on"
+ echo " Default: 6080"
+ echo " --vnc VNC_HOST:PORT VNC server host:port proxy target"
+ echo " Default: localhost:5900"
+ echo " --cert CERT Path to combined cert/key file"
+ echo " Default: self.pem"
+ exit 2
+}
+
+NAME="$(basename $0)"
+HERE="$(cd "$(dirname "$0")" && pwd)"
+PORT="6080"
+VNC_DEST="localhost:5900"
+CERT=""
+proxy_pid=""
+
+die() {
+ echo "$*"
+ exit 1
+}
+
+cleanup() {
+ trap - TERM QUIT INT EXIT
+ trap "true" CHLD # Ignore cleanup messages
+ echo
+ if [ -n "${proxy_pid}" ]; then
+ echo "Terminating WebSockets proxy (${proxy_pid})"
+ kill ${proxy_pid}
+ fi
+}
+
+# Process Arguments
+
+# Arguments that only apply to chrooter itself
+while [ "$*" ]; do
+ param=$1; shift; OPTARG=$1
+ case $param in
+ --listen) PORT="${OPTARG}"; shift ;;
+ --vnc) VNC_DEST="${OPTARG}"; shift ;;
+ --cert) CERT="${OPTARG}"; shift ;;
+ -h|--help) usage ;;
+ -*) usage "Unknown chrooter option: ${param}" ;;
+ *) break ;;
+ esac
+done
+
+# Sanity checks
+which netstat >/dev/null 2>&1 \
+ || die "Must have netstat installed"
+
+netstat -ltn | grep -qs "${PORT} .*LISTEN" \
+ && die "Port ${PORT} in use. Try --listen PORT"
+
+trap "cleanup" TERM QUIT INT EXIT
+
+# Find vnc.html
+if [ -e "$(pwd)/vnc.html" ]; then
+ WEB=$(pwd)
+elif [ -e "${HERE}/../vnc.html" ]; then
+ WEB=${HERE}/../
+elif [ -e "${HERE}/vnc.html" ]; then
+ WEB=${HERE}
+else
+ die "Could not find vnc.html"
+fi
+
+# Find self.pem
+if [ -n "${CERT}" ]; then
+ if [ ! -e "${CERT}" ]; then
+ die "Could not find ${CERT}"
+ fi
+elif [ -e "$(pwd)/self.pem" ]; then
+ CERT="$(pwd)/self.pem"
+elif [ -e "${HERE}/../self.pem" ]; then
+ CERT="${HERE}/../self.pem"
+elif [ -e "${HERE}/self.pem" ]; then
+ CERT="${HERE}/self.pem"
+else
+ echo "Warning: could not find self.pem"
+fi
+
+echo "Starting webserver and WebSockets proxy on port ${PORT}"
+${HERE}/wsproxy.py --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
+proxy_pid="$!"
+sleep 1
+if ! ps -p ${proxy_pid} >/dev/null; then
+ proxy_pid=
+ echo "Failed to start WebSockets proxy"
+ exit 1
+fi
+
+echo -e "\n\nNavigate to this URL:\n"
+echo -e " http://$(hostname):${PORT}/vnc.html?host=$(hostname)&port=${PORT}\n"
+echo -e "Press Ctrl-C to exit\n\n"
+
+wait ${proxy_pid}

diff --git a/noVNC/utils/nova-novncproxy b/noVNC/utils/nova-novncproxy
new file mode 100644
index 0000000..c1cc4d3
--- /dev/null
+++ b/noVNC/utils/nova-novncproxy
@@ -0,0 +1,152 @@
+#!/usr/bin/env python
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright (c) 2012 Openstack, LLC.
+# All Rights Reserved.
+#
+# 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.
+#!/usr/bin/env python
+
+'''
+Websocket proxy that is compatible with Openstack Nova.
+Leverages wsproxy.py by Joel Martin
+'''
+
+import Cookie
+import socket
+import sys
+
+import wsproxy
+
+from nova import context
+from nova import flags
+from nova import utils
+from nova.openstack.common import cfg
+from nova.openstack.common import rpc
+
+
+opts = [
+ cfg.BoolOpt('record',
+ default=False,
+ help='Record sessions to FILE.[session_number]'),
+ cfg.BoolOpt('daemon',
+ default=False,
+ help='Become a daemon (background process)'),
+ cfg.BoolOpt('ssl_only',
+ default=False,
+ help='Disallow non-encrypted connections'),
+ cfg.BoolOpt('source_is_ipv6',
+ default=False,
+ help='Source is ipv6'),
+ cfg.StrOpt('cert',
+ default='self.pem',
+ help='SSL certificate file'),
+ cfg.StrOpt('key',
+ default=None,
+ help='SSL key file (if separate from cert)'),
+ cfg.StrOpt('web',
+ default='.',
+ help='Run webserver on same port. Serve files from DIR.'),
+ cfg.StrOpt('novncproxy_host',
+ default='0.0.0.0',
+ help='Host on which to listen for incoming requests'),
+ cfg.IntOpt('novncproxy_port',
+ default=6080,
+ help='Port on which to listen for incoming requests'),
+ ]
+FLAGS = flags.FLAGS
+FLAGS.register_cli_opts(opts)
+
+# As of nova commit 0b11668e64450039dc071a4a123abd02206f865f we must
+# manually register the rpc library
+if hasattr(rpc, 'register_opts'):
+ rpc.register_opts(FLAGS)
+
+
+class NovaWebSocketProxy(wsproxy.WebSocketProxy):
+ def __init__(self, *args, **kwargs):
+ wsproxy.WebSocketProxy.__init__(self, *args, **kwargs)
+
+ def new_client(self):
+ """
+ Called after a new WebSocket connection has been established.
+ """
+ cookie = Cookie.SimpleCookie()
+ cookie.load(self.headers.getheader('cookie'))
+ token = cookie['token'].value
+ ctxt = context.get_admin_context()
+ connect_info = rpc.call(ctxt, 'consoleauth',
+ {'method': 'check_token',
+ 'args': {'token': token}})
+
+ if not connect_info:
+ raise Exception("Invalid Token")
+
+ host = connect_info['host']
+ port = int(connect_info['port'])
+
+ # Connect to the target
+ self.msg("connecting to: %s:%s" % (
+ host, port))
+ tsock = self.socket(host, port,
+ connect=True)
+
+ # Handshake as necessary
+ if connect_info.get('internal_access_path'):
+ tsock.send("CONNECT %s HTTP/1.1\r\n\r\n" %
+ connect_info['internal_access_path'])
+ while True:
+ data = tsock.recv(4096, socket.MSG_PEEK)
+ if data.find("\r\n\r\n") != -1:
+ if not data.split("\r\n")[0].find("200"):
+ raise Exception("Invalid Connection Info")
+ tsock.recv(len(data))
+ break
+
+ if self.verbose and not self.daemon:
+ print(self.traffic_legend)
+
+ # Start proxying
+ try:
+ self.do_proxy(tsock)
+ except:
+ if tsock:
+ tsock.shutdown(socket.SHUT_RDWR)
+ tsock.close()
+ self.vmsg("%s:%s: Target closed" % (host, port))
+ raise
+
+
+if __name__ == '__main__':
+ if FLAGS.ssl_only and not os.path.exists(FLAGS.cert):
+ parser.error("SSL only and %s not found" % FLAGS.cert)
+
+ # Setup flags
+ flags.parse_args(sys.argv)
+
+ # Create and start the NovaWebSockets proxy
+ server = NovaWebSocketProxy(listen_host=FLAGS.novncproxy_host,
+ listen_port=FLAGS.novncproxy_port,
+ source_is_ipv6=FLAGS.source_is_ipv6,
+ verbose=FLAGS.verbose,
+ cert=FLAGS.cert,
+ key=FLAGS.key,
+ ssl_only=FLAGS.ssl_only,
+ daemon=FLAGS.daemon,
+ record=FLAGS.record,
+ web=FLAGS.web,
+ target_host='ignore',
+ target_port='ignore',
+ wrap_mode='exit',
+ wrap_cmd=None)
+ server.start_server()

diff --git a/noVNC/utils/rebind b/noVNC/utils/rebind
new file mode 100644
index 0000000..2289aaa
--- /dev/null
+++ b/noVNC/utils/rebind
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+usage() {
+ echo "Usage: $(basename $0) OLD_PORT NEW_PORT COMMAND_LINE"
+ echo
+ echo "Launch COMMAND_LINE, but intercept system calls to bind"
+ echo "to OLD_PORT and instead bind them to localhost:NEW_PORT"
+ exit 2
+}
+
+# Parameter defaults
+mydir=$(readlink -f $(dirname ${0}))
+
+export REBIND_PORT_OLD="${1}"; shift
+export REBIND_PORT_NEW="${1}"; shift
+
+LD_PRELOAD=${mydir}/rebind.so "${@}"
+

diff --git a/noVNC/utils/rebind.c b/noVNC/utils/rebind.c
new file mode 100644
index 0000000..c7e83de
--- /dev/null
+++ b/noVNC/utils/rebind.c
@@ -0,0 +1,94 @@
+/*
+ * rebind: Intercept bind calls and bind to a different port
+ * Copyright 2010 Joel Martin
+ * Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
+ *
+ * Overload (LD_PRELOAD) bind system call. If REBIND_PORT_OLD and
+ * REBIND_PORT_NEW environment variables are set then bind on the new
+ * port (of localhost) instead of the old port.
+ *
+ * This allows a proxy (such as wsproxy) to run on the old port and translate
+ * traffic to/from the new port.
+ *
+ * Usage:
+ * LD_PRELOAD=./rebind.so \
+ * REBIND_PORT_OLD=23 \
+ * REBIND_PORT_NEW=2023 \
+ * program
+ */
+
+//#define DO_DEBUG 1
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define __USE_GNU 1 // Pull in RTLD_NEXT
+#include <dlfcn.h>
+
+#include <string.h>
+#include <netinet/in.h>
+
+
+#if defined(DO_DEBUG)
+#define DEBUG(...) \
+ fprintf(stderr, "wswrapper: "); \
+ fprintf(stderr, __VA_ARGS__);
+#else
+#define DEBUG(...)
+#endif
+
+
+int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
+{
+ static void * (*func)();
+ int do_move = 0;
+ struct sockaddr_in * addr_in = (struct sockaddr_in *)addr;
+ struct sockaddr_in addr_tmp;
+ socklen_t addrlen_tmp;
+ char * PORT_OLD, * PORT_NEW, * end1, * end2;
+ int ret, oldport, newport, askport = htons(addr_in->sin_port);
+ uint32_t askaddr = htons(addr_in->sin_addr.s_addr);
+ if (!func) func = (void *(*)()) dlsym(RTLD_NEXT, "bind");
+
+ DEBUG(">> bind(%d, _, %d), askaddr %d, askport %d\n",
+ sockfd, addrlen, askaddr, askport);
+
+ /* Determine if we should move this socket */
+ if (addr_in->sin_family == AF_INET) {
+ // TODO: support IPv6
+ PORT_OLD = getenv("REBIND_OLD_PORT");
+ PORT_NEW = getenv("REBIND_NEW_PORT");
+ if (PORT_OLD && (*PORT_OLD != '\0') &&
+ PORT_NEW && (*PORT_NEW != '\0')) {
+ oldport = strtol(PORT_OLD, &end1, 10);
+ newport = strtol(PORT_NEW, &end2, 10);
+ if (oldport && (*end1 == '\0') &&
+ newport && (*end2 == '\0') &&
+ (oldport == askport)) {
+ do_move = 1;
+ }
+ }
+ }
+
+ if (! do_move) {
+ /* Just pass everything right through to the real bind */
+ ret = (int) func(sockfd, addr, addrlen);
+ DEBUG("<< bind(%d, _, %d) ret %d\n", sockfd, addrlen, ret);
+ return ret;
+ }
+
+ DEBUG("binding fd %d on localhost:%d instead of 0x%x:%d\n",
+ sockfd, newport, ntohl(addr_in->sin_addr.s_addr), oldport);
+
+ /* Use a temporary location for the new address information */
+ addrlen_tmp = sizeof(addr_tmp);
+ memcpy(&addr_tmp, addr, addrlen_tmp);
+
+ /* Bind to other port on the loopback instead */
+ addr_tmp.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+ addr_tmp.sin_port = htons(newport);
+ ret = (int) func(sockfd, &addr_tmp, addrlen_tmp);
+
+ DEBUG("<< bind(%d, _, %d) ret %d\n", sockfd, addrlen, ret);
+ return ret;
+}

diff --git a/noVNC/utils/u2x11 b/noVNC/utils/u2x11
new file mode 100644
index 0000000..fd3e4ba
--- /dev/null
+++ b/noVNC/utils/u2x11
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash
+#
+# Convert "U+..." commented entries in /usr/include/X11/keysymdef.h
+# into JavaScript for use by noVNC. Note this is likely to produce
+# a few duplicate properties with clashing values, that will need
+# resolving manually.
+#
+# Colin Dean <co...@xvpsource.org>
+#
+
+regex="^#define[ \t]+XK_[A-Za-z0-9_]+[ \t]+0x([0-9a-fA-F]+)[ \t]+\/\*[ \t]+U\+([0-9a-fA-F]+)[ \t]+[^*]+.[ \t]+\*\/[ \t]*$"
+echo "unicodeTable = {"
+while read line; do
+ if echo "${line}" | egrep -qs "${regex}"; then
+
+ x11=$(echo "${line}" | sed -r "s/${regex}/\1/")
+ vnc=$(echo "${line}" | sed -r "s/${regex}/\2/")
+
+ if echo "${vnc}" | egrep -qs "^00[2-9A-F][0-9A-F]$"; then
+ : # skip ISO Latin-1 (U+0020 to U+00FF) as 1-to-1 mapping
+ else
+ # note 1-to-1 is possible (e.g. for Euro symbol, U+20AC)
+ echo " 0x${vnc} : 0x${x11},"
+ fi
+ fi
+done < /usr/include/X11/keysymdef.h | uniq
+echo "};"
+

diff --git a/noVNC/utils/web.py b/noVNC/utils/web.py
new file mode 100644
index 0000000..23afca0
--- /dev/null
+++ b/noVNC/utils/web.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+'''
+A super simple HTTP/HTTPS webserver for python. Automatically detect
+
+You can make a cert/key with openssl using:
+openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem
+as taken from http://docs.python.org/dev/library/ssl.html#certificates
+
+'''
+
+import traceback, sys
+import socket
+import ssl
+#import http.server as server # python 3.X
+import SimpleHTTPServer as server # python 2.X
+
+def do_request(connstream, from_addr):
+ x = object()
+ server.SimpleHTTPRequestHandler(connstream, from_addr, x)
+ connstream.close()
+
+def serve():
+ bindsocket = socket.socket()
+ bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ #bindsocket.bind(('localhost', PORT))
+ bindsocket.bind(('', PORT))
+ bindsocket.listen(5)
+
+ print("serving on port", PORT)
+
+ while True:
+ try:
+ newsocket, from_addr = bindsocket.accept()
+ peek = newsocket.recv(1024, socket.MSG_PEEK)
+ if peek.startswith("\x16"):
+ connstream = ssl.wrap_socket(
+ newsocket,
+ server_side=True,
+ certfile='self.pem',
+ ssl_version=ssl.PROTOCOL_TLSv1)
+ else:
+ connstream = newsocket
+
+ do_request(connstream, from_addr)
+
+ except Exception:
+ traceback.print_exc()
+
+try:
+ PORT = int(sys.argv[1])
+except:
+ print "%s port" % sys.argv[0]
+ sys.exit(2)
+
+serve()

diff --git a/noVNC/utils/websocket.py b/noVNC/utils/websocket.py
new file mode 100644
index 0000000..d3bb48c
--- /dev/null
+++ b/noVNC/utils/websocket.py
@@ -0,0 +1,930 @@
+#!/usr/bin/env python
+
+'''
+Python WebSocket library with support for "wss://" encryption.
+Copyright 2011 Joel Martin
+Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
+
+Supports following protocol versions:
+ - http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75
+ - http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
+ - http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10
+
+You can make a cert/key with openssl using:
+openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem
+as taken from http://docs.python.org/dev/library/ssl.html#certificates
+
+'''
+
+import os, sys, time, errno, signal, socket, traceback, select
+import array, struct
+from cgi import parse_qsl
+from base64 import b64encode, b64decode
+
+# Imports that vary by python version
+
+# python 3.0 differences
+if sys.hexversion > 0x3000000:
+ b2s = lambda buf: buf.decode('latin_1')
+ s2b = lambda s: s.encode('latin_1')
+ s2a = lambda s: s
+else:
+ b2s = lambda buf: buf # No-op
+ s2b = lambda s: s # No-op
+ s2a = lambda s: [ord(c) for c in s]
+try: from io import StringIO
+except: from cStringIO import StringIO
+try: from http.server import SimpleHTTPRequestHandler
+except: from SimpleHTTPServer import SimpleHTTPRequestHandler
+try: from urllib.parse import urlsplit
+except: from urlparse import urlsplit
+
+# python 2.6 differences
+try: from hashlib import md5, sha1
+except: from md5 import md5; from sha import sha as sha1
+
+# python 2.5 differences
+try:
+ from struct import pack, unpack_from
+except:
+ from struct import pack
+ def unpack_from(fmt, buf, offset=0):
+ slice = buffer(buf, offset, struct.calcsize(fmt))
+ return struct.unpack(fmt, slice)
+
+# Degraded functionality if these imports are missing
+for mod, sup in [('numpy', 'HyBi protocol'), ('ssl', 'TLS/SSL/wss'),
+ ('multiprocessing', 'Multi-Processing'),
+ ('resource', 'daemonizing')]:
+ try:
+ globals()[mod] = __import__(mod)
+ except ImportError:
+ globals()[mod] = None
+ print("WARNING: no '%s' module, %s is slower or disabled" % (
+ mod, sup))
+if multiprocessing and sys.platform == 'win32':
+ # make sockets pickle-able/inheritable
+ import multiprocessing.reduction
+
+
+class WebSocketServer(object):
+ """
+ WebSockets server class.
+ Must be sub-classed with new_client method definition.
+ """
+
+ buffer_size = 65536
+
+ server_handshake_hixie = """HTTP/1.1 101 Web Socket Protocol Handshake\r
+Upgrade: WebSocket\r
+Connection: Upgrade\r
+%sWebSocket-Origin: %s\r
+%sWebSocket-Location: %s://%s%s\r
+"""
+
+ server_handshake_hybi = """HTTP/1.1 101 Switching Protocols\r
+Upgrade: websocket\r
+Connection: Upgrade\r
+Sec-WebSocket-Accept: %s\r
+"""
+
+ GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
+
+ policy_response = """<cross-domain-policy><allow-access-from domain="*" to-ports="*" /></cross-domain-policy>\n"""
+
+ # An exception before the WebSocket connection was established
+ class EClose(Exception):
+ pass
+
+ # An exception while the WebSocket client was connected
+ class CClose(Exception):
+ pass
+
+ def __init__(self, listen_host='', listen_port=None, source_is_ipv6=False,
+ verbose=False, cert='', key='', ssl_only=None,
+ daemon=False, record='', web='',
+ run_once=False, timeout=0):
+
+ # settings
+ self.verbose = verbose
+ self.listen_host = listen_host
+ self.listen_port = listen_port
+ self.ssl_only = ssl_only
+ self.daemon = daemon
+ self.run_once = run_once
+ self.timeout = timeout
+
+ self.launch_time = time.time()
+ self.ws_connection = False
+ self.handler_id = 1
+
+ # Make paths settings absolute
+ self.cert = os.path.abspath(cert)
+ self.key = self.web = self.record = ''
+ if key:
+ self.key = os.path.abspath(key)
+ if web:
+ self.web = os.path.abspath(web)
+ if record:
+ self.record = os.path.abspath(record)
+
+ if self.web:
+ os.chdir(self.web)
+
+ # Sanity checks
+ if not ssl and self.ssl_only:
+ raise Exception("No 'ssl' module and SSL-only specified")
+ if self.daemon and not resource:
+ raise Exception("Module 'resource' required to daemonize")
+
+ # Show configuration
+ print("WebSocket server settings:")
+ print(" - Listen on %s:%s" % (
+ self.listen_host, self.listen_port))
+ print(" - Flash security policy server")
+ if self.web:
+ print(" - Web server. Web root: %s" % self.web)
+ if ssl:
+ if os.path.exists(self.cert):
+ print(" - SSL/TLS support")
+ if self.ssl_only:
+ print(" - Deny non-SSL/TLS connections")
+ else:
+ print(" - No SSL/TLS support (no cert file)")
+ else:
+ print(" - No SSL/TLS support (no 'ssl' module)")
+ if self.daemon:
+ print(" - Backgrounding (daemon)")
+ if self.record:
+ print(" - Recording to '%s.*'" % self.record)
+
+ #
+ # WebSocketServer static methods
+ #
+
+ @staticmethod
+ def socket(host, port=None, connect=False, prefer_ipv6=False):
+ """ Resolve a host (and optional port) to an IPv4 or IPv6
+ address. Create a socket. Bind to it if listen is set,
+ otherwise connect to it. Return the socket.
+ """
+ flags = 0
+ if host == '':
+ host = None
+ if connect and not port:
+ raise Exception("Connect mode requires a port")
+ if not connect:
+ flags = flags | socket.AI_PASSIVE
+ addrs = socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM,
+ socket.IPPROTO_TCP, flags)
+ if not addrs:
+ raise Exception("Could resolve host '%s'" % host)
+ addrs.sort(key=lambda x: x[0])
+ if prefer_ipv6:
+ addrs.reverse()
+ sock = socket.socket(addrs[0][0], addrs[0][1])
+ if connect:
+ sock.connect(addrs[0][4])
+ else:
+ sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ sock.bind(addrs[0][4])
+ sock.listen(100)
+ return sock
+
+ @staticmethod
+ def daemonize(keepfd=None, chdir='/'):
+ os.umask(0)
+ if chdir:
+ os.chdir(chdir)
+ else:
+ os.chdir('/')
+ os.setgid(os.getgid()) # relinquish elevations
+ os.setuid(os.getuid()) # relinquish elevations
+
+ # Double fork to daemonize
+ if os.fork() > 0: os._exit(0) # Parent exits
+ os.setsid() # Obtain new process group
+ if os.fork() > 0: os._exit(0) # Parent exits
+
+ # Signal handling
+ def terminate(a,b): os._exit(0)
+ signal.signal(signal.SIGTERM, terminate)
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+ # Close open files
+ maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
+ if maxfd == resource.RLIM_INFINITY: maxfd = 256
+ for fd in reversed(range(maxfd)):
+ try:
+ if fd != keepfd:
+ os.close(fd)
+ except OSError:
+ _, exc, _ = sys.exc_info()
+ if exc.errno != errno.EBADF: raise
+
+ # Redirect I/O to /dev/null
+ os.dup2(os.open(os.devnull, os.O_RDWR), sys.stdin.fileno())
+ os.dup2(os.open(os.devnull, os.O_RDWR), sys.stdout.fileno())
+ os.dup2(os.open(os.devnull, os.O_RDWR), sys.stderr.fileno())
+
+ @staticmethod
+ def unmask(buf, f):
+ pstart = f['hlen'] + 4
+ pend = pstart + f['length']
+ if numpy:
+ b = c = s2b('')
+ if f['length'] >= 4:
+ mask = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+ offset=f['hlen'], count=1)
+ data = numpy.frombuffer(buf, dtype=numpy.dtype('<u4'),
+ offset=pstart, count=int(f['length'] / 4))
+ #b = numpy.bitwise_xor(data, mask).data
+ b = numpy.bitwise_xor(data, mask).tostring()
+
+ if f['length'] % 4:
+ #print("Partial unmask")
+ mask = numpy.frombuffer(buf, dtype=numpy.dtype('B'),
+ offset=f['hlen'], count=(f['length'] % 4))
+ data = numpy.frombuffer(buf, dtype=numpy.dtype('B'),
+ offset=pend - (f['length'] % 4),
+ count=(f['length'] % 4))
+ c = numpy.bitwise_xor(data, mask).tostring()
+ return b + c
+ else:
+ # Slower fallback
+ data = array.array('B')
+ mask = s2a(f['mask'])
+ data.fromstring(buf[pstart:pend])
+ for i in range(len(data)):
+ data[i] ^= mask[i % 4]
+ return data.tostring()
+
+ @staticmethod
+ def encode_hybi(buf, opcode, base64=False):
+ """ Encode a HyBi style WebSocket frame.
+ Optional opcode:
+ 0x0 - continuation
+ 0x1 - text frame (base64 encode buf)
+ 0x2 - binary frame (use raw buf)
+ 0x8 - connection close
+ 0x9 - ping
+ 0xA - pong
+ """
+ if base64:
+ buf = b64encode(buf)
+
+ b1 = 0x80 | (opcode & 0x0f) # FIN + opcode
+ payload_len = len(buf)
+ if payload_len <= 125:
+ header = pack('>BB', b1, payload_len)
+ elif payload_len > 125 and payload_len < 65536:
+ header = pack('>BBH', b1, 126, payload_len)
+ elif payload_len >= 65536:
+ header = pack('>BBQ', b1, 127, payload_len)
+
+ #print("Encoded: %s" % repr(header + buf))
+
+ return header + buf, len(header), 0
+
+ @staticmethod
+ def decode_hybi(buf, base64=False):
+ """ Decode HyBi style WebSocket packets.
+ Returns:
+ {'fin' : 0_or_1,
+ 'opcode' : number,
+ 'mask' : 32_bit_number,
+ 'hlen' : header_bytes_number,
+ 'length' : payload_bytes_number,
+ 'payload' : decoded_buffer,
+ 'left' : bytes_left_number,
+ 'close_code' : number,
+ 'close_reason' : string}
+ """
+
+ f = {'fin' : 0,
+ 'opcode' : 0,
+ 'mask' : 0,
+ 'hlen' : 2,
+ 'length' : 0,
+ 'payload' : None,
+ 'left' : 0,
+ 'close_code' : 1000,
+ 'close_reason' : ''}
+
+ blen = len(buf)
+ f['left'] = blen
+
+ if blen < f['hlen']:
+ return f # Incomplete frame header
+
+ b1, b2 = unpack_from(">BB", buf)
+ f['opcode'] = b1 & 0x0f
+ f['fin'] = (b1 & 0x80) >> 7
+ has_mask = (b2 & 0x80) >> 7
+
+ f['length'] = b2 & 0x7f
+
+ if f['length'] == 126:
+ f['hlen'] = 4
+ if blen < f['hlen']:
+ return f # Incomplete frame header
+ (f['length'],) = unpack_from('>xxH', buf)
+ elif f['length'] == 127:
+ f['hlen'] = 10
+ if blen < f['hlen']:
+ return f # Incomplete frame header
+ (f['length'],) = unpack_from('>xxQ', buf)
+
+ full_len = f['hlen'] + has_mask * 4 + f['length']
+
+ if blen < full_len: # Incomplete frame
+ return f # Incomplete frame header
+
+ # Number of bytes that are part of the next frame(s)
+ f['left'] = blen - full_len
+
+ # Process 1 frame
+ if has_mask:
+ # unmask payload
+ f['mask'] = buf[f['hlen']:f['hlen']+4]
+ f['payload'] = WebSocketServer.unmask(buf, f)
+ else:
+ print("Unmasked frame: %s" % repr(buf))
+ f['payload'] = buf[(f['hlen'] + has_mask * 4):full_len]
+
+ if base64 and f['opcode'] in [1, 2]:
+ try:
+ f['payload'] = b64decode(f['payload'])
+ except:
+ print("Exception while b64decoding buffer: %s" %
+ repr(buf))
+ raise
+
+ if f['opcode'] == 0x08:
+ if f['length'] >= 2:
+ f['close_code'] = unpack_from(">H", f['payload'])[0]
+ if f['length'] > 3:
+ f['close_reason'] = f['payload'][2:]
+
+ return f
+
+ @staticmethod
+ def encode_hixie(buf):
+ return s2b("\x00" + b2s(b64encode(buf)) + "\xff"), 1, 1
+
+ @staticmethod
+ def decode_hixie(buf):
+ end = buf.find(s2b('\xff'))
+ return {'payload': b64decode(buf[1:end]),
+ 'hlen': 1,
+ 'length': end - 1,
+ 'left': len(buf) - (end + 1)}
+
+
+ @staticmethod
+ def gen_md5(keys):
+ """ Generate hash value for WebSockets hixie-76. """
+ key1 = keys['Sec-WebSocket-Key1']
+ key2 = keys['Sec-WebSocket-Key2']
+ key3 = keys['key3']
+ spaces1 = key1.count(" ")
+ spaces2 = key2.count(" ")
+ num1 = int("".join([c for c in key1 if c.isdigit()])) / spaces1
+ num2 = int("".join([c for c in key2 if c.isdigit()])) / spaces2
+
+ return b2s(md5(pack('>II8s',
+ int(num1), int(num2), key3)).digest())
+
+ #
+ # WebSocketServer logging/output functions
+ #
+
+ def traffic(self, token="."):
+ """ Show traffic flow in verbose mode. """
+ if self.verbose and not self.daemon:
+ sys.stdout.write(token)
+ sys.stdout.flush()
+
+ def msg(self, msg):
+ """ Output message with handler_id prefix. """
+ if not self.daemon:
+ print("% 3d: %s" % (self.handler_id, msg))
+
+ def vmsg(self, msg):
+ """ Same as msg() but only if verbose. """
+ if self.verbose:
+ self.msg(msg)
+
+ #
+ # Main WebSocketServer methods
+ #
+ def send_frames(self, bufs=None):
+ """ Encode and send WebSocket frames. Any frames already
+ queued will be sent first. If buf is not set then only queued
+ frames will be sent. Returns the number of pending frames that
+ could not be fully sent. If returned pending frames is greater
+ than 0, then the caller should call again when the socket is
+ ready. """
+
+ tdelta = int(time.time()*1000) - self.start_time
+
+ if bufs:
+ for buf in bufs:
+ if self.version.startswith("hybi"):
+ if self.base64:
+ encbuf, lenhead, lentail = self.encode_hybi(
+ buf, opcode=1, base64=True)
+ else:
+ encbuf, lenhead, lentail = self.encode_hybi(
+ buf, opcode=2, base64=False)
+
+ else:
+ encbuf, lenhead, lentail = self.encode_hixie(buf)
+
+ if self.rec:
+ self.rec.write("%s,\n" %
+ repr("{%s{" % tdelta
+ + encbuf[lenhead:-lentail]))
+
+ self.send_parts.append(encbuf)
+
+ while self.send_parts:
+ # Send pending frames
+ buf = self.send_parts.pop(0)
+ sent = self.client.send(buf)
+
+ if sent == len(buf):
+ self.traffic("<")
+ else:
+ self.traffic("<.")
+ self.send_parts.insert(0, buf[sent:])
+ break
+
+ return len(self.send_parts)
+
+ def recv_frames(self):
+ """ Receive and decode WebSocket frames.
+
+ Returns:
+ (bufs_list, closed_string)
+ """
+
+ closed = False
+ bufs = []
+ tdelta = int(time.time()*1000) - self.start_time
+
+ buf = self.client.recv(self.buffer_size)
+ if len(buf) == 0:
+ closed = {'code': 1000, 'reason': "Client closed abruptly"}
+ return bufs, closed
+
+ if self.recv_part:
+ # Add partially received frames to current read buffer
+ buf = self.recv_part + buf
+ self.recv_part = None
+
+ while buf:
+ if self.version.startswith("hybi"):
+
+ frame = self.decode_hybi(buf, base64=self.base64)
+ #print("Received buf: %s, frame: %s" % (repr(buf), frame))
+
+ if frame['payload'] == None:
+ # Incomplete/partial frame
+ self.traffic("}.")
+ if frame['left'] > 0:
+ self.recv_part = buf[-frame['left']:]
+ break
+ else:
+ if frame['opcode'] == 0x8: # connection close
+ closed = {'code': frame['close_code'],
+ 'reason': frame['close_reason']}
+ break
+
+ else:
+ if buf[0:2] == s2b('\xff\x00'):
+ closed = {'code': 1000,
+ 'reason': "Client sent orderly close frame"}
+ break
+
+ elif buf[0:2] == s2b('\x00\xff'):
+ buf = buf[2:]
+ continue # No-op
+
+ elif buf.count(s2b('\xff')) == 0:
+ # Partial frame
+ self.traffic("}.")
+ self.recv_part = buf
+ break
+
+ frame = self.decode_hixie(buf)
+
+ self.traffic("}")
+
+ if self.rec:
+ start = frame['hlen']
+ end = frame['hlen'] + frame['length']
+ self.rec.write("%s,\n" %
+ repr("}%s}" % tdelta + buf[start:end]))
+
+
+ bufs.append(frame['payload'])
+
+ if frame['left']:
+ buf = buf[-frame['left']:]
+ else:
+ buf = ''
+
+ return bufs, closed
+
+ def send_close(self, code=1000, reason=''):
+ """ Send a WebSocket orderly close frame. """
+
+ if self.version.startswith("hybi"):
+ msg = pack(">H%ds" % len(reason), code, reason)
+
+ buf, h, t = self.encode_hybi(msg, opcode=0x08, base64=False)
+ self.client.send(buf)
+
+ elif self.version == "hixie-76":
+ buf = s2b('\xff\x00')
+ self.client.send(buf)
+
+ # No orderly close for 75
+
+ def do_handshake(self, sock, address):
+ """
+ do_handshake does the following:
+ - Peek at the first few bytes from the socket.
+ - If the connection is Flash policy request then answer it,
+ close the socket and return.
+ - If the connection is an HTTPS/SSL/TLS connection then SSL
+ wrap the socket.
+ - Read from the (possibly wrapped) socket.
+ - If we have received a HTTP GET request and the webserver
+ functionality is enabled, answer it, close the socket and
+ return.
+ - Assume we have a WebSockets connection, parse the client
+ handshake data.
+ - Send a WebSockets handshake server response.
+ - Return the socket for this WebSocket client.
+ """
+
+ stype = ""
+
+ ready = select.select([sock], [], [], 3)[0]
+ if not ready:
+ raise self.EClose("ignoring socket not ready")
+ # Peek, but do not read the data so that we have a opportunity
+ # to SSL wrap the socket first
+ handshake = sock.recv(1024, socket.MSG_PEEK)
+ #self.msg("Handshake [%s]" % handshake)
+
+ if handshake == "":
+ raise self.EClose("ignoring empty handshake")
+
+ elif handshake.startswith(s2b("<policy-file-request/>")):
+ # Answer Flash policy request
+ handshake = sock.recv(1024)
+ sock.send(s2b(self.policy_response))
+ raise self.EClose("Sending flash policy response")
+
+ elif handshake[0] in ("\x16", "\x80", 22, 128):
+ # SSL wrap the connection
+ if not ssl:
+ raise self.EClose("SSL connection but no 'ssl' module")
+ if not os.path.exists(self.cert):
+ raise self.EClose("SSL connection but '%s' not found"
+ % self.cert)
+ retsock = None
+ try:
+ retsock = ssl.wrap_socket(
+ sock,
+ server_side=True,
+ certfile=self.cert,
+ keyfile=self.key)
+ except ssl.SSLError:
+ _, x, _ = sys.exc_info()
+ if x.args[0] == ssl.SSL_ERROR_EOF:
+ if len(x.args) > 1:
+ raise self.EClose(x.args[1])
+ else:
+ raise self.EClose("Got SSL_ERROR_EOF")
+ else:
+ raise
+
+ scheme = "wss"
+ stype = "SSL/TLS (wss://)"
+
+ elif self.ssl_only:
+ raise self.EClose("non-SSL connection received but disallowed")
+
+ else:
+ retsock = sock
+ scheme = "ws"
+ stype = "Plain non-SSL (ws://)"
+
+ wsh = WSRequestHandler(retsock, address, not self.web)
+ if wsh.last_code == 101:
+ # Continue on to handle WebSocket upgrade
+ pass
+ elif wsh.last_code == 405:
+ raise self.EClose("Normal web request received but disallowed")
+ elif wsh.last_code < 200 or wsh.last_code >= 300:
+ raise self.EClose(wsh.last_message)
+ elif self.verbose:
+ raise self.EClose(wsh.last_message)
+ else:
+ raise self.EClose("")
+
+ h = self.headers = wsh.headers
+ path = self.path = wsh.path
+
+ prot = 'WebSocket-Protocol'
+ protocols = h.get('Sec-'+prot, h.get(prot, '')).split(',')
+
+ ver = h.get('Sec-WebSocket-Version')
+ if ver:
+ # HyBi/IETF version of the protocol
+
+ # HyBi-07 report version 7
+ # HyBi-08 - HyBi-12 report version 8
+ # HyBi-13 reports version 13
+ if ver in ['7', '8', '13']:
+ self.version = "hybi-%02d" % int(ver)
+ else:
+ raise self.EClose('Unsupported protocol version %s' % ver)
+
+ key = h['Sec-WebSocket-Key']
+
+ # Choose binary if client supports it
+ if 'binary' in protocols:
+ self.base64 = False
+ elif 'base64' in protocols:
+ self.base64 = True
+ else:
+ raise self.EClose("Client must support 'binary' or 'base64' protocol")
+
+ # Generate the hash value for the accept header
+ accept = b64encode(sha1(s2b(key + self.GUID)).digest())
+
+ response = self.server_handshake_hybi % b2s(accept)
+ if self.base64:
+ response += "Sec-WebSocket-Protocol: base64\r\n"
+ else:
+ response += "Sec-WebSocket-Protocol: binary\r\n"
+ response += "\r\n"
+
+ else:
+ # Hixie version of the protocol (75 or 76)
+
+ if h.get('key3'):
+ trailer = self.gen_md5(h)
+ pre = "Sec-"
+ self.version = "hixie-76"
+ else:
+ trailer = ""
+ pre = ""
+ self.version = "hixie-75"
+
+ # We only support base64 in Hixie era
+ self.base64 = True
+
+ response = self.server_handshake_hixie % (pre,
+ h['Origin'], pre, scheme, h['Host'], path)
+
+ if 'base64' in protocols:
+ response += "%sWebSocket-Protocol: base64\r\n" % pre
+ else:
+ self.msg("Warning: client does not report 'base64' protocol support")
+ response += "\r\n" + trailer
+
+ self.msg("%s: %s WebSocket connection" % (address[0], stype))
+ self.msg("%s: Version %s, base64: '%s'" % (address[0],
+ self.version, self.base64))
+ if self.path != '/':
+ self.msg("%s: Path: '%s'" % (address[0], self.path))
+
+
+ # Send server WebSockets handshake response
+ #self.msg("sending response [%s]" % response)
+ retsock.send(s2b(response))
+
+ # Return the WebSockets socket which may be SSL wrapped
+ return retsock
+
+
+ #
+ # Events that can/should be overridden in sub-classes
+ #
+ def started(self):
+ """ Called after WebSockets startup """
+ self.vmsg("WebSockets server started")
+
+ def poll(self):
+ """ Run periodically while waiting for connections. """
+ #self.vmsg("Running poll()")
+ pass
+
+ def fallback_SIGCHLD(self, sig, stack):
+ # Reap zombies when using os.fork() (python 2.4)
+ self.vmsg("Got SIGCHLD, reaping zombies")
+ try:
+ result = os.waitpid(-1, os.WNOHANG)
+ while result[0]:
+ self.vmsg("Reaped child process %s" % result[0])
+ result = os.waitpid(-1, os.WNOHANG)
+ except (OSError):
+ pass
+
+ def do_SIGINT(self, sig, stack):
+ self.msg("Got SIGINT, exiting")
+ sys.exit(0)
+
+ def top_new_client(self, startsock, address):
+ """ Do something with a WebSockets client connection. """
+ # Initialize per client settings
+ self.send_parts = []
+ self.recv_part = None
+ self.base64 = False
+ self.rec = None
+ self.start_time = int(time.time()*1000)
+
+ # handler process
+ try:
+ try:
+ self.client = self.do_handshake(startsock, address)
+
+ if self.record:
+ # Record raw frame data as JavaScript array
+ fname = "%s.%s" % (self.record,
+ self.handler_id)
+ self.msg("opening record file: %s" % fname)
+ self.rec = open(fname, 'w+')
+ self.rec.write("var VNC_frame_data = [\n")
+
+ self.ws_connection = True
+ self.new_client()
+ except self.CClose:
+ # Close the client
+ _, exc, _ = sys.exc_info()
+ if self.client:
+ self.send_close(exc.args[0], exc.args[1])
+ except self.EClose:
+ _, exc, _ = sys.exc_info()
+ # Connection was not a WebSockets connection
+ if exc.args[0]:
+ self.msg("%s: %s" % (address[0], exc.args[0]))
+ except Exception:
+ _, exc, _ = sys.exc_info()
+ self.msg("handler exception: %s" % str(exc))
+ if self.verbose:
+ self.msg(traceback.format_exc())
+ finally:
+ if self.rec:
+ self.rec.write("'EOF']\n")
+ self.rec.close()
+
+ if self.client and self.client != startsock:
+ # Close the SSL wrapped socket
+ # Original socket closed by caller
+ self.client.close()
+
+ def new_client(self):
+ """ Do something with a WebSockets client connection. """
+ raise("WebSocketServer.new_client() must be overloaded")
+
+ def start_server(self):
+ """
+ Daemonize if requested. Listen for for connections. Run
+ do_handshake() method for each connection. If the connection
+ is a WebSockets client then call new_client() method (which must
+ be overridden) for each new client connection.
+ """
+ lsock = self.socket(self.listen_host, self.listen_port)
+
+ if self.daemon:
+ self.daemonize(keepfd=lsock.fileno(), chdir=self.web)
+
+ self.started() # Some things need to happen after daemonizing
+
+ # Allow override of SIGINT
+ signal.signal(signal.SIGINT, self.do_SIGINT)
+ if not multiprocessing:
+ # os.fork() (python 2.4) child reaper
+ signal.signal(signal.SIGCHLD, self.fallback_SIGCHLD)
+
+ while True:
+ try:
+ try:
+ self.client = None
+ startsock = None
+ pid = err = 0
+
+ time_elapsed = time.time() - self.launch_time
+ if self.timeout and time_elapsed > self.timeout:
+ self.msg('listener exit due to --timeout %s'
+ % self.timeout)
+ break
+
+ try:
+ self.poll()
+
+ ready = select.select([lsock], [], [], 1)[0]
+ if lsock in ready:
+ startsock, address = lsock.accept()
+ else:
+ continue
+ except Exception:
+ _, exc, _ = sys.exc_info()
+ if hasattr(exc, 'errno'):
+ err = exc.errno
+ elif hasattr(exc, 'args'):
+ err = exc.args[0]
+ else:
+ err = exc[0]
+ if err == errno.EINTR:
+ self.vmsg("Ignoring interrupted syscall")
+ continue
+ else:
+ raise
+
+ if self.run_once:
+ # Run in same process if run_once
+ self.top_new_client(startsock, address)
+ if self.ws_connection :
+ self.msg('%s: exiting due to --run-once'
+ % address[0])
+ break
+ elif multiprocessing:
+ self.vmsg('%s: new handler Process' % address[0])
+ p = multiprocessing.Process(
+ target=self.top_new_client,
+ args=(startsock, address))
+ p.start()
+ # child will not return
+ else:
+ # python 2.4
+ self.vmsg('%s: forking handler' % address[0])
+ pid = os.fork()
+ if pid == 0:
+ # child handler process
+ self.top_new_client(startsock, address)
+ break # child process exits
+
+ # parent process
+ self.handler_id += 1
+
+ except KeyboardInterrupt:
+ _, exc, _ = sys.exc_info()
+ print("In KeyboardInterrupt")
+ pass
+ except SystemExit:
+ _, exc, _ = sys.exc_info()
+ print("In SystemExit")
+ break
+ except Exception:
+ _, exc, _ = sys.exc_info()
+ self.msg("handler exception: %s" % str(exc))
+ if self.verbose:
+ self.msg(traceback.format_exc())
+
+ finally:
+ if startsock:
+ startsock.close()
+
+
+# HTTP handler with WebSocket upgrade support
+class WSRequestHandler(SimpleHTTPRequestHandler):
+ def __init__(self, req, addr, only_upgrade=False):
+ self.only_upgrade = only_upgrade # only allow upgrades
+ SimpleHTTPRequestHandler.__init__(self, req, addr, object())
+
+ def do_GET(self):
+ if (self.headers.get('upgrade') and
+ self.headers.get('upgrade').lower() == 'websocket'):
+
+ if (self.headers.get('sec-websocket-key1') or
+ self.headers.get('websocket-key1')):
+ # For Hixie-76 read out the key hash
+ self.headers.__setitem__('key3', self.rfile.read(8))
+
+ # Just indicate that an WebSocket upgrade is needed
+ self.last_code = 101
+ self.last_message = "101 Switching Protocols"
+ elif self.only_upgrade:
+ # Normal web request responses are disabled
+ self.last_code = 405
+ self.last_message = "405 Method Not Allowed"
+ else:
+ SimpleHTTPRequestHandler.do_GET(self)
+
+ def send_response(self, code, message=None):
+ # Save the status code
+ self.last_code = code
+ SimpleHTTPRequestHandler.send_response(self, code, message)
+
+ def log_message(self, f, *args):
+ # Save instead of printing
+ self.last_message = f % args
+

diff --git a/noVNC/utils/websockify b/noVNC/utils/websockify
new file mode 100644
index 0000000..550dff7
--- /dev/null
+++ b/noVNC/utils/websockify
@@ -0,0 +1,285 @@
+#!/usr/bin/env python
+
+'''
+A WebSocket to TCP socket proxy with support for "wss://" encryption.
+Copyright 2011 Joel Martin
+Licensed under LGPL version 3 (see docs/LICENSE.LGPL-3)
+
+You can make a cert/key with openssl using:
+openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem
+as taken from http://docs.python.org/dev/library/ssl.html#certificates
+
+'''
+
+import socket, optparse, time, os, sys, subprocess
+from select import select
+from websocket import WebSocketServer
+
+class WebSocketProxy(WebSocketServer):
+ """
+ Proxy traffic to and from a WebSockets client to a normal TCP
+ socket server target. All traffic to/from the client is base64
+ encoded/decoded to allow binary data to be sent/received to/from
+ the target.
+ """
+
+ buffer_size = 65536
+
+ traffic_legend = """
+Traffic Legend:
+ } - Client receive
+ }. - Client receive partial
+ { - Target receive
+
+ > - Target send
+ >. - Target send partial
+ < - Client send
+ <. - Client send partial
+"""
+
+ def __init__(self, *args, **kwargs):
+ # Save off proxy specific options
+ self.target_host = kwargs.pop('target_host')
+ self.target_port = kwargs.pop('target_port')
+ self.wrap_cmd = kwargs.pop('wrap_cmd')
+ self.wrap_mode = kwargs.pop('wrap_mode')
+ # Last 3 timestamps command was run
+ self.wrap_times = [0, 0, 0]
+
+ if self.wrap_cmd:
+ rebinder_path = ['./', os.path.dirname(sys.argv[0])]
+ self.rebinder = None
+
+ for rdir in rebinder_path:
+ rpath = os.path.join(rdir, "rebind.so")
+ if os.path.exists(rpath):
+ self.rebinder = rpath
+ break
+
+ if not self.rebinder:
+ raise Exception("rebind.so not found, perhaps you need to run make")
+
+ self.target_host = "127.0.0.1" # Loopback
+ # Find a free high port
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ sock.bind(('', 0))
+ self.target_port = sock.getsockname()[1]
+ sock.close()
+
+ os.environ.update({
+ "LD_PRELOAD": self.rebinder,
+ "REBIND_OLD_PORT": str(kwargs['listen_port']),
+ "REBIND_NEW_PORT": str(self.target_port)})
+
+ WebSocketServer.__init__(self, *args, **kwargs)
+
+ def run_wrap_cmd(self):
+ print("Starting '%s'" % " ".join(self.wrap_cmd))
+ self.wrap_times.append(time.time())
+ self.wrap_times.pop(0)
+ self.cmd = subprocess.Popen(
+ self.wrap_cmd, env=os.environ)
+ self.spawn_message = True
+
+ def started(self):
+ """
+ Called after Websockets server startup (i.e. after daemonize)
+ """
+ # Need to call wrapped command after daemonization so we can
+ # know when the wrapped command exits
+ if self.wrap_cmd:
+ print(" - proxying from %s:%s to '%s' (port %s)\n" % (
+ self.listen_host, self.listen_port,
+ " ".join(self.wrap_cmd), self.target_port))
+ self.run_wrap_cmd()
+ else:
+ print(" - proxying from %s:%s to %s:%s\n" % (
+ self.listen_host, self.listen_port,
+ self.target_host, self.target_port))
+
+ def poll(self):
+ # If we are wrapping a command, check it's status
+
+ if self.wrap_cmd and self.cmd:
+ ret = self.cmd.poll()
+ if ret != None:
+ self.vmsg("Wrapped command exited (or daemon). Returned %s" % ret)
+ self.cmd = None
+
+ if self.wrap_cmd and self.cmd == None:
+ # Response to wrapped command being gone
+ if self.wrap_mode == "ignore":
+ pass
+ elif self.wrap_mode == "exit":
+ sys.exit(ret)
+ elif self.wrap_mode == "respawn":
+ now = time.time()
+ avg = sum(self.wrap_times)/len(self.wrap_times)
+ if (now - avg) < 10:
+ # 3 times in the last 10 seconds
+ if self.spawn_message:
+ print("Command respawning too fast")
+ self.spawn_message = False
+ else:
+ self.run_wrap_cmd()
+
+ #
+ # Routines above this point are run in the master listener
+ # process.
+ #
+
+ #
+ # Routines below this point are connection handler routines and
+ # will be run in a separate forked process for each connection.
+ #
+
+ def new_client(self):
+ """
+ Called after a new WebSocket connection has been established.
+ """
+
+ # Connect to the target
+ self.msg("connecting to: %s:%s" % (
+ self.target_host, self.target_port))
+ tsock = self.socket(self.target_host, self.target_port,
+ connect=True)
+
+ if self.verbose and not self.daemon:
+ print(self.traffic_legend)
+
+ # Start proxying
+ try:
+ self.do_proxy(tsock)
+ except:
+ if tsock:
+ tsock.shutdown(socket.SHUT_RDWR)
+ tsock.close()
+ self.vmsg("%s:%s: Target closed" %(
+ self.target_host, self.target_port))
+ raise
+
+ def do_proxy(self, target):
+ """
+ Proxy client WebSocket to normal target socket.
+ """
+ cqueue = []
+ c_pend = 0
+ tqueue = []
+ rlist = [self.client, target]
+
+ while True:
+ wlist = []
+
+ if tqueue: wlist.append(target)
+ if cqueue or c_pend: wlist.append(self.client)
+ ins, outs, excepts = select(rlist, wlist, [], 1)
+ if excepts: raise Exception("Socket exception")
+
+ if target in outs:
+ # Send queued client data to the target
+ dat = tqueue.pop(0)
+ sent = target.send(dat)
+ if sent == len(dat):
+ self.traffic(">")
+ else:
+ # requeue the remaining data
+ tqueue.insert(0, dat[sent:])
+ self.traffic(".>")
+
+
+ if target in ins:
+ # Receive target data, encode it and queue for client
+ buf = target.recv(self.buffer_size)
+ if len(buf) == 0:
+ raise self.CClose(1000, "Target closed")
+
+ cqueue.append(buf)
+ self.traffic("{")
+
+
+ if self.client in outs:
+ # Send queued target data to the client
+ c_pend = self.send_frames(cqueue)
+
+ cqueue = []
+
+
+ if self.client in ins:
+ # Receive client data, decode it, and queue for target
+ bufs, closed = self.recv_frames()
+ tqueue.extend(bufs)
+
+ if closed:
+ # TODO: What about blocking on client socket?
+ raise self.CClose(closed['code'], closed['reason'])
+
+def websockify_init():
+ usage = "\n %prog [options]"
+ usage += " [source_addr:]source_port target_addr:target_port"
+ usage += "\n %prog [options]"
+ usage += " [source_addr:]source_port -- WRAP_COMMAND_LINE"
+ parser = optparse.OptionParser(usage=usage)
+ parser.add_option("--verbose", "-v", action="store_true",
+ help="verbose messages and per frame traffic")
+ parser.add_option("--record",
+ help="record sessions to FILE.[session_number]", metavar="FILE")
+ parser.add_option("--daemon", "-D",
+ dest="daemon", action="store_true",
+ help="become a daemon (background process)")
+ parser.add_option("--run-once", action="store_true",
+ help="handle a single WebSocket connection and exit")
+ parser.add_option("--timeout", type=int, default=0,
+ help="after TIMEOUT seconds exit when not connected")
+ parser.add_option("--cert", default="self.pem",
+ help="SSL certificate file")
+ parser.add_option("--key", default=None,
+ help="SSL key file (if separate from cert)")
+ parser.add_option("--ssl-only", action="store_true",
+ help="disallow non-encrypted connections")
+ parser.add_option("--web", default=None, metavar="DIR",
+ help="run webserver on same port. Serve files from DIR.")
+ parser.add_option("--wrap-mode", default="exit", metavar="MODE",
+ choices=["exit", "ignore", "respawn"],
+ help="action to take when the wrapped program exits "
+ "or daemonizes: exit (default), ignore, respawn")
+ (opts, args) = parser.parse_args()
+
+ # Sanity checks
+ if len(args) < 2:
+ parser.error("Too few arguments")
+ if sys.argv.count('--'):
+ opts.wrap_cmd = args[1:]
+ else:
+ opts.wrap_cmd = None
+ if len(args) > 2:
+ parser.error("Too many arguments")
+
+ if opts.ssl_only and not os.path.exists(opts.cert):
+ parser.error("SSL only and %s not found" % opts.cert)
+
+ # Parse host:port and convert ports to numbers
+ if args[0].count(':') > 0:
+ opts.listen_host, opts.listen_port = args[0].rsplit(':', 1)
+ else:
+ opts.listen_host, opts.listen_port = '', args[0]
+
+ try: opts.listen_port = int(opts.listen_port)
+ except: parser.error("Error parsing listen port")
+
+ if opts.wrap_cmd:
+ opts.target_host = None
+ opts.target_port = None
+ else:
+ if args[1].count(':') > 0:
+ opts.target_host, opts.target_port = args[1].rsplit(':', 1)
+ else:
+ parser.error("Error parsing target")
+ try: opts.target_port = int(opts.target_port)
+ except: parser.error("Error parsing target port")
+
+ # Create and start the WebSockets proxy
+ server = WebSocketProxy(**opts.__dict__)
+ server.start_server()
+
+if __name__ == '__main__':
+ websockify_init()

diff --git a/noVNC/utils/websockify.py b/noVNC/utils/websockify.py
new file mode 120000
index 0000000..05b5af4
--- /dev/null
+++ b/noVNC/utils/websockify.py
@@ -0,0 +1 @@
+websockify
\ No newline at end of file

diff --git a/noVNC/utils/wsproxy.py b/noVNC/utils/wsproxy.py
new file mode 120000
index 0000000..05b5af4
--- /dev/null
+++ b/noVNC/utils/wsproxy.py
@@ -0,0 +1 @@
+websockify
\ No newline at end of file

diff --git a/noVNC/vnc.html b/noVNC/vnc.html
new file mode 100644
index 0000000..1b886a4
--- /dev/null
+++ b/noVNC/vnc.html
@@ -0,0 +1,200 @@
+<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.1//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile11.dtd">
+<html>
+<head>
+
+ <!--
+ noVNC example: simple example using default UI
+ Copyright (C) 2012 Joel Martin
+ noVNC is licensed under the LGPL-3 (see LICENSE.txt)
+ This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
+ -->
+ <title>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">
+
+ <!-- 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 names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
+ <!-- App Start Icon -->
+ <link rel="apple-touch-startup-image" href="images/screen_320x460.png" />
+ <!-- For iOS devices set the icon to use if user bookmarks app on their homescreen -->
+ <link rel="apple-touch-icon" href="images/screen_57x57.png">
+ <!--
+ <link rel="apple-touch-icon-precomposed" href="images/screen_57x57.png" />
+ -->
+
+
+ <!-- Stylesheets -->
+ <link rel="stylesheet" href="include/base.css" />
+ <link rel="alternate stylesheet" href="include/black.css" TITLE="Black" />
+ <link rel="alternate stylesheet" href="include/blue.css" TITLE="Blue" />
+
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+
+ <script src="include/vnc.js"></script>
+ <script src="include/ui.js"></script>
+
+</head>
+
+<body>
+ <div id="noVNC-control-bar">
+ <!--noVNC Mobile Device only Buttons-->
+ <div class="noVNC-buttons-left">
+ <input type="image" src="images/drag.png"
+ id="noVNC_view_drag_button" class="noVNC_status_button"
+ title="Move/Drag Viewport"
+ onclick="UI.setViewDrag();">
+ <div id="noVNC_mobile_buttons">
+ <input type="image" src="images/mouse_none.png"
+ id="noVNC_mouse_button0" class="noVNC_status_button"
+ onclick="UI.setMouseButton(1);">
+ <input type="image" src="images/mouse_left.png"
+ id="noVNC_mouse_button1" class="noVNC_status_button"
+ onclick="UI.setMouseButton(2);">
+ <input type="image" src="images/mouse_middle.png"
+ id="noVNC_mouse_button2" class="noVNC_status_button"
+ onclick="UI.setMouseButton(4);">
+ <input type="image" src="images/mouse_right.png"
+ id="noVNC_mouse_button4" class="noVNC_status_button"
+ onclick="UI.setMouseButton(0);">
+ <input type="image" src="images/keyboard.png"
+ id="showKeyboard" class="noVNC_status_button"
+ value="Keyboard" title="Show Keyboard"
+ onclick="UI.showKeyboard()"/>
+ <input type="email"
+ autocapitalize="off" autocorrect="off"
+ id="keyboardinput" class="noVNC_status_button"
+ onKeyDown="onKeyDown(event);" onblur="UI.keyInputBlur();"/>
+ </div>
+ </div>
+
+ <!--noVNC Buttons-->
+ <div class="noVNC-buttons-right">
+ <input type="image" src="images/ctrlaltdel.png"
+ id="sendCtrlAltDelButton" class="noVNC_status_button"
+ title="Send Ctrl-Alt-Del"
+ onclick="UI.sendCtrlAltDel();" />
+ <input type="image" src="images/clipboard.png"
+ id="clipboardButton" class="noVNC_status_button"
+ title="Clipboard"
+ onclick="UI.toggleClipboardPanel();" />
+ <input type="image" src="images/settings.png"
+ id="settingsButton" class="noVNC_status_button"
+ title="Settings"
+ onclick="UI.toggleSettingsPanel();" />
+ <input type="image" src="images/connect.png"
+ id="connectButton" class="noVNC_status_button"
+ title="Connect"
+ onclick="UI.toggleConnectPanel()" />
+ <input type="image" src="images/disconnect.png"
+ id="disconnectButton" class="noVNC_status_button"
+ title="Disconnect"
+ onclick="UI.disconnect()" />
+ </div>
+
+ <!-- Description Panel -->
+ <!-- Shown by default when hosted at for kanaka.github.com -->
+ <div id="noVNC_description" style="display:none;" class="">
+ noVNC is a browser based VNC client implemented using HTML5 Canvas
+ and WebSockets. You will either need a VNC server with WebSockets
+ support (such as <a href="http://libvncserver.sourceforge.net/">libvncserver</a>)
+ or you will need to use
+ <a href="https://github.com/kanaka/websockify">websockify</a>
+ to bridge between your browser and VNC server. See the noVNC
+ <a href="https://github.com/kanaka/noVNC">README</a>
+ and <a href="http://kanaka.github.com/noVNC">website</a>
+ for more information.
+ <br />
+ <input type="button" value="Close"
+ onclick="UI.toggleConnectPanel();">
+ </div>
+
+ <!-- Clipboard Panel -->
+ <div id="noVNC_clipboard" class="triangle-right top">
+ <textarea id="noVNC_clipboard_text" rows=5
+ onfocus="UI.displayBlur();" onblur="UI.displayFocus();"
+ onchange="UI.clipSend();">
+ </textarea>
+ <br />
+ <input id="noVNC_clipboard_clear_button" type="button"
+ value="Clear" onclick="UI.clipClear();">
+ </div>
+
+ <!-- Settings Panel -->
+ <div id="noVNC_settings" class="triangle-right top">
+ <span id="noVNC_settings_menu" onmouseover="UI.displayBlur();"
+ onmouseout="UI.displayFocus();">
+ <ul>
+ <li><input id="noVNC_encrypt" type="checkbox"> Encrypt</li>
+ <li><input id="noVNC_true_color" type="checkbox" checked> True Color</li>
+ <li><input id="noVNC_cursor" type="checkbox"> Local Cursor</li>
+ <li><input id="noVNC_clip" type="checkbox"> Clip to Window</li>
+ <li><input id="noVNC_shared" type="checkbox"> Shared Mode</li>
+ <li><input id="noVNC_view_only" type="checkbox"> View Only</li>
+ <li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
+ <li><input id="noVNC_path" type="input" value="websockify"> Path</li>
+ <li><input id="noVNC_repeaterID" type="input" value=""> Repeater ID</li>
+ <hr>
+ <!-- Stylesheet selection dropdown -->
+ <li><label><strong>Style: </strong>
+ <select id="noVNC_stylesheet" name="vncStyle">
+ <option value="default">default</option>
+ </select></label>
+ </li>
+
+ <!-- Logging selection dropdown -->
+ <li><label><strong>Logging: </strong>
+ <select id="noVNC_logging" name="vncLogging">
+ </select></label>
+ </li>
+ <hr>
+ <li><input type="button" id="noVNC_apply" value="Apply"
+ onclick="UI.settingsApply()"></li>
+ </ul>
+ </span>
+ </div>
+
+ <!-- Connection Panel -->
+ <div id="noVNC_controls" class="triangle-right top">
+ <ul>
+ <li><label><strong>Host: </strong><input id="noVNC_host" /></label></li>
+ <li><label><strong>Port: </strong><input id="noVNC_port" /></label></li>
+ <li><label><strong>Password: </strong><input id="noVNC_password" type="password" /></label></li>
+ <li><input id="noVNC_connect_button" type="button" value="Connect" onclick="UI.connect();"></li>
+ </ul>
+ </div>
+
+ </div> <!-- End of noVNC-control-bar -->
+
+
+ <div id="noVNC_screen">
+ <div id="noVNC_screen_pad"></div>
+
+ <div id="noVNC_status_bar" class="noVNC_status_bar">
+ <div id="noVNC_status">Loading</div>
+ </div>
+
+ <h1 id="noVNC_logo"><span>no</span><br />VNC</h1>
+
+ <!-- HTML5 Canvas -->
+ <div id="noVNC_container">
+ <canvas id="noVNC_canvas" width="640px" height="20px">
+ Canvas not supported.
+ </canvas>
+ </div>
+
+ </div>
+
+ <script>
+ window.onload = UI.load;
+ </script>
+ </body>
+</html>

diff --git a/noVNC/vnc_auto.html b/noVNC/vnc_auto.html
new file mode 100644
index 0000000..2b60d77
--- /dev/null
+++ b/noVNC/vnc_auto.html
@@ -0,0 +1,130 @@
+<!DOCTYPE html>
+<html>
+ <!--
+ noVNC example: simple example using default UI
+ Copyright (C) 2012 Joel Martin
+ noVNC is licensed under the LGPL-3 (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&true_color=1
+ -->
+ <head>
+ <title>noVNC</title>
+ <meta http-equiv="X-UA-Compatible" content="chrome=1">
+ <link rel="stylesheet" href="include/base.css" title="plain">
+ <!--
+ <script type='text/javascript'
+ src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
+ -->
+ <script src="include/vnc.js"></script>
+ </head>
+
+ <body style="margin: 0px;">
+ <div id="noVNC_screen">
+ <div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px;">
+ <table border=0 width="100%"><tr>
+ <td><div id="noVNC_status">Loading</div></td>
+ <td width="1%"><div id="noVNC_buttons">
+ <input type=button value="Send CtrlAltDel"
+ id="sendCtrlAltDelButton">
+ </div></td>
+ </tr></table>
+ </div>
+ <canvas id="noVNC_canvas" width="640px" height="20px">
+ Canvas not supported.
+ </canvas>
+ </div>
+
+ <script>
+ /*jslint white: false */
+ /*global window, $, Util, RFB, */
+ "use strict";
+
+ var rfb;
+
+ function passwordRequired(rfb) {
+ var msg;
+ msg = '<form onsubmit="return setPassword();"';
+ msg += ' style="margin-bottom: 0px">';
+ msg += 'Password Required: ';
+ msg += '<input type=password size=10 id="password_input" class="noVNC_status">';
+ msg += '<\/form>';
+ $D('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
+ $D('noVNC_status').innerHTML = msg;
+ }
+ function setPassword() {
+ rfb.sendPassword($D('password_input').value);
+ return false;
+ }
+ function sendCtrlAltDel() {
+ rfb.sendCtrlAltDel();
+ return false;
+ }
+ function updateState(rfb, state, oldstate, msg) {
+ var s, sb, cad, level;
+ s = $D('noVNC_status');
+ sb = $D('noVNC_status_bar');
+ cad = $D('sendCtrlAltDelButton');
+ switch (state) {
+ case 'failed': level = "error"; break;
+ case 'fatal': level = "error"; break;
+ case 'normal': level = "normal"; break;
+ case 'disconnected': level = "normal"; break;
+ case 'loaded': level = "normal"; break;
+ default: level = "warn"; break;
+ }
+
+ if (state === "normal") { cad.disabled = false; }
+ else { cad.disabled = true; }
+
+ if (typeof(msg) !== 'undefined') {
+ sb.setAttribute("class", "noVNC_status_" + level);
+ s.innerHTML = msg;
+ }
+ }
+
+ window.onload = function () {
+ var host, port, password, path, token;
+
+ $D('sendCtrlAltDelButton').style.display = "inline";
+ $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
+
+ document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
+ // By default, use the host and port of server that served this file
+ host = WebUtil.getQueryVar('host', window.location.hostname);
+ port = WebUtil.getQueryVar('port', window.location.port);
+
+ // If a token variable is passed in, set the parameter in a cookie.
+ // This is used by nova-novncproxy.
+ token = WebUtil.getQueryVar('token', null);
+ if (token) {
+ WebUtil.createCookie('token', token, 1)
+ }
+
+ password = WebUtil.getQueryVar('password', '');
+ path = WebUtil.getQueryVar('path', 'websockify');
+
+ if ((!host) || (!port)) {
+ updateState('failed',
+ "Must specify host and port in URL");
+ return;
+ }
+
+ rfb = new RFB({'target': $D('noVNC_canvas'),
+ 'encrypt': WebUtil.getQueryVar('encrypt',
+ (window.location.protocol === "https:")),
+ 'repeaterID': WebUtil.getQueryVar('repeaterID', ''),
+ 'true_color': WebUtil.getQueryVar('true_color', true),
+ 'local_cursor': WebUtil.getQueryVar('cursor', true),
+ 'shared': WebUtil.getQueryVar('shared', true),
+ 'view_only': WebUtil.getQueryVar('view_only', false),
+ 'updateState': updateState,
+ 'onPasswordRequired': passwordRequired});
+ rfb.connect(host, port, password, path);
+ };
+ </script>
+
+ </body>
+</html>
+

diff --git a/requirements/dev.txt b/requirements/dev.txt
index f21bd36..ebc2a42 100644
--- a/requirements/dev.txt
+++ b/requirements/dev.txt
@@ -1,3 +1,2 @@
-Jinja2==2.6
-Pygments==1.6
-Sphinx==1.1.3
+-r production.txt
+-r docs.txt

diff --git a/requirements/dev.txt b/requirements/docs.txt
similarity index 100%
copy from requirements/dev.txt
copy to requirements/docs.txt
Reply all
Reply to author
Forward
0 new messages