Add URL parameter for automatic reconnects
Sometimes the connection just fails and users need to reconnecct. When the URL parameter reconnect=true is set, noVNC reconnects automatically. The delay can be set with the URL parameter reconnect_delay.
This commit is contained in:
parent
33e1462999
commit
dc634594cb
10
app/ui.js
10
app/ui.js
|
|
@ -56,6 +56,9 @@ var UI;
|
||||||
ctrlOn: false,
|
ctrlOn: false,
|
||||||
altOn: false,
|
altOn: false,
|
||||||
|
|
||||||
|
reconnect: false,
|
||||||
|
reconnect_delay: 500,
|
||||||
|
|
||||||
// Setup rfb object, load settings from browser storage, then call
|
// Setup rfb object, load settings from browser storage, then call
|
||||||
// UI.init to setup the UI/menus
|
// UI.init to setup the UI/menus
|
||||||
load: function(callback) {
|
load: function(callback) {
|
||||||
|
|
@ -123,6 +126,10 @@ var UI;
|
||||||
autoconnect = false;
|
autoconnect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var reconnect = WebUtil.getConfigVar('reconnect', false);
|
||||||
|
UI.reconnect = reconnect === 'true' || reconnect == '1';
|
||||||
|
UI.reconnect_delay = parseInt(WebUtil.getConfigVar('reconnect_delay', UI.reconnect_delay));
|
||||||
|
|
||||||
UI.updateVisualState();
|
UI.updateVisualState();
|
||||||
|
|
||||||
document.getElementById('noVNC_setting_host').focus();
|
document.getElementById('noVNC_setting_host').focus();
|
||||||
|
|
@ -282,6 +289,9 @@ var UI;
|
||||||
case 'disconnected':
|
case 'disconnected':
|
||||||
document.getElementById('noVNC_logo').style.display = "block";
|
document.getElementById('noVNC_logo').style.display = "block";
|
||||||
document.getElementById('noVNC_screen').style.display = "none";
|
document.getElementById('noVNC_screen').style.display = "none";
|
||||||
|
if(UI.reconnect) {
|
||||||
|
setTimeout(UI.connect, UI.reconnect_delay);
|
||||||
|
}
|
||||||
/* falls through */
|
/* falls through */
|
||||||
case 'loaded':
|
case 'loaded':
|
||||||
klass = "noVNC_status_normal";
|
klass = "noVNC_status_normal";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue