Cleanup non-essential options from vnc_lite
This is supposed to be a simple example, it shouldn't have this many options. This commit removes the following options: * logging - the default level 'warn' is good enough * title - a weird thing to set from the query string anyway * token - not used by most setups * encrypt - looking at the URL is good enough * repeaterID - not used by most setups * shared - uncommon setting * resize - not supported by most servers Note that the removal of 'encrypt' allows us to remove logic for establishing a default port. The default port for wss is 443 and for ws it's 80 anyway.
This commit is contained in:
parent
8c2866df36
commit
51f9f0098d
|
@ -13,9 +13,9 @@
|
||||||
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
|
This file is licensed under the 2-Clause BSD license (see LICENSE.txt).
|
||||||
|
|
||||||
Connect parameters are provided in query string:
|
Connect parameters are provided in query string:
|
||||||
http://example.com/?host=HOST&port=PORT&encrypt=1
|
http://example.com/?host=HOST&port=PORT&scale=true
|
||||||
or the fragment:
|
or the fragment:
|
||||||
http://example.com/#host=HOST&port=PORT&encrypt=1
|
http://example.com/#host=HOST&port=PORT&scale=true
|
||||||
-->
|
-->
|
||||||
<title>noVNC</title>
|
<title>noVNC</title>
|
||||||
|
|
||||||
|
@ -150,36 +150,12 @@
|
||||||
document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
document.getElementById('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
||||||
|
|
||||||
// Read parameters specified in the URL (query string or fragment)
|
// Read parameters specified in the URL (query string or fragment)
|
||||||
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
|
// By default, use the host and port of server that served this file
|
||||||
var host = WebUtil.getConfigVar('host', window.location.hostname);
|
var host = WebUtil.getConfigVar('host', window.location.hostname);
|
||||||
var port = WebUtil.getConfigVar('port', window.location.port);
|
var port = WebUtil.getConfigVar('port', window.location.port);
|
||||||
|
|
||||||
// if port == 80 (or 443) then it won't be present in window.location
|
|
||||||
// and we have to set it 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 = WebUtil.getConfigVar('password', '');
|
||||||
var path = WebUtil.getConfigVar('path', 'websockify');
|
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// | | | | | |
|
// | | | | | |
|
||||||
// | | | Connect | | |
|
// | | | Connect | | |
|
||||||
// v v v v v v
|
// v v v v v v
|
||||||
|
@ -189,8 +165,7 @@
|
||||||
|
|
||||||
// Build the websocket URL used to connect
|
// Build the websocket URL used to connect
|
||||||
var url;
|
var url;
|
||||||
if (WebUtil.getConfigVar('encrypt',
|
if (window.location.protocol === "https:") {
|
||||||
(window.location.protocol === "https:"))) {
|
|
||||||
url = 'wss';
|
url = 'wss';
|
||||||
} else {
|
} else {
|
||||||
url = 'ws';
|
url = 'ws';
|
||||||
|
@ -203,9 +178,7 @@
|
||||||
|
|
||||||
// Creating a new RFB object will start a new connection
|
// Creating a new RFB object will start a new connection
|
||||||
rfb = new RFB(document.body, url,
|
rfb = new RFB(document.body, url,
|
||||||
{ repeaterID: WebUtil.getConfigVar('repeaterID', ''),
|
{ credentials: { password: password } });
|
||||||
shared: WebUtil.getConfigVar('shared', true),
|
|
||||||
credentials: { password: password } });
|
|
||||||
|
|
||||||
// Add listeners to important events from the RFB module
|
// Add listeners to important events from the RFB module
|
||||||
rfb.addEventListener("connect", connected);
|
rfb.addEventListener("connect", connected);
|
||||||
|
@ -216,7 +189,6 @@
|
||||||
// Set parameters that can be changed on an active connection
|
// Set parameters that can be changed on an active connection
|
||||||
rfb.viewOnly = WebUtil.getConfigVar('view_only', false);
|
rfb.viewOnly = WebUtil.getConfigVar('view_only', false);
|
||||||
rfb.scaleViewport = WebUtil.getConfigVar('scale', false);
|
rfb.scaleViewport = WebUtil.getConfigVar('scale', false);
|
||||||
rfb.resizeSession = WebUtil.getConfigVar('resize', false);
|
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in New Issue