Browse Source

Merge remote branch 'kassah/master'

Joel Martin 13 năm trước cách đây
mục cha
commit
2090f1af67
5 tập tin đã thay đổi với 23 bổ sung2 xóa
  1. 13 2
      include/rfb.js
  2. 5 0
      include/ui.js
  3. 2 0
      include/util.js
  4. 1 0
      vnc.html
  5. 2 0
      vnc_auto.html

+ 13 - 2
include/rfb.js

@@ -134,6 +134,7 @@ Util.conf_defaults(conf, that, defaults, [
     ['focusContainer',     'wo', 'dom', document, 'DOM element that captures keyboard input'],
     ['focusContainer',     'wo', 'dom', document, 'DOM element that captures keyboard input'],
 
 
     ['encrypt',            'rw', 'bool', false, 'Use TLS/SSL/wss encryption'],
     ['encrypt',            'rw', 'bool', false, 'Use TLS/SSL/wss encryption'],
+    ['repeaterID',         'rw', 'string', '', 'RepeaterID to connect to'],
     ['true_color',         'rw', 'bool', true,  'Request true color pixel data'],
     ['true_color',         'rw', 'bool', true,  'Request true color pixel data'],
     ['local_cursor',       'rw', 'bool', false, 'Request locally rendered cursor'],
     ['local_cursor',       'rw', 'bool', false, 'Request locally rendered cursor'],
     ['shared',             'rw', 'bool', true,  'Request shared mode'],
     ['shared',             'rw', 'bool', true,  'Request shared mode'],
@@ -659,10 +660,10 @@ mouseMove = function(x, y) {
 init_msg = function() {
 init_msg = function() {
     //Util.Debug(">> init_msg [rfb_state '" + rfb_state + "']");
     //Util.Debug(">> init_msg [rfb_state '" + rfb_state + "']");
 
 
-    var strlen, reason, length, sversion, cversion,
+    var strlen, reason, length, sversion, cversion, repeaterID,
         i, types, num_types, challenge, response, bpp, depth,
         i, types, num_types, challenge, response, bpp, depth,
         big_endian, red_max, green_max, blue_max, red_shift,
         big_endian, red_max, green_max, blue_max, red_shift,
-        green_shift, blue_shift, true_color, name_length;
+        green_shift, blue_shift, true_color, name_length, is_repeater;
 
 
     //Util.Debug("ws.rQ (" + ws.rQlen() + ") " + ws.rQslice(0));
     //Util.Debug("ws.rQ (" + ws.rQlen() + ") " + ws.rQslice(0));
     switch (rfb_state) {
     switch (rfb_state) {
@@ -673,7 +674,9 @@ init_msg = function() {
         }
         }
         sversion = ws.rQshiftStr(12).substr(4,7);
         sversion = ws.rQshiftStr(12).substr(4,7);
         Util.Info("Server ProtocolVersion: " + sversion);
         Util.Info("Server ProtocolVersion: " + sversion);
+        is_repeater = 0;
         switch (sversion) {
         switch (sversion) {
+            case "000.000": is_repeater = 1; break; // UltraVNC repeater
             case "003.003": rfb_version = 3.3; break;
             case "003.003": rfb_version = 3.3; break;
             case "003.006": rfb_version = 3.3; break;  // UltraVNC
             case "003.006": rfb_version = 3.3; break;  // UltraVNC
             case "003.889": rfb_version = 3.3; break;  // Apple Remote Desktop
             case "003.889": rfb_version = 3.3; break;  // Apple Remote Desktop
@@ -684,6 +687,13 @@ init_msg = function() {
             default:
             default:
                 return fail("Invalid server version " + sversion);
                 return fail("Invalid server version " + sversion);
         }
         }
+        if (is_repeater) { 
+            repeaterID = conf.repeaterID;
+            while(repeaterID.length < 250)
+                repeaterID += "\0";
+            ws.send_string(repeaterID);
+            break;
+        }
         if (rfb_version > rfb_max_version) { 
         if (rfb_version > rfb_max_version) { 
             rfb_version = rfb_max_version;
             rfb_version = rfb_max_version;
         }
         }
@@ -730,6 +740,7 @@ init_msg = function() {
             // Server decides
             // Server decides
             if (ws.rQwait("security scheme", 4)) { return false; }
             if (ws.rQwait("security scheme", 4)) { return false; }
             rfb_auth_scheme = ws.rQshift32();
             rfb_auth_scheme = ws.rQshift32();
+            //rfb_auth_scheme = ws.rQshiftStr(12);
         }
         }
         updateState('Authentication',
         updateState('Authentication',
                 "Authenticating using scheme: " + rfb_auth_scheme);
                 "Authenticating using scheme: " + rfb_auth_scheme);

+ 5 - 0
include/ui.js

@@ -49,6 +49,7 @@ load: function() {
     UI.initSetting('port', window.location.port);
     UI.initSetting('port', window.location.port);
     UI.initSetting('password', '');
     UI.initSetting('password', '');
     UI.initSetting('encrypt', (window.location.protocol === "https:"));
     UI.initSetting('encrypt', (window.location.protocol === "https:"));
+    UI.initSetting('repeaterID', '');
     UI.initSetting('true_color', true);
     UI.initSetting('true_color', true);
     UI.initSetting('cursor', false);
     UI.initSetting('cursor', false);
     UI.initSetting('shared', true);
     UI.initSetting('shared', true);
@@ -258,6 +259,7 @@ toggleSettingsPanel: function() {
         UI.closeSettingsMenu();
         UI.closeSettingsMenu();
     } else {
     } else {
         UI.updateSetting('encrypt');
         UI.updateSetting('encrypt');
+        UI.updateSetting('repeaterID');
         UI.updateSetting('true_color');
         UI.updateSetting('true_color');
         if (UI.rfb.get_display().get_cursor_uri()) {
         if (UI.rfb.get_display().get_cursor_uri()) {
             UI.updateSetting('cursor');
             UI.updateSetting('cursor');
@@ -304,6 +306,7 @@ closeSettingsMenu: function() {
 settingsApply: function() {
 settingsApply: function() {
     //Util.Debug(">> settingsApply");
     //Util.Debug(">> settingsApply");
     UI.saveSetting('encrypt');
     UI.saveSetting('encrypt');
+    UI.saveSetting('repeaterID');
     UI.saveSetting('true_color');
     UI.saveSetting('true_color');
     if (UI.rfb.get_display().get_cursor_uri()) {
     if (UI.rfb.get_display().get_cursor_uri()) {
         UI.saveSetting('cursor');
         UI.saveSetting('cursor');
@@ -415,6 +418,7 @@ updateVisualState: function() {
 
 
     //Util.Debug(">> updateVisualState");
     //Util.Debug(">> updateVisualState");
     $D('noVNC_encrypt').disabled = connected;
     $D('noVNC_encrypt').disabled = connected;
+    $D('noVNC_repeaterID').disabled = connected;
     $D('noVNC_true_color').disabled = connected;
     $D('noVNC_true_color').disabled = connected;
     if (UI.rfb && UI.rfb.get_display() &&
     if (UI.rfb && UI.rfb.get_display() &&
         UI.rfb.get_display().get_cursor_uri()) {
         UI.rfb.get_display().get_cursor_uri()) {
@@ -484,6 +488,7 @@ connect: function() {
     }
     }
 
 
     UI.rfb.set_encrypt(UI.getSetting('encrypt'));
     UI.rfb.set_encrypt(UI.getSetting('encrypt'));
+    UI.rfb.set_repeaterID(UI.getSetting('repeaterID'));
     UI.rfb.set_true_color(UI.getSetting('true_color'));
     UI.rfb.set_true_color(UI.getSetting('true_color'));
     UI.rfb.set_local_cursor(UI.getSetting('cursor'));
     UI.rfb.set_local_cursor(UI.getSetting('cursor'));
     UI.rfb.set_shared(UI.getSetting('shared'));
     UI.rfb.set_shared(UI.getSetting('shared'));

+ 2 - 0
include/util.js

@@ -146,6 +146,8 @@ Util.conf_default = function(cfg, api, defaults, v, mode, type, defval, desc) {
             }
             }
         } else if (type in {'integer':1, 'int':1}) {
         } else if (type in {'integer':1, 'int':1}) {
             val = parseInt(val, 10);
             val = parseInt(val, 10);
+        } else if (type === 'string') {
+            val = String(val);
         } else if (type === 'func') {
         } else if (type === 'func') {
             if (!val) {
             if (!val) {
                 val = function () {};
                 val = function () {};

+ 1 - 0
vnc.html

@@ -140,6 +140,7 @@
                     <li><input id="noVNC_view_only" type="checkbox"> View Only</li>
                     <li><input id="noVNC_view_only" type="checkbox"> View Only</li>
                     <li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
                     <li><input id="noVNC_connectTimeout" type="input"> Connect Timeout (s)</li>
                     <li><input id="noVNC_path" type="input" value="websockify"> Path</li>
                     <li><input id="noVNC_path" type="input" value="websockify"> Path</li>
+                    <li><input id="noVNC_repeaterID" type="input" value=""> Repeater ID</li>
                     <hr>
                     <hr>
                     <!-- Stylesheet selection dropdown -->
                     <!-- Stylesheet selection dropdown -->
                     <li><label><strong>Style: </strong>
                     <li><label><strong>Style: </strong>

+ 2 - 0
vnc_auto.html

@@ -103,6 +103,7 @@
 
 
             password = WebUtil.getQueryVar('password', '');
             password = WebUtil.getQueryVar('password', '');
             path = WebUtil.getQueryVar('path', 'websockify');
             path = WebUtil.getQueryVar('path', 'websockify');
+            
             if ((!host) || (!port)) {
             if ((!host) || (!port)) {
                 updateState('failed',
                 updateState('failed',
                     "Must specify host and port in URL");
                     "Must specify host and port in URL");
@@ -112,6 +113,7 @@
             rfb = new RFB({'target':       $D('noVNC_canvas'),
             rfb = new RFB({'target':       $D('noVNC_canvas'),
                            'encrypt':      WebUtil.getQueryVar('encrypt',
                            'encrypt':      WebUtil.getQueryVar('encrypt',
                                     (window.location.protocol === "https:")),
                                     (window.location.protocol === "https:")),
+                           'repeaterID':   WebUtil.getQueryVar('repeaterID', ''),
                            'true_color':   WebUtil.getQueryVar('true_color', true),
                            'true_color':   WebUtil.getQueryVar('true_color', true),
                            'local_cursor': WebUtil.getQueryVar('cursor', true),
                            'local_cursor': WebUtil.getQueryVar('cursor', true),
                            'shared':       WebUtil.getQueryVar('shared', true),
                            'shared':       WebUtil.getQueryVar('shared', true),