]> git.proxmox.com Git - mirror_novnc.git/blame - vnc_lite.html
Get rid of icons for vnc_lite
[mirror_novnc.git] / vnc_lite.html
CommitLineData
40f281eb 1<!DOCTYPE html>
91308399 2<html>
e84101b3
3<head>
4
82744aa8 5 <!--
83391ffc 6 noVNC example: lightweight example using minimal UI and features
d58f8b51 7 Copyright (C) 2012 Joel Martin
0f207c80 8 Copyright (C) 2018 Samuel Mannehed for Cendio AB
1d728ace 9 noVNC is licensed under the MPL 2.0 (see LICENSE.txt)
d58f8b51 10 This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
d595e656
JM
11
12 Connect parameters are provided in query string:
26586b9d 13 http://example.com/?host=HOST&port=PORT&encrypt=1
494b407a 14 or the fragment:
26586b9d 15 http://example.com/#host=HOST&port=PORT&encrypt=1
d595e656 16 -->
e84101b3
17 <title>noVNC</title>
18
33f5d3bd
19 <meta charset="utf-8">
20
e84101b3
21 <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
22 Remove this if you use the .htaccess -->
33f5d3bd
23 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
24
e84101b3 25 <!-- Stylesheets -->
83391ffc 26 <link rel="stylesheet" href="app/styles/lite.css">
e84101b3 27
7569cdc2
SR
28 <!-- promise polyfills promises for IE11 -->
29 <script src="vendor/promise.js"></script>
14ecdc62
FC
30 <!-- ES2015/ES6 modules polyfill -->
31 <script type="module">
32 window._noVNC_has_module_support = true;
33 </script>
34 <script>
35 window.addEventListener("load", function() {
36 if (window._noVNC_has_module_support) return;
37 var loader = document.createElement("script");
38 loader.src = "vendor/browser-es-module-loader/dist/browser-es-module-loader.js";
39 document.head.appendChild(loader);
40 });
41 </script>
42
43 <!-- actual script modules -->
bf826444 44 <script type="module" crossorigin="anonymous">
6f4b1e40 45 // Load supporting scripts
7569cdc2
SR
46 import * as WebUtil from './app/webutil.js';
47 import RFB from './core/rfb.js';
6f4b1e40 48
8db09746 49 var rfb;
3bb12056 50 var desktopName;
8db09746 51
e89eef94
PO
52 function updateDesktopName(e) {
53 desktopName = e.detail.name;
3bb12056 54 }
e89eef94 55 function credentials(e) {
7d714b15 56 var html;
c464f47e 57
7569cdc2 58 var form = document.createElement('form');
cf3b5282 59 form.innerHTML = '<label></label>';
8167e459 60 form.innerHTML += '<input type=password size=10 id="password_input">';
7569cdc2 61 form.onsubmit = setPassword;
6048299a
SR
62
63 // bypass status() because it sets text content
64 document.getElementById('noVNC_status_bar').setAttribute("class", "noVNC_status_warn");
7569cdc2
SR
65 document.getElementById('noVNC_status').innerHTML = '';
66 document.getElementById('noVNC_status').appendChild(form);
430f00d6 67 document.getElementById('noVNC_status').querySelector('label').textContent = 'Password Required: ';
d890e864 68 }
91308399 69 function setPassword() {
430f00d6 70 rfb.sendCredentials({ password: document.getElementById('password_input').value });
91308399
JM
71 return false;
72 }
63708ff5 73 function sendCtrlAltDel() {
8db09746 74 rfb.sendCtrlAltDel();
a8edf9d8 75 return false;
63708ff5 76 }
3bb12056
SM
77 function status(text, level) {
78 switch (level) {
79 case 'normal':
80 case 'warn':
81 case 'error':
82 break;
83 default:
84 level = "warn";
85 }
dc905e85 86 document.getElementById('noVNC_status_bar').className = "noVNC_status_" + level;
6048299a 87 document.getElementById('noVNC_status').textContent = text;
3bb12056 88 }
91308399 89
ee5cae9f
SM
90 function connected(e) {
91 document.getElementById('sendCtrlAltDelButton').disabled = false;
ee5cae9f
SM
92 if (WebUtil.getConfigVar('encrypt',
93 (window.location.protocol === "https:"))) {
c995c086 94 status("Connected (encrypted) to " + desktopName, "normal");
fb35d50f 95 } else {
c995c086 96 status("Connected (unencrypted) to " + desktopName, "normal");
fb35d50f 97 }
3bb12056 98 }
ee5cae9f
SM
99
100 function disconnected(e) {
101 document.getElementById('sendCtrlAltDelButton').disabled = true;
d472f3f1 102 if (e.detail.clean) {
ee5cae9f 103 status("Disconnected", "normal");
d472f3f1
SM
104 } else {
105 status("Something went wrong, connection is closed", "error");
91308399 106 }
91308399
JM
107 }
108
7569cdc2 109 document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
91308399 110
7569cdc2 111 WebUtil.init_logging(WebUtil.getConfigVar('logging', 'warn'));
08cd672e 112 document.title = WebUtil.getConfigVar('title', 'noVNC');
7569cdc2
SR
113 // By default, use the host and port of server that served this file
114 var host = WebUtil.getConfigVar('host', window.location.hostname);
115 var port = WebUtil.getConfigVar('port', window.location.port);
8db09746 116
7569cdc2
SR
117 // if port == 80 (or 443) then it won't be present and should be
118 // set manually
119 if (!port) {
120 if (window.location.protocol.substring(0,5) == 'https') {
121 port = 443;
122 }
123 else if (window.location.protocol.substring(0,4) == 'http') {
124 port = 80;
e83b9e03 125 }
7569cdc2 126 }
e83b9e03 127
7569cdc2
SR
128 var password = WebUtil.getConfigVar('password', '');
129 var path = WebUtil.getConfigVar('path', 'websockify');
c55f05f6 130
7569cdc2
SR
131 // If a token variable is passed in, set the parameter in a cookie.
132 // This is used by nova-novncproxy.
133 var token = WebUtil.getConfigVar('token', null);
134 if (token) {
135 // if token is already present in the path we should use it
136 path = WebUtil.injectParamIfMissing(path, "token", token);
c55f05f6 137
7569cdc2
SR
138 WebUtil.createCookie('token', token, 1)
139 }
c55f05f6 140
7569cdc2 141 (function() {
0139b256 142
ee5cae9f
SM
143 status("Connecting", "normal");
144
91308399 145 if ((!host) || (!port)) {
3bb12056 146 status('Must specify host and port in URL', 'error');
91308399
JM
147 }
148
5b4e5d01
PO
149 var url;
150
151 if (WebUtil.getConfigVar('encrypt',
152 (window.location.protocol === "https:"))) {
153 url = 'wss';
154 } else {
155 url = 'ws';
156 }
157
158 url += '://' + host;
159 if(port) {
160 url += ':' + port;
d9fc1c7b 161 }
5b4e5d01 162 url += '/' + path;
d9fc1c7b 163
9b84f516 164 rfb = new RFB(document.body, url,
2f4516f2
PO
165 { repeaterID: WebUtil.getConfigVar('repeaterID', ''),
166 shared: WebUtil.getConfigVar('shared', true),
167 credentials: { password: password } });
5b20d338 168 rfb.viewOnly = WebUtil.getConfigVar('view_only', false);
ee5cae9f
SM
169 rfb.addEventListener("connect", connected);
170 rfb.addEventListener("disconnect", disconnected);
e89eef94
PO
171 rfb.addEventListener("credentialsrequired", credentials);
172 rfb.addEventListener("desktopname", updateDesktopName);
bd2ce0ca 173 rfb.scaleViewport = WebUtil.getConfigVar('scale', false);
9b84f516 174 rfb.resizeSession = WebUtil.getConfigVar('resize', false);
7569cdc2
SR
175 })();
176 </script>
177</head>
178
178bf8ec 179<body>
dc905e85 180 <div id="noVNC_status_bar">
4023a6e1
SM
181 <div id="noVNC_left_dummy_elem"></div>
182 <div id="noVNC_status">Loading</div>
183 <div id="noVNC_buttons">
184 <input type=button value="Send CtrlAltDel"
185 id="sendCtrlAltDelButton" class="noVNC_shown">
4023a6e1 186 </div>
178bf8ec 187 </div>
178bf8ec 188</body>
91308399 189</html>