From 12acb663ebae597e70d3b23aeb61330522102f5d Mon Sep 17 00:00:00 2001 From: William Lightning Date: Fri, 22 Jun 2012 22:30:05 -0700 Subject: [PATCH] Change RepeaterID to be a config option --- include/rfb.js | 7 +++---- include/util.js | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/rfb.js b/include/rfb.js index 4de9be9d..74b45feb 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -39,7 +39,6 @@ var that = {}, // Public API methods rfb_port = 5900, rfb_password = '', rfb_path = '', - rfb_repeaterID = '', rfb_state = 'disconnected', rfb_version = 0, @@ -135,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'], @@ -688,7 +688,7 @@ init_msg = function() { return fail("Invalid server version " + sversion); } if (is_repeater) { - repeaterID = rfb_repeaterID; + repeaterID = conf.repeaterID; while(repeaterID.length < 250) repeaterID += "\0"; ws.send_string(repeaterID); @@ -1759,14 +1759,13 @@ clientCutText = function(text) { // Public API interface functions // -that.connect = function(host, port, password, path, repeaterID) { +that.connect = function(host, port, password, path) { //Util.Debug(">> connect"); rfb_host = host; rfb_port = port; rfb_password = (password !== undefined) ? password : ""; rfb_path = (path !== undefined) ? path : ""; - rfb_repeaterID = (repeaterID !== undefined) ? repeaterID : ""; if ((!rfb_host) || (!rfb_port)) { return fail("Must set host and port"); 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 () {};