]> git.proxmox.com Git - mirror_novnc.git/blob - vnc_lite.html
feat: add French localization strings
[mirror_novnc.git] / vnc_lite.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4
5 <!--
6 noVNC example: lightweight example using minimal UI and features
7 Copyright (C) 2012 Joel Martin
8 Copyright (C) 2017 Samuel Mannehed for Cendio AB
9 noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
10 This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
11
12 Connect parameters are provided in query string:
13 http://example.com/?host=HOST&port=PORT&encrypt=1
14 or the fragment:
15 http://example.com/#host=HOST&port=PORT&encrypt=1
16 -->
17 <title>noVNC</title>
18
19 <meta charset="utf-8">
20
21 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
22 Remove this if you use the .htaccess -->
23 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
24
25 <!-- Icons (see Makefile for what the sizes are for) -->
26 <link rel="icon" sizes="16x16" type="image/png" href="app/images/icons/novnc-16x16.png">
27 <link rel="icon" sizes="24x24" type="image/png" href="app/images/icons/novnc-24x24.png">
28 <link rel="icon" sizes="32x32" type="image/png" href="app/images/icons/novnc-32x32.png">
29 <link rel="icon" sizes="48x48" type="image/png" href="app/images/icons/novnc-48x48.png">
30 <link rel="icon" sizes="60x60" type="image/png" href="app/images/icons/novnc-60x60.png">
31 <link rel="icon" sizes="64x64" type="image/png" href="app/images/icons/novnc-64x64.png">
32 <link rel="icon" sizes="72x72" type="image/png" href="app/images/icons/novnc-72x72.png">
33 <link rel="icon" sizes="76x76" type="image/png" href="app/images/icons/novnc-76x76.png">
34 <link rel="icon" sizes="96x96" type="image/png" href="app/images/icons/novnc-96x96.png">
35 <link rel="icon" sizes="120x120" type="image/png" href="app/images/icons/novnc-120x120.png">
36 <link rel="icon" sizes="144x144" type="image/png" href="app/images/icons/novnc-144x144.png">
37 <link rel="icon" sizes="152x152" type="image/png" href="app/images/icons/novnc-152x152.png">
38 <link rel="icon" sizes="192x192" type="image/png" href="app/images/icons/novnc-192x192.png">
39 <!-- Firefox currently mishandles SVG, see #1419039
40 <link rel="icon" sizes="any" type="image/svg+xml" href="app/images/icons/novnc-icon.svg">
41 -->
42 <!-- Repeated last so that legacy handling will pick this -->
43 <link rel="icon" sizes="16x16" type="image/png" href="app/images/icons/novnc-16x16.png">
44
45 <!-- Apple iOS Safari settings -->
46 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
47 <meta name="apple-mobile-web-app-capable" content="yes" />
48 <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
49 <!-- Home Screen Icons (favourites and bookmarks use the normal icons) -->
50 <link rel="apple-touch-icon" sizes="60x60" type="image/png" href="app/images/icons/novnc-60x60.png">
51 <link rel="apple-touch-icon" sizes="76x76" type="image/png" href="app/images/icons/novnc-76x76.png">
52 <link rel="apple-touch-icon" sizes="120x120" type="image/png" href="app/images/icons/novnc-120x120.png">
53 <link rel="apple-touch-icon" sizes="152x152" type="image/png" href="app/images/icons/novnc-152x152.png">
54
55 <!-- Stylesheets -->
56 <link rel="stylesheet" href="app/styles/lite.css">
57
58 <!--
59 <script type='text/javascript'
60 src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>
61 -->
62
63 <!-- promise polyfills promises for IE11 -->
64 <script src="vendor/promise.js"></script>
65 <!-- ES2015/ES6 modules polyfill -->
66 <script type="module">
67 window._noVNC_has_module_support = true;
68 </script>
69 <script>
70 window.addEventListener("load", function() {
71 if (window._noVNC_has_module_support) return;
72 var loader = document.createElement("script");
73 loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
74 document.head.appendChild(loader);
75 });
76 </script>
77
78 <!-- actual script modules -->
79 <script type="module" crossorigin="anonymous">
80 // Load supporting scripts
81 import * as WebUtil from './app/webutil.js';
82 import RFB from './core/rfb.js';
83
84 var rfb;
85 var desktopName;
86
87 function updateDesktopName(e) {
88 desktopName = e.detail.name;
89 }
90 function credentials(e) {
91 var html;
92
93 var form = document.createElement('form');
94 form.innerHTML = '<label></label>';
95 form.innerHTML += '<input type=password size=10 id="password_input">';
96 form.onsubmit = setPassword;
97
98 // bypass status() because it sets text content
99 document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
100 document.getElementById('noVNC_status').innerHTML = '';
101 document.getElementById('noVNC_status').appendChild(form);
102 document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: ';
103 }
104 function setPassword() {
105 rfb.sendCredentials({ password: document.getElementById('password_input').value });
106 return false;
107 }
108 function sendCtrlAltDel() {
109 rfb.sendCtrlAltDel();
110 return false;
111 }
112 function machineShutdown() {
113 rfb.machineShutdown();
114 return false;
115 }
116 function machineReboot() {
117 rfb.machineReboot();
118 return false;
119 }
120 function machineReset() {
121 rfb.machineReset();
122 return false;
123 }
124 function status(text, level) {
125 switch (level) {
126 case 'normal':
127 case 'warn':
128 case 'error':
129 break;
130 default:
131 level = "warn";
132 }
133 document.getElementById('noVNC_status_bar').className = "noVNC_status_" + level;
134 document.getElementById('noVNC_status').textContent = text;
135 }
136
137 function connected(e) {
138 document.getElementById('sendCtrlAltDelButton').disabled = false;
139 if (WebUtil.getConfigVar('encrypt',
140 (window.location.protocol === "https:"))) {
141 status("Connected (encrypted) to " + desktopName, "normal");
142 } else {
143 status("Connected (unencrypted) to " + desktopName, "normal");
144 }
145 }
146
147 function disconnected(e) {
148 document.getElementById('sendCtrlAltDelButton').disabled = true;
149 updatePowerButtons();
150 if (e.detail.clean) {
151 status("Disconnected", "normal");
152 } else {
153 status("Something went wrong, connection is closed", "error");
154 }
155 }
156
157 function updatePowerButtons() {
158 var powerbuttons;
159 powerbuttons = document.getElementById('noVNC_power_buttons');
160 if (rfb.capabilities.power) {
161 powerbuttons.className= "noVNC_shown";
162 } else {
163 powerbuttons.className = "noVNC_hidden";
164 }
165 }
166
167 document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
168 document.getElementById('machineShutdownButton').onclick = machineShutdown;
169 document.getElementById('machineRebootButton').onclick = machineReboot;
170 document.getElementById('machineResetButton').onclick = machineReset;
171
172 WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
173 document.title = WebUtil.getConfigVar('title', 'noVNC');
174 // By default, use the host and port of server that served this file
175 var host = WebUtil.getConfigVar('host', window.location.hostname);
176 var port = WebUtil.getConfigVar('port', window.location.port);
177
178 // if port == 80 (or 443) then it won't be present and should be
179 // set manually
180 if (!port) {
181 if (window.location.protocol.substring(0,5) == 'https') {
182 port = 443;
183 }
184 else if (window.location.protocol.substring(0,4) == 'http') {
185 port = 80;
186 }
187 }
188
189 var password = WebUtil.getConfigVar('password', '');
190 var path = WebUtil.getConfigVar('path', 'websockify');
191
192 // If a token variable is passed in, set the parameter in a cookie.
193 // This is used by nova-novncproxy.
194 var token = WebUtil.getConfigVar('token', null);
195 if (token) {
196 // if token is already present in the path we should use it
197 path = WebUtil.injectParamIfMissing(path, "token", token);
198
199 WebUtil.createCookie('token', token, 1)
200 }
201
202 (function() {
203
204 status("Connecting", "normal");
205
206 if ((!host) || (!port)) {
207 status('Must specify host and port in URL', 'error');
208 }
209
210 var url;
211
212 if (WebUtil.getConfigVar('encrypt',
213 (window.location.protocol === "https:"))) {
214 url = 'wss';
215 } else {
216 url = 'ws';
217 }
218
219 url += '://' + host;
220 if(port) {
221 url += ':' + port;
222 }
223 url += '/' + path;
224
225 rfb = new RFB(document.body, url,
226 { repeaterID: WebUtil.getConfigVar('repeaterID', ''),
227 shared: WebUtil.getConfigVar('shared', true),
228 credentials: { password: password } });
229 rfb.viewOnly = WebUtil.getConfigVar('view_only', false);
230 rfb.addEventListener("connect", connected);
231 rfb.addEventListener("disconnect", disconnected);
232 rfb.addEventListener("capabilities", updatePowerButtons);
233 rfb.addEventListener("credentialsrequired", credentials);
234 rfb.addEventListener("desktopname", updateDesktopName);
235 rfb.scaleViewport = WebUtil.getConfigVar('scale', false);
236 rfb.resizeSession = WebUtil.getConfigVar('resize', false);
237 })();
238 </script>
239 </head>
240
241 <body>
242 <div id="noVNC_status_bar">
243 <div id="noVNC_left_dummy_elem"></div>
244 <div id="noVNC_status">Loading</div>
245 <div id="noVNC_buttons">
246 <input type=button value="Send CtrlAltDel"
247 id="sendCtrlAltDelButton" class="noVNC_shown">
248 <span id="noVNC_power_buttons" class="noVNC_hidden">
249 <input type=button value="Shutdown"
250 id="machineShutdownButton">
251 <input type=button value="Reboot"
252 id="machineRebootButton">
253 <input type=button value="Reset"
254 id="machineResetButton">
255 </span>
256 </div>
257 </div>
258 </body>
259 </html>