diff options
author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-04-03 10:34:24 -0700 |
---|---|---|
committer | Anthony Young <sleepsonthefloor@gmail.com> | 2012-04-03 10:34:24 -0700 |
commit | 0139b2562c1e7a9e7e289f9c66ff7d6632011a86 (patch) | |
tree | fd5dac28f29862010e91efb28c0933cd8dc48464 | |
parent | 4c75210a4d8946cfc35db1d18150cfab72cba61e (diff) | |
download | novnc-0139b2562c1e7a9e7e289f9c66ff7d6632011a86.tar.gz |
Simplify nova-novncproxy related logic.
* Don't clobber default host/port
-rw-r--r-- | vnc_auto.html | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/vnc_auto.html b/vnc_auto.html index ffdfc00..ae2e7ca 100644 --- a/vnc_auto.html +++ b/vnc_auto.html @@ -90,9 +90,20 @@ $D('sendCtrlAltDelButton').onclick = sendCtrlAltDel; 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); - host = window.location.hostname; - port = window.location.port; + if (token) { + // 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', ''); path = WebUtil.getQueryVar('path', 'websockify'); if ((!host) || (!port)) { @@ -110,12 +121,6 @@ 'view_only': WebUtil.getQueryVar('view_only', false), 'updateState': updateState, '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); }; </script> |