diff options
Diffstat (limited to 'webclients/novnc/vnc_auto.html')
-rw-r--r-- | webclients/novnc/vnc_auto.html | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/webclients/novnc/vnc_auto.html b/webclients/novnc/vnc_auto.html index a500b79..8d370b5 100644 --- a/webclients/novnc/vnc_auto.html +++ b/webclients/novnc/vnc_auto.html @@ -84,16 +84,25 @@ } window.onload = function () { - var host, port, password, path; + var host, port, password, path, token; $D('sendCtrlAltDelButton').style.display = "inline"; $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel; document.title = unescape(WebUtil.getQueryVar('title', 'noVNC')); - host = WebUtil.getQueryVar('host', null); - port = WebUtil.getQueryVar('port', null); + // By default, use the host and port of server that served this file + host = WebUtil.getQueryVar('host', window.location.hostname); + port = WebUtil.getQueryVar('port', window.location.port); + + // If a token variable is passed in, set the parameter in a cookie. + // This is used by nova-novncproxy. + token = WebUtil.getQueryVar('token', null); + if (token) { + WebUtil.createCookie('token', token, 1) + } + password = WebUtil.getQueryVar('password', ''); - path = WebUtil.getQueryVar('path', ''); + path = WebUtil.getQueryVar('path', 'websockify'); if ((!host) || (!port)) { updateState('failed', "Must specify host and port in URL"); @@ -101,10 +110,12 @@ } rfb = new RFB({'target': $D('noVNC_canvas'), - 'encrypt': WebUtil.getQueryVar('encrypt', false), + 'encrypt': WebUtil.getQueryVar('encrypt', + (window.location.protocol === "https:")), 'true_color': WebUtil.getQueryVar('true_color', true), 'local_cursor': WebUtil.getQueryVar('cursor', true), 'shared': WebUtil.getQueryVar('shared', true), + 'view_only': WebUtil.getQueryVar('view_only', false), 'updateState': updateState, 'onPasswordRequired': passwordRequired}); rfb.connect(host, port, password, path); |