KASM-3891 add URL param to show control bar in iframe (#56)

* KASM-3891 add URL param to show control bar in iframe and post message to parent on control bar open and close

* KASM-3891 send fullscreen requests to parent and bypass local logic

---------

Co-authored-by: ryan.kuba <ryan.kuba@kasmweb.com>
This commit is contained in:
Ryan Kuba 2023-02-16 08:54:56 -08:00 committed by GitHub
parent 46e361a4e1
commit 8ec5d5d7d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -775,6 +775,9 @@ const UI = {
openControlbar() {
document.getElementById('noVNC_control_bar')
.classList.add("noVNC_open");
if (WebUtil.isInsideKasmVDI()) {
parent.postMessage({ action: 'control_open', value: 'Control bar opened'}, '*' );
}
},
closeControlbar() {
@ -784,6 +787,9 @@ const UI = {
if (UI.rfb) {
UI.rfb.focus();
}
if (WebUtil.isInsideKasmVDI()) {
parent.postMessage({ action: 'control_close', value: 'Control bar closed'}, '*' );
}
},
toggleControlbar() {
@ -1434,7 +1440,9 @@ const UI = {
UI.rfb.addEventListener("clipboard", UI.clipboardRx);
}
UI.rfb.addEventListener("disconnect", UI.disconnectedRx);
if (! WebUtil.getConfigVar('show_control_bar')) {
document.getElementById('noVNC_control_bar_anchor').setAttribute('style', 'display: none');
}
//keep alive for websocket connection to stay open, since we may not control reverse proxies
//send a keep alive within a window that we control
@ -1774,6 +1782,10 @@ const UI = {
* ------v------*/
toggleFullscreen() {
if (WebUtil.isInsideKasmVDI()) {
parent.postMessage({ action: 'fullscreen', value: 'Fullscreen clicked'}, '*' );
return;
}
if (document.fullscreenElement || // alternative standard method
document.mozFullScreenElement || // currently working methods
document.webkitFullscreenElement ||