mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
novnc is updated to 1.0.0 and add console views: lite,full option
This commit is contained in:
parent
019d1523cd
commit
edb59947af
124 changed files with 32809 additions and 9005 deletions
|
|
@ -84,7 +84,7 @@
|
|||
<li onclick='sendCtrlAltFN(11);'><a href='#'>Ctrl+Alt+F12</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li onclick='fullscreen()'><a href='#'>{% trans "Fullscreen" %}</a></li>
|
||||
<li id="fullscreen_button"><a href='#'>{% trans "Fullscreen" %}</a></li>
|
||||
{% block navbarmenu %}{% endblock %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
|||
242
console/templates/console-spice-full.html
Normal file
242
console/templates/console-spice-full.html
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
<!--
|
||||
Copyright (C) 2012 by Jeremy P. White <jwhite@codeweavers.com>
|
||||
|
||||
This file is part of spice-html5.
|
||||
|
||||
spice-html5 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.
|
||||
|
||||
spice-html5 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 spice-html5. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
--------------------------------------------------
|
||||
Spice Javascript client template.
|
||||
Refer to main.js for more detailed information
|
||||
--------------------------------------------------
|
||||
|
||||
-->
|
||||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% block head %}
|
||||
|
||||
<title>WebVirtCloud - Spice Client - Full</title>
|
||||
<script src="{% static "js/spice-html5/spicearraybuffer.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/enums.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/atKeynames.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/utils.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/png.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/lz.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/quic.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/bitmap.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicedataview.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicetype.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicemsg.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/wire.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spiceconn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/display.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/port.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/main.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/inputs.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/webm.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/playback.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/simulatecursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/cursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/jsbn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rsa.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/prng4.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rng.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/sha1.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/ticket.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/resize.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/filexfer.js" %}"></script>
|
||||
<link rel="stylesheet" type="text/css" href="{% static "js/spice-html5/spice.css" %}" />
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="login">
|
||||
<span class="logo">SPICE</span>
|
||||
<label for="host">Host:</label> <input type='text' id='host' value='{{ ws_host }}'> <!-- localhost -->
|
||||
<label for="port">Port:</label> <input type='text' id='port' value='{{ ws_port }}'>
|
||||
<label for="password">Password:</label> <input type='password' id='password' value='{{ console_passwd }}'>
|
||||
<label for="show_console">Show console </label><input type="checkbox" id="show_console" value="1" onchange="toggle_console()" checked>
|
||||
<button id="connectButton" onclick="connect();">Start</button>
|
||||
</div>
|
||||
|
||||
<div id="spice-area">
|
||||
<div id="spice-screen" class="spice-screen"></div>
|
||||
</div>
|
||||
|
||||
<div id="message-div" class="spice-message"></div>
|
||||
|
||||
<div id="debug-div">
|
||||
<!-- If DUMPXXX is turned on, dumped images will go here -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
|
||||
<script>
|
||||
var host = null, port = null;
|
||||
var sc;
|
||||
|
||||
function spice_error(e)
|
||||
{
|
||||
disconnect();
|
||||
}
|
||||
|
||||
function connect()
|
||||
{
|
||||
var host, port, password, scheme = "ws://", uri;
|
||||
|
||||
host = document.getElementById("host").value;
|
||||
port = document.getElementById("port").value;
|
||||
password = document.getElementById("password").value;
|
||||
|
||||
|
||||
if ((!host) || (!port)) {
|
||||
console.log("must set host and port");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
|
||||
uri = scheme + host + ":" + port;
|
||||
|
||||
document.getElementById('connectButton').innerHTML = "Stop";
|
||||
document.getElementById('connectButton').onclick = disconnect;
|
||||
|
||||
try
|
||||
{
|
||||
sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div",
|
||||
message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected });
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert(e.toString());
|
||||
disconnect();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
console.log(">> disconnect");
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
document.getElementById('connectButton').innerHTML = "Start";
|
||||
document.getElementById('connectButton').onclick = connect;
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
var spice_xfer_area = document.getElementById('spice-xfer-area');
|
||||
document.getElementById('spice-area').removeChild(spice_xfer_area);
|
||||
document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').removeEventListener('drop', handle_file_drop, false);
|
||||
}
|
||||
console.log("<< disconnect");
|
||||
}
|
||||
|
||||
function agent_connected(sc)
|
||||
{
|
||||
window.addEventListener('resize', handle_resize);
|
||||
window.spice_connection = this;
|
||||
|
||||
resize_helper(this);
|
||||
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
var spice_xfer_area = document.createElement("div");
|
||||
spice_xfer_area.setAttribute('id', 'spice-xfer-area');
|
||||
document.getElementById('spice-area').appendChild(spice_xfer_area);
|
||||
document.getElementById('spice-area').addEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').addEventListener('drop', handle_file_drop, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("File API is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
function toggle_console()
|
||||
{
|
||||
var checkbox = document.getElementById('show_console');
|
||||
var m = document.getElementById('message-div');
|
||||
|
||||
if (checkbox.checked)
|
||||
{
|
||||
m.style.display = 'block';
|
||||
}
|
||||
else
|
||||
{
|
||||
m.style.display = 'none';
|
||||
}
|
||||
|
||||
window.addEventListener('resize', handle_resize);
|
||||
resize_helper(sc);
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
var screen=document.getElementById('spice-area');
|
||||
if(screen.requestFullscreen) {
|
||||
screen.requestFullscreen();
|
||||
} else if(screen.mozRequestFullScreen) {
|
||||
screen.mozRequestFullScreen();
|
||||
} else if(screen.webkitRequestFullscreen) {
|
||||
screen.webkitRequestFullscreen();
|
||||
} else if(screen.msRequestFullscreen) {
|
||||
screen.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
/* SPICE port event listeners
|
||||
window.addEventListener('spice-port-data', function(event) {
|
||||
// Here we convert data to text, but really we can obtain binary data also
|
||||
var msg_text = arraybuffer_to_str(new Uint8Array(event.detail.data));
|
||||
DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);
|
||||
});
|
||||
|
||||
window.addEventListener('spice-port-event', function(event) {
|
||||
DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);
|
||||
});
|
||||
*/
|
||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen;
|
||||
|
||||
connect();
|
||||
</script>
|
||||
{% endblock %}
|
||||
262
console/templates/console-spice-lite.html
Normal file
262
console/templates/console-spice-lite.html
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
<!--
|
||||
Copyright (C) 2012 by Jeremy P. White <jwhite@codeweavers.com>
|
||||
|
||||
This file is part of spice-html5.
|
||||
|
||||
spice-html5 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.
|
||||
|
||||
spice-html5 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 spice-html5. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
--------------------------------------------------
|
||||
Spice Javascript client template.
|
||||
Refer to main.js for more detailed information
|
||||
--------------------------------------------------
|
||||
|
||||
-->
|
||||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% block head %}
|
||||
|
||||
<title>Spice Javascript client</title>
|
||||
<script src="{% static "js/spice-html5/spicearraybuffer.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/enums.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/atKeynames.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/utils.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/png.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/lz.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/quic.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/bitmap.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicedataview.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicetype.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicemsg.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/wire.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spiceconn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/display.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/main.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/inputs.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/webm.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/playback.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/simulatecursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/cursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/jsbn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rsa.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/prng4.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rng.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/sha1.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/ticket.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/resize.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/filexfer.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/port.js" %}"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static "js/spice-html5/spice.css" %}" />
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div id="spice-area">
|
||||
<div id="spice-screen" class="spice-screen"></div>
|
||||
</div>
|
||||
|
||||
<div id="message-div" class="spice-message"></div>
|
||||
|
||||
<div id="debug-div">
|
||||
<!-- If DUMPXXX is turned on, dumped images will go here -->
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
<script>
|
||||
var host = null, port = null;
|
||||
var sc;
|
||||
|
||||
function spice_set_cookie(name, value, days) {
|
||||
var date, expires;
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
};
|
||||
|
||||
function spice_query_var(name, defvalue) {
|
||||
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
|
||||
return match ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : defvalue;
|
||||
}
|
||||
|
||||
function spice_error(e)
|
||||
{
|
||||
console.log(e);
|
||||
disconnect();
|
||||
if (e.message !== undefined) {
|
||||
log_error(e.message);
|
||||
}
|
||||
else {
|
||||
log_error('Unknown error');
|
||||
}
|
||||
}
|
||||
|
||||
function connect()
|
||||
{
|
||||
var host, port, password, scheme = "ws://", uri;
|
||||
|
||||
// By default, use the host and port of server that served this file
|
||||
//host = spice_query_var('host', window.location.hostname);
|
||||
host = '{{ ws_host| safe }}'| spice_query_var('host', window.location.hostname);
|
||||
|
||||
// Note that using the web server port only makes sense
|
||||
// if your web server has a reverse proxy to relay the WebSocket
|
||||
// traffic to the correct destination port.
|
||||
var default_port = window.location.port;
|
||||
if (!default_port) {
|
||||
if (window.location.protocol == 'http:') {
|
||||
default_port = 80;
|
||||
}
|
||||
else if (window.location.protocol == 'https:') {
|
||||
default_port = 443;
|
||||
}
|
||||
}
|
||||
//port = spice_query_var('port', default_port);
|
||||
port = '{{ ws_port| safe }}' | spice_query_var('port', default_port);
|
||||
if (window.location.protocol == 'https:') {
|
||||
scheme = "wss://";
|
||||
}
|
||||
|
||||
// If a token variable is passed in, set the parameter in a cookie.
|
||||
// This is used by nova-spiceproxy.
|
||||
token = spice_query_var('token', null);
|
||||
if (token) {
|
||||
spice_set_cookie('token', token, 1)
|
||||
}
|
||||
|
||||
//password = spice_query_var('password', '');
|
||||
password = '{{ console_passwd | safe }}' | spice_query_var('password', '');
|
||||
path = spice_query_var('path', 'websockify');
|
||||
|
||||
if ((!host) || (!port)) {
|
||||
console.log("must specify host and port in URL");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
|
||||
uri = scheme + host + ":" + port;
|
||||
|
||||
if (path) {
|
||||
uri += path[0] == '/' ? path : ('/' + path);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sc = new SpiceMainConn({uri: uri, screen_id: "spice-screen", dump_id: "debug-div",
|
||||
message_id: "message-div", password: password, onerror: spice_error, onagent: agent_connected });
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
alert(e.toString());
|
||||
disconnect();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
console.log(">> disconnect");
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
var spice_xfer_area = document.getElementById('spice-xfer-area');
|
||||
document.getElementById('spice-area').removeChild(spice_xfer_area);
|
||||
document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').removeEventListener('drop', handle_file_drop, false);
|
||||
}
|
||||
console.log("<< disconnect");
|
||||
}
|
||||
|
||||
function agent_connected(sc)
|
||||
{
|
||||
window.addEventListener('resize', handle_resize);
|
||||
window.spice_connection = this;
|
||||
|
||||
resize_helper(this);
|
||||
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
var spice_xfer_area = document.createElement("div");
|
||||
spice_xfer_area.setAttribute('id', 'spice-xfer-area');
|
||||
document.getElementById('spice-area').appendChild(spice_xfer_area);
|
||||
document.getElementById('spice-area').addEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').addEventListener('drop', handle_file_drop, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("File API is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
var screen=document.getElementById('spice-area');
|
||||
if(screen.requestFullscreen) {
|
||||
screen.requestFullscreen();
|
||||
} else if(screen.mozRequestFullScreen) {
|
||||
screen.mozRequestFullScreen();
|
||||
} else if(screen.webkitRequestFullscreen) {
|
||||
screen.webkitRequestFullscreen();
|
||||
} else if(screen.msRequestFullscreen) {
|
||||
screen.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
/* SPICE port event listeners
|
||||
window.addEventListener('spice-port-data', function(event) {
|
||||
// Here we convert data to text, but really we can obtain binary data also
|
||||
var msg_text = arraybuffer_to_str(new Uint8Array(event.detail.data));
|
||||
DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'message text:', msg_text);
|
||||
});
|
||||
|
||||
window.addEventListener('spice-port-event', function(event) {
|
||||
DEBUG > 0 && console.log('SPICE port', event.detail.channel.portName, 'event data:', event.detail.spiceEvent);
|
||||
});
|
||||
*/
|
||||
document.getElementById("fullscreen_button").addEventListener('click', fullscreen);
|
||||
connect();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
@ -1,199 +0,0 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% block head %}
|
||||
<script src="{% static "js/spice-html5/spicearraybuffer.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/enums.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/atKeynames.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/utils.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/png.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/lz.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/quic.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/bitmap.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicedataview.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicetype.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spicemsg.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/wire.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/spiceconn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/display.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/main.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/inputs.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/webm.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/playback.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/simulatecursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/cursor.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/jsbn.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rsa.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/prng4.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/rng.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/thirdparty/sha1.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/ticket.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/resize.js" %}"></script>
|
||||
<script src="{% static "js/spice-html5/filexfer.js" %}"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static "js/spice-html5/spice.css" %}" />
|
||||
<script src="{% static "js/spice-html5/port.js" %}"></script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div id='spice_container'></div>
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
<script>
|
||||
var sc;
|
||||
|
||||
function spice_set_cookie(name, value, days) {
|
||||
var date, expires;
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
};
|
||||
|
||||
function spice_query_var(name, defvalue) {
|
||||
var match = RegExp('[?&]' + name + '=([^&]*)')
|
||||
.exec(window.location.search);
|
||||
return match ?
|
||||
decodeURIComponent(match[1].replace(/\+/g, ' '))
|
||||
: defvalue;
|
||||
}
|
||||
|
||||
function spice_error(e)
|
||||
{
|
||||
console.log(e);
|
||||
disconnect();
|
||||
if (e.message !== undefined) {
|
||||
log_error(e.message);
|
||||
}
|
||||
else {
|
||||
log_error('Unknown error');
|
||||
}
|
||||
}
|
||||
|
||||
function spice_success(msg) {
|
||||
log_info(msg);
|
||||
}
|
||||
|
||||
|
||||
function connect(uri,password)
|
||||
{
|
||||
// If a token variable is passed in, set the parameter in a cookie.
|
||||
// This is used by nova-spiceproxy.
|
||||
token = spice_query_var('token', null);
|
||||
if (token) {
|
||||
spice_set_cookie('token', token, 1)
|
||||
}
|
||||
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
sc = new SpiceMainConn({uri: uri, password: password, screen_id: "spice_container",
|
||||
onsuccess: spice_success, onerror: spice_error, onagent: agent_connected });
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
console.log(e);
|
||||
log_error(e.toString());
|
||||
disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function disconnect()
|
||||
{
|
||||
console.log(">> disconnect");
|
||||
if (sc) {
|
||||
sc.stop();
|
||||
}
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
console.log(" -> Disable drag/drop transfer");
|
||||
var spice_xfer_area = document.getElementById('spice-xfer-area');
|
||||
try {
|
||||
document.getElementById('spice-area').removeChild(spice_xfer_area);
|
||||
document.getElementById('spice-area').removeEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').removeEventListener('drop', handle_file_drop, false);
|
||||
}
|
||||
catch(e) {
|
||||
console.log(' -> Error disabling drag/drop transfer');
|
||||
}
|
||||
}
|
||||
console.log("<< disconnect");
|
||||
}
|
||||
|
||||
function agent_connected(sc) {
|
||||
window.addEventListener('resize', handle_resize);
|
||||
window.spice_connection = this;
|
||||
|
||||
resize_helper(this);
|
||||
|
||||
if (window.File && window.FileReader && window.FileList && window.Blob)
|
||||
{
|
||||
var spice_xfer_area = document.createElement("div");
|
||||
spice_xfer_area.setAttribute('id', 'spice-xfer-area');
|
||||
document.getElementById('spice-area').addEventListener('dragover', handle_file_dragover, false);
|
||||
document.getElementById('spice-area').addEventListener('drop', handle_file_drop, false);
|
||||
log_info('Drag and drop transfer enabled.');
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log("File API is not supported");
|
||||
log_info('Drag and drop transfer not supported.');
|
||||
}
|
||||
}
|
||||
|
||||
function sendCtrlAltFN(f) {
|
||||
if (sc && sc.inputs && sc.inputs.state === "ready"){
|
||||
var keys_code=[KEY_F1,KEY_F2,KEY_F3,KEY_F4,KEY_F5,KEY_F6,KEY_F7,KEY_F8,KEY_F9,KEY_F10,KEY_F11,KEY_F12];
|
||||
|
||||
if (keys_code[f]==undefined) {
|
||||
return;
|
||||
}
|
||||
var key = new SpiceMsgcKeyDown();
|
||||
var msg = new SpiceMiniData();
|
||||
|
||||
update_modifier(true, KEY_LCtrl, sc);
|
||||
update_modifier(true, KEY_Alt, sc);
|
||||
|
||||
key.code = keys_code[f];
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_DOWN, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
msg.build_msg(SPICE_MSGC_INPUTS_KEY_UP, key);
|
||||
sc.inputs.send_msg(msg);
|
||||
|
||||
if(Ctrl_state == false) update_modifier(false, KEY_LCtrl, sc);
|
||||
if(Alt_state == false) update_modifier(false, KEY_Alt, sc);
|
||||
}
|
||||
}
|
||||
|
||||
function fullscreen() {
|
||||
var screen=document.getElementById('spice_container');
|
||||
if(screen.requestFullscreen) {
|
||||
screen.requestFullscreen();
|
||||
} else if(screen.mozRequestFullScreen) {
|
||||
screen.mozRequestFullScreen();
|
||||
} else if(screen.webkitRequestFullscreen) {
|
||||
screen.webkitRequestFullscreen();
|
||||
} else if(screen.msRequestFullscreen) {
|
||||
screen.msRequestFullscreen();
|
||||
}
|
||||
}
|
||||
|
||||
var uri;
|
||||
if (window.location.protocol === "https:") {
|
||||
uri = 'wss://{{ ws_host }}:{{ ws_port }}';
|
||||
} else {
|
||||
uri = 'ws://{{ ws_host }}:{{ ws_port }}';
|
||||
}
|
||||
|
||||
var password = '{{ console_passwd }}';
|
||||
log_info('Connecting ...');
|
||||
connect(uri,password);
|
||||
</script>
|
||||
{% endblock %}
|
||||
323
console/templates/console-vnc-full.html
Executable file
323
console/templates/console-vnc-full.html
Executable file
|
|
@ -0,0 +1,323 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
|
||||
{% block head %}
|
||||
<!--
|
||||
noVNC example: simple example using default UI
|
||||
Copyright (C) 2012 Joel Martin
|
||||
Copyright (C) 2016 Samuel Mannehed for Cendio AB
|
||||
Copyright (C) 2016 Pierre Ossman for Cendio AB
|
||||
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
|
||||
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
|
||||
|
||||
Connect parameters are provided in query string:
|
||||
http://example.com/?host=HOST&port=PORT&encrypt=1
|
||||
or the fragment:
|
||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
||||
-->
|
||||
<title xmlns="http://www.w3.org/1999/html">WebVirtCloud - noVNC</title>
|
||||
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
|
||||
<!-- Icons (see Makefile for what the sizes are for) -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
<link rel="icon" sizes="24x24" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-24x24.png" %}">
|
||||
<link rel="icon" sizes="32x32" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-32x32.png" %}">
|
||||
<link rel="icon" sizes="48x48" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-48x48.png" %}">
|
||||
<link rel="icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="icon" sizes="64x64" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-64x64.png" %}">
|
||||
<link rel="icon" sizes="72x72" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-72x72.png" %}">
|
||||
<link rel="icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="icon" sizes="96x96" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-96x96.png" %}">
|
||||
<link rel="icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="icon" sizes="144x144" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-144x144.png" %}">
|
||||
<link rel="icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
<link rel="icon" sizes="192x192" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-192x192.png" %}">
|
||||
<!-- Firefox currently mishandles SVG, see #1419039
|
||||
<link rel="icon" sizes="any" type="image/svg+xml" href="{% static "js/novnc/app/images/icons/novnc-icon.svg" %}">
|
||||
-->
|
||||
<!-- Repeated last so that legacy handling will pick this -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
|
||||
<!-- Apple iOS Safari settings -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<!-- Home Screen Icons (favourites and bookmarks use the normal icons) -->
|
||||
<link rel="apple-touch-icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
|
||||
<!-- Stylesheets -->
|
||||
<link rel="stylesheet" href="{% static "js/novnc/app/styles/base.css" %}"/>
|
||||
|
||||
<!--
|
||||
<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
||||
-->
|
||||
|
||||
<!-- this is included as a normal file in order to catch script-loading errors as well -->
|
||||
<script type="text/javascript" src="{% static "js/novnc/app/error-handler.js" %}"></script>
|
||||
|
||||
<!-- begin scripts -->
|
||||
<script src="{% static "js/novnc/app.js" %}"></script>
|
||||
<!-- end scripts -->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="noVNC_fallback_error" class="noVNC_center">
|
||||
<div>
|
||||
<div>noVNC encountered an error:</div>
|
||||
<br>
|
||||
<div id="noVNC_fallback_errormsg"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- noVNC Control Bar -->
|
||||
<div id="noVNC_control_bar_anchor" class="noVNC_vcenter">
|
||||
|
||||
<div id="noVNC_control_bar">
|
||||
<div id="noVNC_control_bar_handle" title="Hide/Show the control bar"><div></div></div>
|
||||
|
||||
<div class="noVNC_scroll">
|
||||
|
||||
<h1 class="noVNC_logo" translate="no"><span>no</span><br />VNC</h1>
|
||||
|
||||
<!-- Drag/Pan the viewport -->
|
||||
<input type="image" alt="viewport drag" src="{% static "js/novnc/app/images/drag.svg" %}"
|
||||
id="noVNC_view_drag_button" class="noVNC_button noVNC_hidden"
|
||||
title="Move/Drag Viewport" />
|
||||
|
||||
<!--noVNC Touch Device only buttons-->
|
||||
<div id="noVNC_mobile_buttons">
|
||||
<input type="image" alt="No mousebutton" src="{% static "js/novnc/app/images/mouse_none.svg" %}"
|
||||
id="noVNC_mouse_button0" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Left mousebutton" src="{% static "js/novnc/app/images/mouse_left.svg" %}"
|
||||
id="noVNC_mouse_button1" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Middle mousebutton" src="{% static "js/novnc/app/images/mouse_middle.svg" %}"
|
||||
id="noVNC_mouse_button2" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Right mousebutton" src="{% static "js/novnc/app/images/mouse_right.svg" %}"
|
||||
id="noVNC_mouse_button4" class="noVNC_button"
|
||||
title="Active Mouse Button"/>
|
||||
<input type="image" alt="Keyboard" src="{% static "js/novnc/app/images/keyboard.svg" %}"
|
||||
id="noVNC_keyboard_button" class="noVNC_button"
|
||||
value="Keyboard" title="Show Keyboard" />
|
||||
</div>
|
||||
|
||||
<!-- Extra manual keys -->
|
||||
<div id="noVNC_extra_keys">
|
||||
<input type="image" alt="Extra keys" src="{% static "js/novnc/app/images/toggleextrakeys.svg" %}"
|
||||
id="noVNC_toggle_extra_keys_button" class="noVNC_button"
|
||||
title="Show Extra Keys"/>
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_modifiers" class="noVNC_panel">
|
||||
<input type="image" alt="Ctrl" src="{% static "js/novnc/app/images/ctrl.svg" %}"
|
||||
id="noVNC_toggle_ctrl_button" class="noVNC_button"
|
||||
title="Toggle Ctrl"/>
|
||||
<input type="image" alt="Alt" src="{% static "js/novnc/app/images/alt.svg" %}"
|
||||
id="noVNC_toggle_alt_button" class="noVNC_button"
|
||||
title="Toggle Alt"/>
|
||||
<input type="image" alt="Tab" src="{% static "js/novnc/app/images/tab.svg" %}"
|
||||
id="noVNC_send_tab_button" class="noVNC_button"
|
||||
title="Send Tab"/>
|
||||
<input type="image" alt="Esc" src="{% static "js/novnc/app/images/esc.svg" %}"
|
||||
id="noVNC_send_esc_button" class="noVNC_button"
|
||||
title="Send Escape"/>
|
||||
<input type="image" alt="Ctrl+Alt+Del" src="{% static "js/novnc/app/images/ctrlaltdel.svg" %}"
|
||||
id="noVNC_send_ctrl_alt_del_button" class="noVNC_button"
|
||||
title="Send Ctrl-Alt-Del" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shutdown/Reboot -->
|
||||
<input type="image" alt="Shutdown/Reboot" src="{% static "js/novnc/app/images/power.svg" %}"
|
||||
id="noVNC_power_button" class="noVNC_button"
|
||||
title="Shutdown/Reboot..." />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_power" class="noVNC_panel">
|
||||
<div class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/power.svg" %}"> Power
|
||||
</div>
|
||||
<input type="button" id="noVNC_shutdown_button" value="Shutdown" />
|
||||
<input type="button" id="noVNC_reboot_button" value="Reboot" />
|
||||
<input type="button" id="noVNC_reset_button" value="Reset" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Clipboard -->
|
||||
<input type="image" alt="Clipboard" src="{% static "js/novnc/app/images/clipboard.svg" %}"
|
||||
id="noVNC_clipboard_button" class="noVNC_button"
|
||||
title="Clipboard" />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_clipboard" class="noVNC_panel">
|
||||
<div class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/clipboard.svg" %}"> Clipboard
|
||||
</div>
|
||||
<textarea id="noVNC_clipboard_text" rows=5></textarea>
|
||||
<br />
|
||||
<input id="noVNC_clipboard_clear_button" type="button"
|
||||
value="Clear" class="noVNC_submit" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toggle fullscreen -->
|
||||
<input type="image" alt="Fullscreen" src="{% static "js/novnc/app/images/fullscreen.svg" %}"
|
||||
id="noVNC_fullscreen_button" class="noVNC_button noVNC_hidden"
|
||||
title="Fullscreen" />
|
||||
|
||||
<!-- Settings -->
|
||||
<input type="image" alt="Settings" src="{% static "js/novnc/app/images/settings.svg" %}"
|
||||
id="noVNC_settings_button" class="noVNC_button"
|
||||
title="Settings" />
|
||||
<div class="noVNC_vcenter">
|
||||
<div id="noVNC_settings" class="noVNC_panel">
|
||||
<ul>
|
||||
<li class="noVNC_heading">
|
||||
<img src="{% static "js/novnc/app/images/settings.svg" %}"> Settings
|
||||
</li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_shared" type="checkbox" /> Shared Mode</label>
|
||||
</li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_view_only" type="checkbox" /> View Only</label>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_view_clip" type="checkbox" /> Clip to Window</label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_resize">Scaling Mode:</label>
|
||||
<select id="noVNC_setting_resize" name="vncResize">
|
||||
<option value="off">None</option>
|
||||
<option value="scale">Local Scaling</option>
|
||||
<option value="remote">Remote Resizing</option>
|
||||
</select>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<div class="noVNC_expander">Advanced</div>
|
||||
<div><ul>
|
||||
<li>
|
||||
<label for="noVNC_setting_repeaterID">Repeater ID:</label>
|
||||
<input id="noVNC_setting_repeaterID" type="input" value="" />
|
||||
</li>
|
||||
<li>
|
||||
<div class="noVNC_expander">WebSocket</div>
|
||||
<div><ul>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_encrypt" type="checkbox" /> Encrypt</label>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_host">Host:</label>
|
||||
<input id="noVNC_setting_host" value="{{ ws_host }}"/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_port">Port:</label>
|
||||
<input id="noVNC_setting_port" value="{{ ws_port }}" type="number" />
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_path">Path:</label>
|
||||
<input id="noVNC_setting_path" type="input" value="websockify" />
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<li>
|
||||
<label><input id="noVNC_setting_reconnect" type="checkbox" /> Automatic Reconnect</label>
|
||||
<input id="noVNC_setting_autoconnect" type="checkbox" value="true" hidden/>
|
||||
</li>
|
||||
<li>
|
||||
<label for="noVNC_setting_reconnect_delay">Reconnect Delay (ms):</label>
|
||||
<input id="noVNC_setting_reconnect_delay" type="number" />
|
||||
</li>
|
||||
<li><hr></li>
|
||||
<!-- Logging selection dropdown -->
|
||||
<li>
|
||||
<label>Logging:
|
||||
<select id="noVNC_setting_logging" name="vncLogging">
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
</ul></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Connection Controls -->
|
||||
<input type="image" alt="Disconnect" src="{% static "js/novnc/app/images/disconnect.svg" %}"
|
||||
id="noVNC_disconnect_button" class="noVNC_button"
|
||||
title="Disconnect" />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="noVNC_control_bar_hint"></div>
|
||||
|
||||
</div> <!-- End of noVNC_control_bar -->
|
||||
|
||||
<!-- Status Dialog -->
|
||||
<div id="noVNC_status"></div>
|
||||
|
||||
<!-- Connect button -->
|
||||
<div class="noVNC_center">
|
||||
<div id="noVNC_connect_dlg">
|
||||
<div class="noVNC_logo" translate="no"><span>no</span>VNC</div>
|
||||
<div id="noVNC_connect_button">
|
||||
<div>
|
||||
<img src="{% static "js/novnc/app/images/connect.svg" %}"> Connect
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Password Dialog -->
|
||||
<div class="noVNC_center noVNC_connect_layer">
|
||||
<div id="noVNC_password_dlg" class="noVNC_panel"><form>
|
||||
<ul>
|
||||
<li>
|
||||
<label>Password:</label>
|
||||
<input id="noVNC_password_input" type="password" />
|
||||
</li>
|
||||
<li>
|
||||
<input id="noVNC_password_button" type="submit" value="Send Password" class="noVNC_submit" />
|
||||
</li>
|
||||
</ul>
|
||||
</form></div>
|
||||
</div>
|
||||
|
||||
<!-- Transition Screens -->
|
||||
<div id="noVNC_transition">
|
||||
<div id="noVNC_transition_text"></div>
|
||||
<div>
|
||||
<input type="button" id="noVNC_cancel_reconnect_button" value="Cancel" class="noVNC_submit" />
|
||||
</div>
|
||||
<div class="noVNC_spinner"></div>
|
||||
</div>
|
||||
|
||||
<!-- This is where the RFB elements will attach -->
|
||||
<div id="noVNC_container">
|
||||
<!-- Note that Google Chrome on Android doesn't respect any of these,
|
||||
html attributes which attempt to disable text suggestions on the
|
||||
on-screen keyboard. Let's hope Chrome implements the ime-mode
|
||||
style for example -->
|
||||
<textarea id="noVNC_keyboardinput" autocapitalize="off"
|
||||
autocorrect="off" autocomplete="off" spellcheck="false"
|
||||
mozactionhint="Enter" tabindex="-1"></textarea>
|
||||
</div>
|
||||
|
||||
<audio id="noVNC_bell">
|
||||
<source src="{% static "js/novnc/app/sounds/bell.oga" %}" type="audio/ogg">
|
||||
<source src="{% static "js/novnc/app/sounds/bell.mp3" %}" type="audio/mpeg">
|
||||
</audio>
|
||||
{% endblock %}
|
||||
266
console/templates/console-vnc-lite.html
Executable file
266
console/templates/console-vnc-lite.html
Executable file
|
|
@ -0,0 +1,266 @@
|
|||
{% extends "console-base.html" %}
|
||||
{% load i18n %}
|
||||
{% load staticfiles %}
|
||||
{% block head %}
|
||||
<!--
|
||||
noVNC example: lightweight example using minimal UI and features
|
||||
Copyright (C) 2012 Joel Martin
|
||||
Copyright (C) 2017 Samuel Mannehed for Cendio AB
|
||||
noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
|
||||
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
|
||||
|
||||
Connect parameters are provided in query string:
|
||||
http://example.com/?host=HOST&port=PORT&encrypt=1
|
||||
or the fragment:
|
||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
||||
-->
|
||||
<title>noVNC</title>
|
||||
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
|
||||
<!-- Icons (see Makefile for what the sizes are for) -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
<link rel="icon" sizes="24x24" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-24x24.png" %}">
|
||||
<link rel="icon" sizes="32x32" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-32x32.png" %}">
|
||||
<link rel="icon" sizes="48x48" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-48x48.png" %}">
|
||||
<link rel="icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="icon" sizes="64x64" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-64x64.png" %}">
|
||||
<link rel="icon" sizes="72x72" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-72x72.png" %}">
|
||||
<link rel="icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="icon" sizes="96x96" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-96x96.png" %}">
|
||||
<link rel="icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="icon" sizes="144x144" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-144x144.png" %}">
|
||||
<link rel="icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
<link rel="icon" sizes="192x192" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-192x192.png" %}">
|
||||
<!-- Firefox currently mishandles SVG, see #1419039
|
||||
<link rel="icon" sizes="any" type="image/svg+xml" href="{% static "js/novnc/app/images/icons/novnc-icon.svg" %}">
|
||||
-->
|
||||
<!-- Repeated last so that legacy handling will pick this -->
|
||||
<link rel="icon" sizes="16x16" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-16x16.png" %}">
|
||||
|
||||
<!-- Apple iOS Safari settings -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<!-- Home Screen Icons (favourites and bookmarks use the normal icons) -->
|
||||
<link rel="apple-touch-icon" sizes="60x60" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-60x60.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="76x76" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-76x76.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="120x120" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-120x120.png" %}">
|
||||
<link rel="apple-touch-icon" sizes="152x152" type="image/png" href="{% static "js/novnc/app/images/icons/novnc-152x152.png" %}">
|
||||
|
||||
<!-- Stylesheets -->
|
||||
<link rel="stylesheet" href="{% static "js/novnc/app/styles/lite.css" %}">
|
||||
|
||||
<!--
|
||||
<script type='text/javascript'
|
||||
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
|
||||
-->
|
||||
|
||||
<!-- promise polyfills promises for IE11 -->
|
||||
<script src="{% static "js/novnc/vendor/promise.js" %}"></script>
|
||||
<!-- ES2015/ES6 modules polyfill -->
|
||||
<script type="module">
|
||||
window._noVNC_has_module_support = true;
|
||||
</script>
|
||||
<script>
|
||||
window.addEventListener("load", function() {
|
||||
if (window._noVNC_has_module_support) return;
|
||||
var loader = document.createElement("script");
|
||||
loader.src = "{% static "js/novnc/vendor/browser-es-module-loader/dist/browser-es-module-loader.js" %}";
|
||||
document.head.appendChild(loader);
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="noVNC_status_bar">
|
||||
<div id="noVNC_left_dummy_elem"></div>
|
||||
<div id="noVNC_status">Loading</div>
|
||||
<div id="noVNC_buttons">
|
||||
<input type=button value="Send CtrlAltDel" id="sendCtrlAltDelButton" class="noVNC_shown">
|
||||
<span id="noVNC_power_buttons" class="noVNC_hidden">
|
||||
<input type=button value="Shutdown" id="machineShutdownButton">
|
||||
<input type=button value="Reboot" id="machineRebootButton">
|
||||
<input type=button value="Reset" id="machineResetButton">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id='vnc_container'></div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
<!-- actual script modules -->
|
||||
<script type="module" crossorigin="anonymous">
|
||||
// Load supporting scripts
|
||||
import * as WebUtil from '{% static "js/novnc/app/webutil.js" %}';
|
||||
import RFB from '{% static "js/novnc/core/rfb.js" %}';
|
||||
|
||||
var rfb;
|
||||
var desktopName;
|
||||
|
||||
function updateDesktopName(e) {
|
||||
desktopName = e.detail.name;
|
||||
}
|
||||
function credentials(e) {
|
||||
var html;
|
||||
|
||||
var form = document.createElement('form');
|
||||
form.innerHTML = '<label></label>';
|
||||
form.innerHTML += '<input type=password size=10 id="password_input">';
|
||||
form.onsubmit = setPassword;
|
||||
|
||||
// bypass status() because it sets text content
|
||||
document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
|
||||
document.getElementById('noVNC_status').innerHTML = '';
|
||||
document.getElementById('noVNC_status').appendChild(form);
|
||||
document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: ';
|
||||
}
|
||||
function setPassword() {
|
||||
rfb.sendCredentials({ password: document.getElementById('password_input').value });
|
||||
return false;
|
||||
}
|
||||
function sendCtrlAltDel() {
|
||||
rfb.sendCtrlAltDel();
|
||||
return false;
|
||||
}
|
||||
function machineShutdown() {
|
||||
rfb.machineShutdown();
|
||||
return false;
|
||||
}
|
||||
function machineReboot() {
|
||||
rfb.machineReboot();
|
||||
return false;
|
||||
}
|
||||
function machineReset() {
|
||||
rfb.machineReset();
|
||||
return false;
|
||||
}
|
||||
function status(text, level) {
|
||||
switch (level) {
|
||||
case 'normal':
|
||||
case 'warn':
|
||||
case 'error':
|
||||
break;
|
||||
default:
|
||||
level = "warn";
|
||||
}
|
||||
document.getElementById('noVNC_status_bar').className = "noVNC_status_" + level;
|
||||
document.getElementById('noVNC_status').textContent = text;
|
||||
}
|
||||
|
||||
function connected(e) {
|
||||
document.getElementById('sendCtrlAltDelButton').disabled = false;
|
||||
if (WebUtil.getConfigVar('encrypt', (window.location.protocol === "https:"))) {
|
||||
status("Connected (encrypted) to " + desktopName, "normal");
|
||||
} else {
|
||||
status("Connected (unencrypted) to " + desktopName, "normal");
|
||||
}
|
||||
}
|
||||
|
||||
function disconnected(e) {
|
||||
document.getElementById('sendCtrlAltDelButton').disabled = true;
|
||||
updatePowerButtons();
|
||||
if (e.detail.clean) {
|
||||
status("Disconnected", "normal");
|
||||
} else {
|
||||
status("Something went wrong, connection is closed", "error");
|
||||
}
|
||||
}
|
||||
|
||||
function updatePowerButtons() {
|
||||
var powerbuttons;
|
||||
powerbuttons = document.getElementById('noVNC_power_buttons');
|
||||
if (rfb.capabilities.power) {
|
||||
powerbuttons.className= "noVNC_shown";
|
||||
} else {
|
||||
powerbuttons.className = "noVNC_hidden";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
||||
document.getElementById('machineShutdownButton').onclick = machineShutdown;
|
||||
document.getElementById('machineRebootButton').onclick = machineReboot;
|
||||
document.getElementById('machineResetButton').onclick = machineReset;
|
||||
|
||||
WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
|
||||
document.title = WebUtil.getConfigVar('title', 'noVNC');
|
||||
// By default, use the host and port of server that served this file
|
||||
//var host = WebUtil.getConfigVar('host', window.location.hostname);
|
||||
//var port = WebUtil.getConfigVar('port', window.location.port);
|
||||
var host = '{{ ws_host }}';
|
||||
var port = '{{ ws_port }}';
|
||||
|
||||
// if port == 80 (or 443) then it won't be present and should be
|
||||
// set manually
|
||||
if (!port) {
|
||||
if (window.location.protocol.substring(0,5) == 'https') {
|
||||
port = 443;
|
||||
}
|
||||
else if (window.location.protocol.substring(0,4) == 'http') {
|
||||
port = 80;
|
||||
}
|
||||
}
|
||||
|
||||
//var password = WebUtil.getConfigVar('password', '');
|
||||
var password = '{{ console_passwd }}';
|
||||
|
||||
var path = WebUtil.getConfigVar('path', 'websockify');
|
||||
|
||||
// If a token variable is passed in, set the parameter in a cookie.
|
||||
// This is used by nova-novncproxy.
|
||||
var token = WebUtil.getConfigVar('token', null);
|
||||
if (token) {
|
||||
// if token is already present in the path we should use it
|
||||
path = WebUtil.injectParamIfMissing(path, "token", token);
|
||||
|
||||
WebUtil.createCookie('token', token, 1)
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
status("Connecting", "normal");
|
||||
|
||||
if ((!host) || (!port)) {
|
||||
status('Must specify host and port in URL', 'error');
|
||||
}
|
||||
|
||||
var url;
|
||||
|
||||
if (WebUtil.getConfigVar('encrypt', (window.location.protocol === "https:"))) {
|
||||
url = 'wss';
|
||||
} else {
|
||||
url = 'ws';
|
||||
}
|
||||
|
||||
url += '://' + host;
|
||||
if(port) {
|
||||
url += ':' + port;
|
||||
}
|
||||
url += '/' + path;
|
||||
|
||||
// rfb = new RFB(document.body, url,
|
||||
// { repeaterID: WebUtil.getConfigVar('repeaterID', ''),
|
||||
// shared: WebUtil.getConfigVar('shared', true),
|
||||
// credentials: { password: password } });
|
||||
rfb = new RFB(document.getElementById('vnc_container'), url,
|
||||
{ repeaterID: WebUtil.getConfigVar('repeaterID', ''),
|
||||
shared: WebUtil.getConfigVar('shared', true),
|
||||
credentials: { password: password } });
|
||||
|
||||
rfb.viewOnly = WebUtil.getConfigVar('view_only', false);
|
||||
rfb.addEventListener("connect", connected);
|
||||
rfb.addEventListener("disconnect", disconnected);
|
||||
rfb.addEventListener("capabilities", function () { updatePowerButtons(); });
|
||||
rfb.addEventListener("credentialsrequired", credentials);
|
||||
rfb.addEventListener("desktopname", updateDesktopName);
|
||||
rfb.scaleViewport = WebUtil.getConfigVar('scale', false);
|
||||
rfb.resizeSession = WebUtil.getConfigVar('resize', false);
|
||||
})();
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
|
@ -29,9 +29,9 @@
|
|||
style="display: none;">
|
||||
</textarea>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block foot %}
|
||||
|
||||
|
||||
<script>
|
||||
/*jslint white: false */
|
||||
/*global window, $, Util, RFB, */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue