Simplify nova-novncproxy related logic.
* Don't clobber default host/port
This commit is contained in:
parent
4c75210a4d
commit
0139b2562c
|
@ -90,9 +90,20 @@
|
||||||
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
|
||||||
|
|
||||||
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
|
document.title = unescape(WebUtil.getQueryVar('title', 'noVNC'));
|
||||||
|
host = WebUtil.getQueryVar('host', null);
|
||||||
|
port = WebUtil.getQueryVar('port', null);
|
||||||
|
|
||||||
|
// If a token variable is passed in, set the parameter in a cookie.
|
||||||
|
// This is used by nova-novncproxy.
|
||||||
token = WebUtil.getQueryVar('token', null);
|
token = WebUtil.getQueryVar('token', null);
|
||||||
host = window.location.hostname;
|
if (token) {
|
||||||
port = window.location.port;
|
// If token is set, we are using nova-novncproxy.
|
||||||
|
// Use host and port of server that served this file.
|
||||||
|
host = window.location.hostname;
|
||||||
|
port = window.location.port;
|
||||||
|
WebUtil.createCookie('token', token, 1)
|
||||||
|
}
|
||||||
|
|
||||||
password = WebUtil.getQueryVar('password', '');
|
password = WebUtil.getQueryVar('password', '');
|
||||||
path = WebUtil.getQueryVar('path', 'websockify');
|
path = WebUtil.getQueryVar('path', 'websockify');
|
||||||
if ((!host) || (!port)) {
|
if ((!host) || (!port)) {
|
||||||
|
@ -110,12 +121,6 @@
|
||||||
'view_only': WebUtil.getQueryVar('view_only', false),
|
'view_only': WebUtil.getQueryVar('view_only', false),
|
||||||
'updateState': updateState,
|
'updateState': updateState,
|
||||||
'onPasswordRequired': passwordRequired});
|
'onPasswordRequired': passwordRequired});
|
||||||
|
|
||||||
/* If a token variable is passed in, set the parameter in a cookie. This is
|
|
||||||
used by nova-novncproxy. */
|
|
||||||
if (token) {
|
|
||||||
WebUtil.createCookie('token', token, 1)
|
|
||||||
}
|
|
||||||
rfb.connect(host, port, password, path);
|
rfb.connect(host, port, password, path);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue