rfb_port = 5900,
rfb_password = '',
rfb_path = '',
+ rfb_repeaterID = '',
rfb_state = 'disconnected',
rfb_version = 0,
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) {
}
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
default:
return fail("Invalid server version " + sversion);
}
+ if (is_repeater) {
+ repeaterID = rfb_repeaterID;
+ while(repeaterID.length < 250)
+ repeaterID += "\0";
+ ws.send_string(repeaterID);
+ break;
+ }
if (rfb_version > rfb_max_version) {
rfb_version = rfb_max_version;
}
// 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);
// Public API interface functions
//
-that.connect = function(host, port, password, path) {
+that.connect = function(host, port, password, path, repeaterID) {
//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");
}
window.onload = function () {
- var host, port, password, path, token;
+ var host, port, password, path, token, repeaterID;
$D('sendCtrlAltDelButton').style.display = "inline";
$D('sendCtrlAltDelButton').onclick = sendCtrlAltDel;
password = WebUtil.getQueryVar('password', '');
path = WebUtil.getQueryVar('path', 'websockify');
+ repeaterID = WebUtil.getQueryVar('repeaterid','');
+
if ((!host) || (!port)) {
updateState('failed',
"Must specify host and port in URL");
'view_only': WebUtil.getQueryVar('view_only', false),
'updateState': updateState,
'onPasswordRequired': passwordRequired});
- rfb.connect(host, port, password, path);
+ rfb.connect(host, port, password, path, repeaterID);
};
</script>