[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract information from RFB to the UI #950

Merged
merged 9 commits into from
Nov 17, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Abstract RFB errors to avoid sending strings
The API allowed strings to be passed from the RFB module to the
application using the disconnect reason. This caused problems since
the application didn't have control over translations for these
strings.

Most of the information being passed using this string was very
technical and not helpful to the end user. One exception to this was
the security result information regarding for example authentication
failures. The protocol allows the VNC server to pass a string
directly to the user in the security result.

So the disconnect reason is replaced by a boolean saying if the
disconnection was clean or not. And for the security result information
from the server, a new event has been added.
  • Loading branch information
samhed committed Nov 14, 2017
commit d472f3f19ef8cb9000ccfdf854d9f40e587fac0a
20 changes: 18 additions & 2 deletions app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ var UI = {
UI.rfb.addEventListener("connect", UI.connectFinished);
UI.rfb.addEventListener("disconnect", UI.disconnectFinished);
UI.rfb.addEventListener("credentialsrequired", UI.credentials);
UI.rfb.addEventListener("securityfailure", UI.securityFailed);
UI.rfb.addEventListener("capabilities", function () { UI.updatePowerButton(); UI.initialResize(); });
UI.rfb.addEventListener("clipboard", UI.clipboardReceive);
UI.rfb.addEventListener("bell", UI.bell);
Expand Down Expand Up @@ -1080,9 +1081,10 @@ var UI = {
// UI.disconnect() won't be used in those cases.
UI.connected = false;

if (typeof e.detail.reason !== 'undefined') {
UI.showStatus(e.detail.reason, 'error');
if (!e.detail.clean) {
UI.updateVisualState('disconnected');
UI.showStatus(_("Something went wrong, connection is closed"),
'error');
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibit_reconnect) {
UI.updateVisualState('reconnecting');

Expand All @@ -1098,6 +1100,20 @@ var UI = {
UI.openConnectPanel();
},

securityFailed: function (e) {
let msg = "";
// On security failures we might get a string with a reason
// directly from the server. Note that we can't control if
// this string is translated or not.
if ('reason' in e.detail) {
msg = _("New connection has been rejected with reason: ") +
e.detail.reason;
} else {
msg = _("New connection has been rejected");
}
UI.showStatus(msg, 'error');
},

cancelReconnect: function() {
if (UI.reconnect_callback !== null) {
clearTimeout(UI.reconnect_callback);
Expand Down
Loading