diff --git a/include/rfb.js b/include/rfb.js index 4362ce14..74b45feb 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -134,6 +134,7 @@ Util.conf_defaults(conf, that, defaults, [ ['focusContainer', 'wo', 'dom', document, 'DOM element that captures keyboard input'], ['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'], ['local_cursor', 'rw', 'bool', false, 'Request locally rendered cursor'], ['shared', 'rw', 'bool', true, 'Request shared mode'], @@ -659,10 +660,10 @@ mouseMove = function(x, y) { init_msg = function() { //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, 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)); switch (rfb_state) { @@ -673,7 +674,9 @@ init_msg = function() { } sversion = ws.rQshiftStr(12).substr(4,7); Util.Info("Server ProtocolVersion: " + sversion); + is_repeater = 0; switch (sversion) { + case "000.000": is_repeater = 1; break; // UltraVNC repeater case "003.003": rfb_version = 3.3; break; case "003.006": rfb_version = 3.3; break; // UltraVNC case "003.889": rfb_version = 3.3; break; // Apple Remote Desktop @@ -684,6 +687,13 @@ init_msg = function() { default: 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) { rfb_version = rfb_max_version; } @@ -730,6 +740,7 @@ init_msg = function() { // Server decides if (ws.rQwait("security scheme", 4)) { return false; } rfb_auth_scheme = ws.rQshift32(); + //rfb_auth_scheme = ws.rQshiftStr(12); } updateState('Authentication', "Authenticating using scheme: " + rfb_auth_scheme); diff --git a/include/ui.js b/include/ui.js index eddfa6cd..77ba46a4 100644 --- a/include/ui.js +++ b/include/ui.js @@ -49,6 +49,7 @@ load: function() { UI.initSetting('port', window.location.port); UI.initSetting('password', ''); UI.initSetting('encrypt', (window.location.protocol === "https:")); + UI.initSetting('repeaterID', ''); UI.initSetting('true_color', true); UI.initSetting('cursor', false); UI.initSetting('shared', true); @@ -258,6 +259,7 @@ toggleSettingsPanel: function() { UI.closeSettingsMenu(); } else { UI.updateSetting('encrypt'); + UI.updateSetting('repeaterID'); UI.updateSetting('true_color'); if (UI.rfb.get_display().get_cursor_uri()) { UI.updateSetting('cursor'); @@ -304,6 +306,7 @@ closeSettingsMenu: function() { settingsApply: function() { //Util.Debug(">> settingsApply"); UI.saveSetting('encrypt'); + UI.saveSetting('repeaterID'); UI.saveSetting('true_color'); if (UI.rfb.get_display().get_cursor_uri()) { UI.saveSetting('cursor'); @@ -415,6 +418,7 @@ updateVisualState: function() { //Util.Debug(">> updateVisualState"); $D('noVNC_encrypt').disabled = connected; + $D('noVNC_repeaterID').disabled = connected; $D('noVNC_true_color').disabled = connected; if (UI.rfb && UI.rfb.get_display() && UI.rfb.get_display().get_cursor_uri()) { @@ -484,6 +488,7 @@ connect: function() { } 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_local_cursor(UI.getSetting('cursor')); UI.rfb.set_shared(UI.getSetting('shared')); diff --git a/include/util.js b/include/util.js index 2c0e4ed5..b410506d 100644 --- a/include/util.js +++ b/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}) { val = parseInt(val, 10); + } else if (type === 'string') { + val = String(val); } else if (type === 'func') { if (!val) { val = function () {}; diff --git a/vnc.html b/vnc.html index b6cf85ba..ac1aa770 100644 --- a/vnc.html +++ b/vnc.html @@ -140,6 +140,7 @@
  • View Only
  • Connect Timeout (s)
  • Path
  • +
  • Repeater ID