@@ -41,6 +41,8 @@ const UI = {
4141 reconnectCallback : null ,
4242 reconnectPassword : null ,
4343
44+ fullScreen : false ,
45+
4446 prime ( ) {
4547 return WebUtil . initSettings ( ) . then ( ( ) => {
4648 if ( document . readyState === "interactive" || document . readyState === "complete" ) {
@@ -158,6 +160,7 @@ const UI = {
158160 /* Populate the controls if defaults are provided in the URL */
159161 UI . initSetting ( 'host' , window . location . hostname ) ;
160162 UI . initSetting ( 'port' , port ) ;
163+ UI . initSetting ( 'token' , window . location . token ) ;
161164 UI . initSetting ( 'encrypt' , ( window . location . protocol === "https:" ) ) ;
162165 UI . initSetting ( 'view_clip' , false ) ;
163166 UI . initSetting ( 'resize' , 'off' ) ;
@@ -317,10 +320,10 @@ const UI = {
317320 addClipboardHandlers ( ) {
318321 document . getElementById ( "noVNC_clipboard_button" )
319322 . addEventListener ( 'click' , UI . toggleClipboardPanel ) ;
320- document . getElementById ( "noVNC_clipboard_text" )
321- . addEventListener ( 'change' , UI . clipboardSend ) ;
322323 document . getElementById ( "noVNC_clipboard_clear_button" )
323324 . addEventListener ( 'click' , UI . clipboardClear ) ;
325+ document . getElementById ( "noVNC_clipboard_send_button" )
326+ . addEventListener ( 'click' , UI . clipboardSend ) ;
324327 } ,
325328
326329 // Add a call to save settings when the element changes,
@@ -944,6 +947,8 @@ const UI = {
944947 UI . closeClipboardPanel ( ) ;
945948 } else {
946949 UI . openClipboardPanel ( ) ;
950+ setTimeout ( ( ) => document
951+ . getElementById ( 'noVNC_clipboard_text' ) . focus ( ) , 100 ) ;
947952 }
948953 } ,
949954
@@ -955,14 +960,13 @@ const UI = {
955960
956961 clipboardClear ( ) {
957962 document . getElementById ( 'noVNC_clipboard_text' ) . value = "" ;
958- UI . rfb . clipboardPasteFrom ( "" ) ;
959963 } ,
960964
961965 clipboardSend ( ) {
962966 const text = document . getElementById ( 'noVNC_clipboard_text' ) . value ;
963- Log . Debug ( ">> UI.clipboardSend: " + text . substr ( 0 , 40 ) + "..." ) ;
964- UI . rfb . clipboardPasteFrom ( text ) ;
965- Log . Debug ( "<< UI.clipboardSend" ) ;
967+ UI . rfb . sendText ( text ) ;
968+ UI . closeClipboardPanel ( ) ;
969+ UI . focusOnConsole ( ) ;
966970 } ,
967971
968972/* ------^-------
@@ -991,6 +995,7 @@ const UI = {
991995 const host = UI . getSetting ( 'host' ) ;
992996 const port = UI . getSetting ( 'port' ) ;
993997 const path = UI . getSetting ( 'path' ) ;
998+ const token = UI . getSetting ( 'token' )
994999
9951000 if ( typeof password === 'undefined' ) {
9961001 password = WebUtil . getConfigVar ( 'password' ) ;
@@ -1022,6 +1027,7 @@ const UI = {
10221027 url += ':' + port ;
10231028 }
10241029 url += '/' + path ;
1030+ url += '?token=' + token ;
10251031
10261032 UI . rfb = new RFB ( document . getElementById ( 'noVNC_container' ) , url ,
10271033 { shared : UI . getSetting ( 'shared' ) ,
@@ -1087,9 +1093,9 @@ const UI = {
10871093
10881094 let msg ;
10891095 if ( UI . getSetting ( 'encrypt' ) ) {
1090- msg = _ ( "Connected (encrypted) to " ) + UI . desktopName ;
1096+ msg = _ ( "Connected" ) ;
10911097 } else {
1092- msg = _ ( "Connected (unencrypted) to " ) + UI . desktopName ;
1098+ msg = _ ( "Connected" )
10931099 }
10941100 UI . showStatus ( msg ) ;
10951101 UI . updateVisualState ( 'connected' ) ;
@@ -1206,38 +1212,14 @@ const UI = {
12061212 * ------v------*/
12071213
12081214 toggleFullscreen ( ) {
1209- if ( document . fullscreenElement || // alternative standard method
1210- document . mozFullScreenElement || // currently working methods
1211- document . webkitFullscreenElement ||
1212- document . msFullscreenElement ) {
1213- if ( document . exitFullscreen ) {
1214- document . exitFullscreen ( ) ;
1215- } else if ( document . mozCancelFullScreen ) {
1216- document . mozCancelFullScreen ( ) ;
1217- } else if ( document . webkitExitFullscreen ) {
1218- document . webkitExitFullscreen ( ) ;
1219- } else if ( document . msExitFullscreen ) {
1220- document . msExitFullscreen ( ) ;
1221- }
1222- } else {
1223- if ( document . documentElement . requestFullscreen ) {
1224- document . documentElement . requestFullscreen ( ) ;
1225- } else if ( document . documentElement . mozRequestFullScreen ) {
1226- document . documentElement . mozRequestFullScreen ( ) ;
1227- } else if ( document . documentElement . webkitRequestFullscreen ) {
1228- document . documentElement . webkitRequestFullscreen ( Element . ALLOW_KEYBOARD_INPUT ) ;
1229- } else if ( document . body . msRequestFullscreen ) {
1230- document . body . msRequestFullscreen ( ) ;
1231- }
1232- }
1233- UI . updateFullscreenButton ( ) ;
1215+ this . fullScreen = ! this . fullScreen
1216+ UI . rfb . scaleViewport = this . fullScreen
1217+ UI . updateFullscreenButton ( this . fullScreen ) ;
1218+ UI . focusOnConsole ( ) ;
12341219 } ,
12351220
1236- updateFullscreenButton ( ) {
1237- if ( document . fullscreenElement || // alternative standard method
1238- document . mozFullScreenElement || // currently working methods
1239- document . webkitFullscreenElement ||
1240- document . msFullscreenElement ) {
1221+ updateFullscreenButton ( fullScreen ) {
1222+ if ( fullScreen ) {
12411223 document . getElementById ( 'noVNC_fullscreen_button' )
12421224 . classList . add ( "noVNC_selected" ) ;
12431225 } else {
@@ -1598,21 +1580,24 @@ const UI = {
15981580 UI . idleControlbar ( ) ;
15991581 } ,
16001582
1601- sendKey ( keysym , code , down ) {
1602- UI . rfb . sendKey ( keysym , code , down ) ;
1603-
1604- // Move focus to the screen in order to be able to use the
1605- // keyboard right after these extra keys.
1606- // The exception is when a virtual keyboard is used, because
1607- // if we focus the screen the virtual keyboard would be closed.
1608- // In this case we focus our special virtual keyboard input
1609- // element instead.
1583+ // Move focus to the screen in order to be able to use the
1584+ // keyboard right after these extra keys.
1585+ // The exception is when a virtual keyboard is used, because
1586+ // if we focus the screen the virtual keyboard would be closed.
1587+ // In this case we focus our special virtual keyboard input
1588+ // element instead.
1589+ focusOnConsole ( ) {
16101590 if ( document . getElementById ( 'noVNC_keyboard_button' )
16111591 . classList . contains ( "noVNC_selected" ) ) {
16121592 document . getElementById ( 'noVNC_keyboardinput' ) . focus ( ) ;
16131593 } else {
16141594 UI . rfb . focus ( ) ;
16151595 }
1596+ } ,
1597+
1598+ sendKey ( keysym , code , down ) {
1599+ UI . rfb . sendKey ( keysym , code , down ) ;
1600+ UI . focusOnConsole ( )
16161601 // fade out the controlbar to highlight that
16171602 // the focus has been moved to the screen
16181603 UI . idleControlbar ( ) ;
0 commit comments