]> git.proxmox.com Git - novnc-pve.git/blame - vnc_pve.html
add html template for pve
[novnc-pve.git] / vnc_pve.html
CommitLineData
0e8bc41f
DM
1<!DOCTYPE html>
2<html>
3<head>
4 <title>noVNC</title>
5
6 <meta charset="utf-8">
7 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
8
9 <!-- Apple iOS Safari settings -->
10 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
11 <meta name="apple-mobile-web-app-capable" content="yes" />
12 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
13 <!-- App Start Icon -->
14 <link rel="apple-touch-startup-image" href="images/screen_320x460.png" />
15 <!-- For iOS devices set the icon to use if user bookmarks app on their homescreen -->
16 <link rel="apple-touch-icon" href="images/screen_57x57.png">
17
18 <!-- Stylesheets -->
19 <link rel="stylesheet" href="include/base.css" title="plain">
20
21 <script src="include/util.js"></script>
22</head>
23
24<body style="margin: 0px;">
25 <div id="noVNC_screen">
26 <div id="noVNC_status_bar" class="noVNC_status_bar" style="margin-top: 0px; visibility: hidden; position: absolute;">
27 <table border=0 width="100%"><tr>
28 <td><div id="noVNC_status" style="position: relative; height: auto;">
29 Loading
30 </div></td>
31 <td width="1%"><div id="noVNC_buttons">
32 <input type=button value="Send CtrlAltDel"
33 id="sendCtrlAltDelButton">
34 <span id="noVNC_xvp_buttons">
35 <input type=button value="Shutdown"
36 id="xvpShutdownButton">
37 <input type=button value="Reboot"
38 id="xvpRebootButton">
39 <input type=button value="Reset"
40 id="xvpResetButton">
41 </span>
42 </div>
43 </td>
44 </tr></table>
45 </div>
46 <canvas id="noVNC_canvas" width="640px" height="20px">
47 Canvas not supported.
48 </canvas>
49 </div>
50
51 <script>
52 /*jslint white: false */
53 /*global window, $, Util, RFB, */
54 "use strict";
55
56 // Load supporting scripts
57 Util.load_scripts(["webutil.js", "base64.js", "websock.js", "des.js",
58 "keysymdef.js", "keyboard.js", "input.js", "display.js",
59 "jsunzip.js", "rfb.js"]);
60
61 var rfb;
62
63 function passwordRequired(rfb) {
64 var msg;
65 msg = '<form onsubmit="return setPassword();"';
66 msg += ' style="margin-bottom: 0px">';
67 msg += 'Password Required: ';
68 msg += '<input type=password size=10 id="password_input" class="noVNC_status">';
69 msg += '<\/form>';
70 $D('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
71 $D('noVNC_status').innerHTML = msg;
72 }
73 function setPassword() {
74 rfb.sendPassword($D('password_input').value);
75 return false;
76 }
77 function sendCtrlAltDel() {
78 rfb.sendCtrlAltDel();
79 return false;
80 }
81 function xvpShutdown() {
82 rfb.xvpShutdown();
83 return false;
84 }
85 function xvpReboot() {
86 rfb.xvpReboot();
87 return false;
88 }
89 function xvpReset() {
90 rfb.xvpReset();
91 return false;
92 }
93 function updateState(rfb, state, oldstate, msg) {
94 var s, sb, cad, level;
95 s = $D('noVNC_status');
96 sb = $D('noVNC_status_bar');
97 cad = $D('sendCtrlAltDelButton');
98 switch (state) {
99 case 'failed': level = "error"; break;
100 case 'fatal': level = "error"; break;
101 case 'normal': level = "normal"; break;
102 case 'disconnected': level = "normal"; break;
103 case 'loaded': level = "normal"; break;
104 default: level = "warn"; break;
105 }
106
107 if (state === "normal") {
108 cad.disabled = false;
109 } else {
110 cad.disabled = true;
111 xvpInit(0);
112 }
113
114 if (typeof(msg) !== 'undefined') {
115 sb.setAttribute("class", "noVNC_status_" + level);
116 s.innerHTML = msg;
117 }
118 }
119
120 function xvpInit(ver) {
121 var xvpbuttons;
122 xvpbuttons = $D('noVNC_xvp_buttons');
123 if (ver >= 1) {
124 xvpbuttons.style.display = 'inline';
125 } else {
126 xvpbuttons.style.display = 'none';
127 }
128 }
129
130 window.onscriptsload = function () {
131 var host, port, password, path, token;
132
133 $D('sendCtrlAltDelButton').style.display = "inline";
134 $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
135 $D('xvpShutdownButton').onclick = xvpShutdown;
136 $D('xvpRebootButton').onclick = xvpReboot;
137 $D('xvpResetButton').onclick = xvpReset;
138
139 WebUtil.init_logging(WebUtil.getQueryVar('logging', 'warn'));
140 document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
141 // By default, use the host and port of server that served this file
142 host = WebUtil.getQueryVar('host', window.location.hostname);
143 port = WebUtil.getQueryVar('port', window.location.port);
144
145 // if port == 80 (or 443) then it won't be present and should be
146 // set manually
147 if (!port) {
148 if (window.location.protocol.substring(0,5) == 'https') {
149 port = 443;
150 }
151 else if (window.location.protocol.substring(0,4) == 'http') {
152 port = 80;
153 }
154 }
155
156 // If a token variable is passed in, set the parameter in a cookie.
157 // This is used by nova-novncproxy.
158 token = WebUtil.getQueryVar('token', null);
159 if (token) {
160 WebUtil.createCookie('token', token, 1)
161 }
162
163 password = WebUtil.getQueryVar('password', '');
164 path = WebUtil.getQueryVar('path', 'websockify');
165
166 if ((!host) || (!port)) {
167 updateState('failed',
168 "Must specify host and port in URL");
169 return;
170 }
171
172 rfb = new RFB({'target': $D('noVNC_canvas'),
173 'encrypt': WebUtil.getQueryVar('encrypt',
174 (window.location.protocol === "https:")),
175 'repeaterID': WebUtil.getQueryVar('repeaterID', ''),
176 'true_color': WebUtil.getQueryVar('true_color', true),
177 'local_cursor': WebUtil.getQueryVar('cursor', true),
178 'shared': WebUtil.getQueryVar('shared', true),
179 'view_only': WebUtil.getQueryVar('view_only', false),
180 'updateState': updateState,
181 'onXvpInit': xvpInit,
182 'onPasswordRequired': passwordRequired});
183 rfb.connect(host, port, password, path);
184
185 $D("noVNC_screen").onmouseover = function(e) {
186 window.focus();
187 };
188
189// .mouseout(function() {
190// rfb.get_keyboard().set_focused(false);
191// }).mouseover(function() {
192// rfb.get_keyboard().set_focused(true);
193// });
194
195 };
196 </script>
197 </body>
198</html>