diff options
author | Joel Martin <github@martintribe.org> | 2012-06-23 14:22:47 -0500 |
---|---|---|
committer | Joel Martin <github@martintribe.org> | 2012-06-23 14:22:47 -0500 |
commit | b50f34067432b62ac9f323957fb8960b5b4b3d0b (patch) | |
tree | fb2741e662bffc3dece32468bc1b1aaaf90edbff | |
parent | 2090f1af673eda5d2d6df8f7c44509881f497d4c (diff) | |
download | novnc-b50f34067432b62ac9f323957fb8960b5b4b3d0b.tar.gz |
UltraVNC repeaterID cleanup.
https://github.com/kanaka/noVNC/issues/103
https://github.com/kanaka/noVNC/pull/170
-rw-r--r-- | include/rfb.js | 8 | ||||
-rw-r--r-- | include/ui.js | 11 | ||||
-rw-r--r-- | include/util.js | 2 | ||||
-rw-r--r-- | vnc_auto.html | 2 |
4 files changed, 13 insertions, 10 deletions
diff --git a/include/rfb.js b/include/rfb.js index 74b45fe..e32b797 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -134,7 +134,6 @@ 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'], @@ -143,6 +142,9 @@ Util.conf_defaults(conf, that, defaults, [ ['connectTimeout', 'rw', 'int', def_con_timeout, 'Time (s) to wait for connection'], ['disconnectTimeout', 'rw', 'int', 3, 'Time (s) to wait for disconnection'], + // UltraVNC repeater ID to connect to + ['repeaterID', 'rw', 'str', '', 'RepeaterID to connect to'], + ['viewportDrag', 'rw', 'bool', false, 'Move the viewport on mouse drags'], ['check_rate', 'rw', 'int', 217, 'Timing (ms) of send/receive check'], @@ -689,8 +691,9 @@ init_msg = function() { } if (is_repeater) { repeaterID = conf.repeaterID; - while(repeaterID.length < 250) + while (repeaterID.length < 250) { repeaterID += "\0"; + } ws.send_string(repeaterID); break; } @@ -740,7 +743,6 @@ 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 77ba46a..a0d3d4e 100644 --- a/include/ui.js +++ b/include/ui.js @@ -49,13 +49,13 @@ 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); UI.initSetting('view_only', false); UI.initSetting('connectTimeout', 2); UI.initSetting('path', 'websockify'); + UI.initSetting('repeaterID', ''); UI.rfb = RFB({'target': $D('noVNC_canvas'), 'onUpdateState': UI.updateState, @@ -259,7 +259,6 @@ 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'); @@ -272,6 +271,7 @@ toggleSettingsPanel: function() { UI.updateSetting('view_only'); UI.updateSetting('connectTimeout'); UI.updateSetting('path'); + UI.updateSetting('repeaterID'); UI.updateSetting('stylesheet'); UI.updateSetting('logging'); @@ -306,7 +306,6 @@ 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'); @@ -316,6 +315,7 @@ settingsApply: function() { UI.saveSetting('view_only'); UI.saveSetting('connectTimeout'); UI.saveSetting('path'); + UI.saveSetting('repeaterID'); UI.saveSetting('stylesheet'); UI.saveSetting('logging'); @@ -418,7 +418,6 @@ 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()) { @@ -431,6 +430,7 @@ updateVisualState: function() { $D('noVNC_view_only').disabled = connected; $D('noVNC_connectTimeout').disabled = connected; $D('noVNC_path').disabled = connected; + $D('noVNC_repeaterID').disabled = connected; if (connected) { UI.setViewClip(); @@ -488,14 +488,15 @@ 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')); UI.rfb.set_view_only(UI.getSetting('view_only')); UI.rfb.set_connectTimeout(UI.getSetting('connectTimeout')); + UI.rfb.set_repeaterID(UI.getSetting('repeaterID')); UI.rfb.connect(host, port, password, path); + //Close dialog. setTimeout(UI.setBarPosition, 100); $D('noVNC_logo').style.display = "none"; diff --git a/include/util.js b/include/util.js index b410506..dff0f22 100644 --- a/include/util.js +++ b/include/util.js @@ -146,7 +146,7 @@ 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') { + } else if (type === 'str') { val = String(val); } else if (type === 'func') { if (!val) { diff --git a/vnc_auto.html b/vnc_auto.html index 47835b3..95b7cad 100644 --- a/vnc_auto.html +++ b/vnc_auto.html @@ -103,7 +103,7 @@ password = WebUtil.getQueryVar('password', ''); path = WebUtil.getQueryVar('path', 'websockify'); - + if ((!host) || (!port)) { updateState('failed', "Must specify host and port in URL"); |