فهرست منبع

Use page host:port as default for WebSocket host/port.

Joel Martin 13 سال پیش
والد
کامیت
bd96e91932
2فایلهای تغییر یافته به همراه5 افزوده شده و 8 حذف شده
  1. 2 2
      include/ui.js
  2. 3 6
      vnc_auto.html

+ 2 - 2
include/ui.js

@@ -45,8 +45,8 @@ load: function() {
     WebUtil.selectStylesheet(UI.getSetting('stylesheet'));
 
     /* Populate the controls if defaults are provided in the URL */
-    UI.initSetting('host', '');
-    UI.initSetting('port', '');
+    UI.initSetting('host', window.location.hostname);
+    UI.initSetting('port', window.location.port);
     UI.initSetting('password', '');
     UI.initSetting('encrypt', (window.location.protocol === "https:"));
     UI.initSetting('true_color', true);

+ 3 - 6
vnc_auto.html

@@ -90,17 +90,14 @@
             $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) {
-                // 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)
             }