mirror of
https://github.com/novnc/noVNC.git
synced 2026-06-06 04:19:41 +00:00
Remove psuedo-UTF8 encoding.
It's less efficient on average that base64 (150% vs 133%). It's non-standard (0 shifted to 256 before encoding). And I rarely use it.
This commit is contained in:
@@ -45,8 +45,6 @@ load: function(target) {
|
||||
html += ' <ul>';
|
||||
html += ' <li><input id="VNC_encrypt"';
|
||||
html += ' type="checkbox"> Encrypt</li>';
|
||||
html += ' <li><input id="VNC_base64"';
|
||||
html += ' type="checkbox" checked> Base64 Encode</li>';
|
||||
html += ' <li><input id="VNC_true_color"';
|
||||
html += ' type="checkbox" checked> True Color</li>';
|
||||
html += ' <li><input id="VNC_cursor"';
|
||||
@@ -113,7 +111,6 @@ load: function(target) {
|
||||
DC.initSetting('port', '');
|
||||
DC.initSetting('password', '');
|
||||
DC.initSetting('encrypt', false);
|
||||
DC.initSetting('base64', true);
|
||||
DC.initSetting('true_color', true);
|
||||
DC.initSetting('cursor', true);
|
||||
|
||||
@@ -212,7 +209,6 @@ clickSettingsMenu: function() {
|
||||
DC.closeSettingsMenu();
|
||||
} else {
|
||||
DC.updateSetting('encrypt');
|
||||
DC.updateSetting('base64');
|
||||
DC.updateSetting('true_color');
|
||||
if (DC.rfb.get_canvas().get_cursor_uri()) {
|
||||
DC.updateSetting('cursor');
|
||||
@@ -243,7 +239,6 @@ closeSettingsMenu: function() {
|
||||
settingsDisabled: function(disabled) {
|
||||
var DC = DefaultControls;
|
||||
$('VNC_encrypt').disabled = disabled;
|
||||
$('VNC_base64').disabled = disabled;
|
||||
$('VNC_true_color').disabled = disabled;
|
||||
if (DC.rfb && DC.rfb.get_canvas().get_cursor_uri()) {
|
||||
$('VNC_cursor').disabled = disabled;
|
||||
@@ -258,7 +253,6 @@ settingsApply: function() {
|
||||
//Util.Debug(">> settingsApply");
|
||||
var DC = DefaultControls;
|
||||
DC.saveSetting('encrypt');
|
||||
DC.saveSetting('base64');
|
||||
DC.saveSetting('true_color');
|
||||
if (DC.rfb.get_canvas().get_cursor_uri()) {
|
||||
DC.saveSetting('cursor');
|
||||
@@ -361,7 +355,6 @@ connect: function() {
|
||||
}
|
||||
|
||||
DC.rfb.set_encrypt(DC.getSetting('encrypt'));
|
||||
DC.rfb.set_b64encode(DC.getSetting('base64'));
|
||||
DC.rfb.set_true_color(DC.getSetting('true_color'));
|
||||
DC.rfb.set_local_cursor(DC.getSetting('cursor'));
|
||||
|
||||
|
||||
@@ -141,8 +141,6 @@ Util.conf_default(conf, that, 'focusContainer', document);
|
||||
|
||||
Util.conf_default(conf, that, 'encrypt', false, true);
|
||||
Util.conf_default(conf, that, 'true_color', true, true);
|
||||
// false means UTF-8 on the wire
|
||||
Util.conf_default(conf, that, 'b64encode', true, true);
|
||||
Util.conf_default(conf, that, 'local_cursor', true, true);
|
||||
|
||||
// time to wait for connection
|
||||
@@ -250,12 +248,6 @@ function init_ws() {
|
||||
uri = "ws://";
|
||||
}
|
||||
uri += rfb_host + ":" + rfb_port + "/";
|
||||
if (conf.b64encode) {
|
||||
vars.push("b64encode");
|
||||
}
|
||||
if (vars.length > 0) {
|
||||
uri += "?" + vars.join("&");
|
||||
}
|
||||
Util.Info("connecting to " + uri);
|
||||
ws = new WebSocket(uri);
|
||||
|
||||
@@ -447,34 +439,15 @@ updateState = function(state, statusMsg) {
|
||||
};
|
||||
|
||||
function encode_message(arr) {
|
||||
if (conf.b64encode) {
|
||||
/* base64 encode */
|
||||
SQ = SQ + Base64.encode(arr);
|
||||
} else {
|
||||
/* UTF-8 encode. 0 -> 256 to avoid WebSockets framing */
|
||||
SQ = SQ + arr.map(function (num) {
|
||||
if (num === 0) {
|
||||
return String.fromCharCode(256);
|
||||
} else {
|
||||
return String.fromCharCode(num);
|
||||
}
|
||||
} ).join('');
|
||||
}
|
||||
/* base64 encode */
|
||||
SQ = SQ + Base64.encode(arr);
|
||||
}
|
||||
|
||||
function decode_message(data) {
|
||||
var i, length;
|
||||
//Util.Debug(">> decode_message: " + data);
|
||||
if (conf.b64encode) {
|
||||
/* base64 decode */
|
||||
RQ = RQ.concat(Base64.decode(data, 0));
|
||||
} else {
|
||||
/* UTF-8 decode. 256 -> 0 to WebSockets framing */
|
||||
length = data.length;
|
||||
for (i=0; i < length; i += 1) {
|
||||
RQ.push(data.charCodeAt(i) % 256);
|
||||
}
|
||||
}
|
||||
/* base64 decode */
|
||||
RQ = RQ.concat(Base64.decode(data, 0));
|
||||
//Util.Debug(">> decode_message, RQ: " + RQ);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user