From 9cae5e5c925fd8e79a7bd50e636f2d090404cb60 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Mon, 15 Jul 2024 05:19:36 -0400 Subject: [PATCH] KASM-6045 fix firefox paste bug (#110) * KASM-6045 fix firefox paste bug * KASM-6045 change logic to have seamless disabled by default for direct KasmVNC connections on Safari and Firefox (#111) * KASM-6045 fixes for inside kasm workspaces --------- Co-authored-by: Matt McClaskey Co-authored-by: Ryan Kuba --- app/ui.js | 33 +++++++++++++++++++++++++++------ core/util/browser.js | 2 +- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/ui.js b/app/ui.js index bdc91797..d973ffd4 100644 --- a/app/ui.js +++ b/app/ui.js @@ -274,16 +274,29 @@ const UI = { UI.initSetting('enable_hidpi', false); UI.toggleKeyboardControls(); - if (WebUtil.isInsideKasmVDI()) { + if ((WebUtil.isInsideKasmVDI()) && (! WebUtil.getConfigVar('show_control_bar'))) { UI.initSetting('clipboard_up', false); UI.initSetting('clipboard_down', false); + // Get the value sent in via URL parameter, default to off UI.initSetting('clipboard_seamless', false); + // Kasm workspaces sets to true if it is allowed, but that does not mean it is supported + let clip_s = UI.getSetting('clipboard_seamless'); + // Its enabled in Kasm Workspaces, but is it supported by the client + if (clip_s) { + if (isFirefox() || isSafari()) { + UI.forceSetting('clipboard_seamless', false); + } + } UI.initSetting('enable_webp', false); UI.initSetting('resize', 'off'); } else { UI.initSetting('clipboard_up', true); UI.initSetting('clipboard_down', true); - UI.initSetting('clipboard_seamless', true); + if (isFirefox() || isSafari()) { + UI.initSetting('clipboard_seamless', false); + } else { + UI.initSetting('clipboard_seamless', true); + } UI.initSetting('enable_webp', true); UI.initSetting('resize', 'remote'); } @@ -1148,14 +1161,22 @@ const UI = { // disable the labels that belong to disabled input elements. disableSetting(name) { const ctrl = document.getElementById('noVNC_setting_' + name); - ctrl.disabled = true; - ctrl.label.classList.add('noVNC_disabled'); + if (ctrl) { + ctrl.disabled = true; + if (ctrl.label) { + ctrl.label.classList.add('noVNC_disabled'); + } + } }, enableSetting(name) { const ctrl = document.getElementById('noVNC_setting_' + name); - ctrl.disabled = false; - ctrl.label.classList.remove('noVNC_disabled'); + if (ctrl) { + ctrl.disabled = false; + if (ctrl.label) { + ctrl.label.classList.remove('noVNC_disabled'); + } + } }, /* ------^------- diff --git a/core/util/browser.js b/core/util/browser.js index 937fbd1e..436738b9 100644 --- a/core/util/browser.js +++ b/core/util/browser.js @@ -164,7 +164,7 @@ export function isFirefox() { export function supportsBinaryClipboard() { //Safari does support the clipbaord API but has a lot of security restrictions - if (isSafari()) { return false; } + if (isSafari() || isFirefox()) { return false; } return (navigator.clipboard && typeof navigator.clipboard.read === "function"); }