From c81df7f198ca53d71a26d6a330e98bc4d38c02cc Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 7 Feb 2021 11:12:18 +0000 Subject: [PATCH 1/2] KASM-1298 manually merged in offline changes --- kasmweb/app/ui.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kasmweb/app/ui.js b/kasmweb/app/ui.js index 952f109..a5b614a 100644 --- a/kasmweb/app/ui.js +++ b/kasmweb/app/ui.js @@ -416,6 +416,10 @@ const UI = { document.documentElement.classList.remove("noVNC_reconnecting"); const transition_elem = document.getElementById("noVNC_transition_text"); + if (WebUtil.isInsideKasmVDI()) + { + parent.postMessage({ action: 'connection_state', value: state}, '*' ); + } switch (state) { case 'init': break; @@ -1253,8 +1257,10 @@ const UI = { UI.rfb.addEventListener("credentialsrequired", UI.credentials); UI.rfb.addEventListener("securityfailure", UI.securityFailed); UI.rfb.addEventListener("capabilities", UI.updatePowerButton); - UI.rfb.addEventListener("clipboard", UI.clipboardReceive); - UI.rfb.addEventListener("bottleneck_stats", UI.bottleneckStatsRecieve); + if (UI.rfb.clipboardDown){ + UI.rfb.addEventListener("clipboard", UI.clipboardReceive); + } + UI.rfb.addEventListener("bottleneck_stats", UI.bottleneckStatsRecieve); document.addEventListener('mouseenter', UI.enterVNC); document.addEventListener('mouseleave', UI.leaveVNC); @@ -1459,7 +1465,9 @@ const UI = { if (event.data && event.data.action) { switch (event.data.action) { case 'clipboardsnd': - UI.rfb.clipboardPasteFrom(event.data.value); + if (UI.rfb.clipboardUp) { + UI.rfb.clipboardPasteFrom(event.data.value); + } break; case 'setvideoquality': UI.rfb.videoQuality = event.data.value; From f981b1e88a7bbf07af94f2d371459a3f46884a89 Mon Sep 17 00:00:00 2001 From: Kasm <44181855+kasmtech@users.noreply.github.com> Date: Fri, 26 Feb 2021 10:10:00 -0500 Subject: [PATCH 2/2] Update ui.js --- kasmweb/app/ui.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/kasmweb/app/ui.js b/kasmweb/app/ui.js index a5b614a..1e2d7a6 100644 --- a/kasmweb/app/ui.js +++ b/kasmweb/app/ui.js @@ -172,7 +172,6 @@ const UI = { UI.initSetting('port', port); UI.initSetting('encrypt', (window.location.protocol === "https:")); UI.initSetting('view_clip', false); - UI.initSetting('resize', 'remote'); UI.initSetting('shared', true); UI.initSetting('view_only', false); UI.initSetting('show_dot', false); @@ -181,15 +180,26 @@ const UI = { UI.initSetting('reconnect', false); UI.initSetting('reconnect_delay', 5000); UI.initSetting('idle_disconnect', 20); - UI.initSetting('video_quality', 3); - UI.initSetting('clipboard_up', true); - UI.initSetting('clipboard_down', true); - UI.initSetting('clipboard_seamless', true); UI.initSetting('prefer_local_cursor', true); - UI.initSetting('enable_webp', true); UI.initSetting('toggle_control_panel', false); UI.initSetting('enable_perf_stats', false); - + + if (WebUtil.isInsideKasmVDI()) { + UI.initSetting('video_quality', 1); + UI.initSetting('clipboard_up', false); + UI.initSetting('clipboard_down', false); + UI.initSetting('clipboard_seamless', false); + UI.initSetting('enable_webp', false); + UI.initSetting('resize', 'off'); + } else { + UI.initSetting('video_quality', 3); + UI.initSetting('clipboard_up', true); + UI.initSetting('clipboard_down', true); + UI.initSetting('clipboard_seamless', true); + UI.initSetting('enable_webp', true); + UI.initSetting('resize', 'remote'); + } + UI.setupSettingLabels(); }, // Adds a link to the label elements on the corresponding input elements @@ -1257,9 +1267,7 @@ const UI = { UI.rfb.addEventListener("credentialsrequired", UI.credentials); UI.rfb.addEventListener("securityfailure", UI.securityFailed); UI.rfb.addEventListener("capabilities", UI.updatePowerButton); - if (UI.rfb.clipboardDown){ - UI.rfb.addEventListener("clipboard", UI.clipboardReceive); - } + UI.rfb.addEventListener("clipboard", UI.clipboardReceive); UI.rfb.addEventListener("bottleneck_stats", UI.bottleneckStatsRecieve); document.addEventListener('mouseenter', UI.enterVNC); @@ -1301,7 +1309,9 @@ const UI = { window.attachEvent('onload', WindowLoad); window.attachEvent('message', UI.receiveMessage); } - UI.rfb.addEventListener("clipboard", UI.clipboardRx); + if (UI.rfb.clipboardDown){ + UI.rfb.addEventListener("clipboard", UI.clipboardRx); + } UI.rfb.addEventListener("disconnect", UI.disconnectedRx); document.getElementById('noVNC_control_bar_anchor').setAttribute('style', 'display: none'); document.getElementById('noVNC_connect_dlg').innerHTML = '';