Handle if desktopName isn't set when connected

We can't guarantee that the desktopName event has been fired before the
connect event.
This commit is contained in:
Samuel Mannehed 2018-08-16 12:07:31 +02:00
parent a793df3d6d
commit 22000b93d5
2 changed files with 17 additions and 5 deletions

View File

@ -1074,10 +1074,14 @@ const UI = {
UI.inhibit_reconnect = false;
let msg;
if (UI.getSetting('encrypt')) {
msg = _("Connected (encrypted) to ") + UI.desktopName;
if (UI.desktopName !== '') {
if (UI.getSetting('encrypt')) {
msg = _("Connected (encrypted) to ") + UI.desktopName;
} else {
msg = _("Connected (unencrypted) to ") + UI.desktopName;
}
} else {
msg = _("Connected (unencrypted) to ") + UI.desktopName;
msg = _("Connected");
}
UI.showStatus(msg);
UI.updateVisualState('connected');

View File

@ -131,11 +131,19 @@
function connected(e) {
document.getElementById('sendCtrlAltDelButton').disabled = false;
let encryption;
if (WebUtil.getConfigVar('encrypt',
(window.location.protocol === "https:"))) {
status("Connected (encrypted) to " + desktopName, "normal");
encryption = "unencrypted";
} else {
status("Connected (unencrypted) to " + desktopName, "normal");
encryption = "encrypted";
}
if (desktopName) {
status("Connected (" + encryption + ") to " + desktopName, "normal");
} else {
status("Connected (" + encryption + ")", "normal");
}
}