Merge pull request #245 from wrouesnel/vnc-auto-fix
Detect port properly in vnc_auto.html when used on port 80 or 443.
This commit is contained in:
commit
e6500004de
|
@ -55,9 +55,21 @@ start: function(callback) {
|
||||||
// call twice to get around webkit bug
|
// call twice to get around webkit bug
|
||||||
WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
|
WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
|
||||||
|
|
||||||
|
// if port == 80 (or 443) then it won't be present and should be
|
||||||
|
// set manually
|
||||||
|
port = window.location.port;
|
||||||
|
if (!port) {
|
||||||
|
if (window.location.protocol.substring(0,4) == 'http') {
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
else if (window.location.protocol.substring(0,5) == 'https') {
|
||||||
|
port = 443;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Populate the controls if defaults are provided in the URL */
|
/* Populate the controls if defaults are provided in the URL */
|
||||||
UI.initSetting('host', window.location.hostname);
|
UI.initSetting('host', window.location.hostname);
|
||||||
UI.initSetting('port', window.location.port);
|
UI.initSetting('port', port);
|
||||||
UI.initSetting('password', '');
|
UI.initSetting('password', '');
|
||||||
UI.initSetting('encrypt', (window.location.protocol === "https:"));
|
UI.initSetting('encrypt', (window.location.protocol === "https:"));
|
||||||
UI.initSetting('true_color', true);
|
UI.initSetting('true_color', true);
|
||||||
|
|
|
@ -122,6 +122,17 @@
|
||||||
host = WebUtil.getQueryVar('host', window.location.hostname);
|
host = WebUtil.getQueryVar('host', window.location.hostname);
|
||||||
port = WebUtil.getQueryVar('port', window.location.port);
|
port = WebUtil.getQueryVar('port', window.location.port);
|
||||||
|
|
||||||
|
// if port == 80 (or 443) then it won't be present and should be
|
||||||
|
// set manually
|
||||||
|
if (!port) {
|
||||||
|
if (window.location.protocol.substring(0,4) == 'http') {
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
else if (window.location.protocol.substring(0,5) == 'https') {
|
||||||
|
port = 443;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If a token variable is passed in, set the parameter in a cookie.
|
// If a token variable is passed in, set the parameter in a cookie.
|
||||||
// This is used by nova-novncproxy.
|
// This is used by nova-novncproxy.
|
||||||
token = WebUtil.getQueryVar('token', null);
|
token = WebUtil.getQueryVar('token', null);
|
||||||
|
|
Loading…
Reference in New Issue