diff --git a/console/templates/console-base.html b/console/templates/console-base.html
index 08aaf27..e2fa016 100644
--- a/console/templates/console-base.html
+++ b/console/templates/console-base.html
@@ -84,7 +84,7 @@
Ctrl+Alt+F12
- {% trans "Fullscreen" %}
+ {% trans "Fullscreen" %}
{% block navbarmenu %}{% endblock %}
diff --git a/console/templates/console-spice-full.html b/console/templates/console-spice-full.html
new file mode 100644
index 0000000..52a58f1
--- /dev/null
+++ b/console/templates/console-spice-full.html
@@ -0,0 +1,242 @@
+
+{% extends "console-base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% block head %}
+
+ WebVirtCloud - Spice Client - Full
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+ SPICE
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block foot %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/console/templates/console-spice-lite.html b/console/templates/console-spice-lite.html
new file mode 100644
index 0000000..6955363
--- /dev/null
+++ b/console/templates/console-spice-lite.html
@@ -0,0 +1,262 @@
+
+{% extends "console-base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% block head %}
+
+ Spice Javascript client
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+
+{% block content %}
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block foot %}
+
+{% endblock %}
diff --git a/console/templates/console-spice.html b/console/templates/console-spice.html
deleted file mode 100644
index d19a8f3..0000000
--- a/console/templates/console-spice.html
+++ /dev/null
@@ -1,199 +0,0 @@
-{% extends "console-base.html" %}
-{% load i18n %}
-{% load staticfiles %}
-{% block head %}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{% endblock %}
-
-{% block content %}
-
-{% endblock %}
-
-{% block foot %}
-
-{% endblock %}
diff --git a/console/templates/console-vnc-full.html b/console/templates/console-vnc-full.html
new file mode 100755
index 0000000..16d38f6
--- /dev/null
+++ b/console/templates/console-vnc-full.html
@@ -0,0 +1,323 @@
+{% extends "console-base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+
+{% block head %}
+
+ WebVirtCloud - noVNC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
noVNC encountered an error:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/console/templates/console-vnc-lite.html b/console/templates/console-vnc-lite.html
new file mode 100755
index 0000000..ad168cc
--- /dev/null
+++ b/console/templates/console-vnc-lite.html
@@ -0,0 +1,266 @@
+{% extends "console-base.html" %}
+{% load i18n %}
+{% load staticfiles %}
+{% block head %}
+
+ noVNC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
+{% endblock %}
+
+{% block foot %}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/console/templates/console-vnc.html b/console/templates/console-vnc.html
index c30850b..0d594e5 100644
--- a/console/templates/console-vnc.html
+++ b/console/templates/console-vnc.html
@@ -29,9 +29,9 @@
style="display: none;">
-{% endblock %}
-{% block foot %}
+
+
+ -->
+
+
+
+
+
+
+
+{% endblock %}
+
+{% block content %}
+
+
+
+
noVNC encountered an error:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/static/js/novnc/web-socket-js/README.txt b/static/js/novnc/web-socket-js/README.txt
deleted file mode 100644
index 2e32ea7..0000000
--- a/static/js/novnc/web-socket-js/README.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-* 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/static/js/novnc/web-socket-js/WebSocketMain.swf b/static/js/novnc/web-socket-js/WebSocketMain.swf
deleted file mode 100644
index 8174466..0000000
Binary files a/static/js/novnc/web-socket-js/WebSocketMain.swf and /dev/null differ
diff --git a/static/js/novnc/web-socket-js/swfobject.js b/static/js/novnc/web-socket-js/swfobject.js
deleted file mode 100644
index 8eafe9d..0000000
--- a/static/js/novnc/web-socket-js/swfobject.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/* SWFObject v2.2
- is released under the MIT License
-*/
-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;Y0){for(var af=0;af0){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'}}aa.outerHTML='";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){}return 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
-// License: New BSD License
-// Reference: http://dev.w3.org/html5/websockets/
-// Reference: http://tools.ietf.org/html/rfc6455
-
-(function() {
-
- if (window.WEB_SOCKET_FORCE_FLASH) {
- // Keeps going.
- } else if (window.WebSocket) {
- return;
- } else if (window.MozWebSocket) {
- // Firefox.
- window.WebSocket = MozWebSocket;
- return;
- }
-
- var logger;
- if (window.WEB_SOCKET_LOGGER) {
- logger = WEB_SOCKET_LOGGER;
- } else if (window.console && window.console.log && window.console.error) {
- // In some environment, console is defined but console.log or console.error is missing.
- logger = window.console;
- } else {
- logger = {log: function(){ }, error: function(){ }};
- }
-
- // swfobject.hasFlashPlayerVersion("10.0.0") doesn't work with Gnash.
- if (swfobject.getFlashPlayerVersion().major < 10) {
- logger.error("Flash Player >= 10.0.0 is required.");
- return;
- }
- if (location.protocol == "file:") {
- logger.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://...");
- }
-
- /**
- * Our own implementation of WebSocket class using Flash.
- * @param {string} url
- * @param {array or string} protocols
- * @param {string} proxyHost
- * @param {int} proxyPort
- * @param {string} headers
- */
- window.WebSocket = function(url, protocols, proxyHost, proxyPort, headers) {
- var self = this;
- self.__id = WebSocket.__nextId++;
- WebSocket.__instances[self.__id] = self;
- self.readyState = WebSocket.CONNECTING;
- self.bufferedAmount = 0;
- self.__events = {};
- if (!protocols) {
- protocols = [];
- } else if (typeof protocols == "string") {
- protocols = [protocols];
- }
- // Uses setTimeout() to make sure __createFlash() runs after the caller sets ws.onopen etc.
- // Otherwise, when onopen fires immediately, onopen is called before it is set.
- self.__createTask = setTimeout(function() {
- WebSocket.__addTask(function() {
- self.__createTask = null;
- WebSocket.__flash.create(
- self.__id, url, protocols, 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.__createTask) {
- clearTimeout(this.__createTask);
- this.__createTask = null;
- this.readyState = WebSocket.CLOSED;
- return;
- }
- if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
- return;
- }
- this.readyState = WebSocket.CLOSING;
- WebSocket.__flash.close(this.__id);
- };
-
- /**
- * Implementation of {@link DOM 2 EventTarget Interface}
- *
- * @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 DOM 2 EventTarget Interface}
- *
- * @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 DOM 2 EventTarget Interface}
- *
- * @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.apply(this, [event]);
- };
-
- /**
- * Handles an event from Flash.
- * @param {Object} flashEvent
- */
- WebSocket.prototype.__handleEvent = function(flashEvent) {
-
- if ("readyState" in flashEvent) {
- this.readyState = flashEvent.readyState;
- }
- if ("protocol" in flashEvent) {
- this.protocol = flashEvent.protocol;
- }
-
- var jsEvent;
- if (flashEvent.type == "open" || flashEvent.type == "error") {
- jsEvent = this.__createSimpleEvent(flashEvent.type);
- } else if (flashEvent.type == "close") {
- jsEvent = this.__createSimpleEvent("close");
- jsEvent.wasClean = flashEvent.wasClean ? true : false;
- jsEvent.code = flashEvent.code;
- jsEvent.reason = flashEvent.reason;
- } 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;
-
- // Field to check implementation of WebSocket.
- WebSocket.__isFlashImplementation = true;
- WebSocket.__initialized = false;
- 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.__initialized) return;
- WebSocket.__initialized = true;
-
- if (WebSocket.__swfLocation) {
- // For backword compatibility.
- window.WEB_SOCKET_SWF_LOCATION = WebSocket.__swfLocation;
- }
- if (!window.WEB_SOCKET_SWF_LOCATION) {
- logger.error("[WebSocket] set WEB_SOCKET_SWF_LOCATION to location of WebSocketMain.swf");
- return;
- }
- if (!window.WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR &&
- !WEB_SOCKET_SWF_LOCATION.match(/(^|\/)WebSocketMainInsecure\.swf(\?.*)?$/) &&
- WEB_SOCKET_SWF_LOCATION.match(/^\w+:\/\/([^\/]+)/)) {
- var swfHost = RegExp.$1;
- if (location.host != swfHost) {
- logger.error(
- "[WebSocket] You must host HTML and WebSocketMain.swf in the same host " +
- "('" + location.host + "' != '" + swfHost + "'). " +
- "See also 'How to host HTML file and SWF file in different domains' section " +
- "in README.md. If you use WebSocketMainInsecure.swf, you can suppress this message " +
- "by WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR = true;");
- }
- }
- var container = document.createElement("div");
- 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) {
- logger.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) {
- logger.error(e);
- }
- }, 0);
- return true;
- };
-
- // Called by Flash.
- WebSocket.__log = function(message) {
- logger.log(decodeURIComponent(message));
- };
-
- // Called by Flash.
- WebSocket.__error = function(message) {
- logger.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) {
- // NOTE:
- // This fires immediately if web_socket.js is dynamically loaded after
- // the document is loaded.
- swfobject.addDomLoadEvent(function() {
- WebSocket.__initialize();
- });
- }
-
-})();
diff --git a/static/js/novnc/websock.js b/static/js/novnc/websock.js
deleted file mode 100644
index 01a24c3..0000000
--- a/static/js/novnc/websock.js
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Websock: high-performance binary WebSockets
- * Copyright (C) 2012 Joel Martin
- * Licensed under MPL 2.0 (see LICENSE.txt)
- *
- * Websock is similar to the standard WebSocket object but 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 () {
- window.WEB_SOCKET_SWF_LOCATION = Util.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();
- }
- Util.load_scripts(["web-socket-js/swfobject.js",
- "web-socket-js/web_socket.js"]);
- }());
-}
-
-
-function Websock() {
-"use strict";
-
-var api = {}, // Public API
- websocket = null, // WebSocket object
- mode = 'base64', // Current WebSocket mode: 'binary', 'base64'
- 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 String.fromCharCode.apply(null, arr);
-}
-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() {
- if (mode === 'binary') {
- // Put in a binary arraybuffer
- return (new Uint8Array(sQ)).buffer;
- } else {
- // base64 encode
- return Base64.encode(sQ);
- }
-}
-
-function decode_message(data) {
- //Util.Debug(">> decode_message: " + data);
- if (mode === 'binary') {
- // push arraybuffer values onto the end
- var u8 = new Uint8Array(data);
- for (var i = 0; i < u8.length; i++) {
- rQ.push(u8[i]);
- }
- } else {
- // base64 decode and concat to the end
- 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(protocols) {
- rQ = [];
- rQi = 0;
- sQ = [];
- websocket = null;
-
- var bt = false,
- wsbt = false,
- try_binary = false;
-
- // Check for full typed array support
- if (('Uint8Array' in window) &&
- ('set' in Uint8Array.prototype)) {
- bt = true;
- }
-
- // Check for full binary type support in WebSockets
- // TODO: this sucks, the property should exist on the prototype
- // but it does not.
- try {
- if (bt && ('binaryType' in (new WebSocket("ws://localhost:17523")))) {
- Util.Info("Detected binaryType support in WebSockets");
- wsbt = true;
- }
- } catch (exc) {
- // Just ignore failed test localhost connections
- }
-
- // Default protocols if not specified
- if (typeof(protocols) === "undefined") {
- if (wsbt) {
- protocols = ['binary', 'base64'];
- } else {
- protocols = 'base64';
- }
- }
-
- // If no binary support, make sure it was not requested
- if (!wsbt) {
- if (protocols === 'binary') {
- throw("WebSocket binary sub-protocol requested but not supported");
- }
- if (typeof(protocols) === "object") {
- var new_protocols = [];
- for (var i = 0; i < protocols.length; i++) {
- if (protocols[i] === 'binary') {
- Util.Error("Skipping unsupported WebSocket binary sub-protocol");
- } else {
- new_protocols.push(protocols[i]);
- }
- }
- if (new_protocols.length > 0) {
- protocols = new_protocols;
- } else {
- throw("Only WebSocket binary sub-protocol was requested and not supported.");
- }
- }
- }
-
- return protocols;
-}
-
-function open(uri, protocols) {
- protocols = init(protocols);
-
- if (test_mode) {
- websocket = {};
- } else {
- websocket = new WebSocket(uri, protocols);
- if (protocols.indexOf('binary') >= 0) {
- websocket.binaryType = 'arraybuffer';
- }
- }
-
- websocket.onmessage = recv_message;
- websocket.onopen = function() {
- Util.Debug(">> WebSock.onopen");
- if (websocket.protocol) {
- mode = websocket.protocol;
- Util.Info("Server chose sub-protocol: " + websocket.protocol);
- } else {
- mode = 'base64';
- 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, data_mode) {
- test_mode = true;
- mode = data_mode;
- 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/static/js/novnc/webutil.js b/static/js/novnc/webutil.js
deleted file mode 100644
index ebf8e89..0000000
--- a/static/js/novnc/webutil.js
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * noVNC: HTML5 VNC client
- * Copyright (C) 2012 Joel Martin
- * Licensed under MPL 2.0 (see LICENSE.txt)
- *
- * See README.md for usage and integration instructions.
- */
-
-"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(level) {
- if (typeof level !== "undefined") {
- Util._log_level = level;
- } else {
- Util._log_level = (document.location.href.match(
- /logging=([A-Za-z0-9\._\-]*)/) ||
- ['', Util._log_level])[1];
- }
- Util.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 + '=([^]*)'),
- match = document.location.href.match(re);
- if (typeof defVal === 'undefined') { defVal = null; }
- if (match) {
- return decodeURIComponent(match[1]);
- } else {
- return defVal;
- }
-};
-
-
-/*
- * 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);
-};
-
-/*
- * Setting handling.
- */
-
-WebUtil.initSettings = function(callback) {
- var callbackArgs = Array.prototype.slice.call(arguments, 1);
- if (window.chrome && window.chrome.storage) {
- window.chrome.storage.sync.get(function (cfg) {
- WebUtil.settings = cfg;
- console.log(WebUtil.settings);
- if (callback) {
- callback.apply(this, callbackArgs);
- }
- });
- } else {
- // No-op
- if (callback) {
- callback.apply(this, callbackArgs);
- }
- }
-};
-
-// No days means only for this browser session
-WebUtil.writeSetting = function(name, value) {
- if (window.chrome && window.chrome.storage) {
- //console.log("writeSetting:", name, value);
- if (WebUtil.settings[name] !== value) {
- WebUtil.settings[name] = value;
- window.chrome.storage.sync.set(WebUtil.settings);
- }
- } else {
- localStorage.setItem(name, value);
- }
-};
-
-WebUtil.readSetting = function(name, defaultValue) {
- var value;
- if (window.chrome && window.chrome.storage) {
- value = WebUtil.settings[name];
- } else {
- value = localStorage.getItem(name);
- }
- if (typeof value === "undefined") {
- value = null;
- }
- if (value === null && typeof defaultValue !== undefined) {
- return defaultValue;
- } else {
- return value;
- }
-};
-
-WebUtil.eraseSetting = function(name) {
- if (window.chrome && window.chrome.storage) {
- window.chrome.storage.sync.remove(name);
- delete WebUtil.settings[name];
- } else {
- localStorage.removeItem(name);
- }
-};
-
-/*
- * 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;
-};