-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from remcoros/fix-idle-disconnect
add 'reconnect' setting and patch noVNC to fix issue after browser tab has been idle.
- Loading branch information
Showing
8 changed files
with
172 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/app/ui.js b/app/ui.js | ||
index d973ffd..8d9515e 100644 | ||
--- a/app/ui.js | ||
+++ b/app/ui.js | ||
@@ -1628,15 +1628,17 @@ const UI = { | ||
// UI.disconnect() won't be used in those cases. | ||
UI.connected = false; | ||
|
||
+ clearInterval(UI._sessionTimeoutInterval); | ||
+ | ||
UI.rfb = undefined; | ||
|
||
if (!e.detail.clean) { | ||
UI.updateVisualState('disconnected'); | ||
if (wasConnected) { | ||
UI.showStatus(_("Something went wrong, connection is closed"), | ||
- 'error'); | ||
+ 'error', 0, true); | ||
} else { | ||
- UI.showStatus(_("Failed to connect to server"), 'error'); | ||
+ UI.showStatus(_("Failed to connect to server"), 'error', 0, true); | ||
} | ||
} else if (UI.getSetting('reconnect', false) === true && !UI.inhibitReconnect) { | ||
UI.updateVisualState('reconnecting'); | ||
@@ -1646,7 +1648,7 @@ const UI = { | ||
return; | ||
} else { | ||
UI.updateVisualState('disconnected'); | ||
- UI.showStatus(_("Disconnected"), 'normal'); | ||
+ UI.showStatus(_("Disconnected"), 'error', 0, true); | ||
} | ||
|
||
document.title = PAGE_TITLE; | ||
diff --git a/vnc.html b/vnc.html | ||
index e5b5177..565f273 100644 | ||
--- a/vnc.html | ||
+++ b/vnc.html | ||
@@ -478,13 +478,14 @@ | ||
</div> | ||
</li> | ||
<li><hr></li> | ||
- <li> | ||
+ <li class="noVNC_hidden"> | ||
<label class="switch"> | ||
<input id="noVNC_setting_reconnect" type="checkbox"> | ||
+ <span class="slider round"></span> | ||
<span class="slider-label">Automatic Reconnect</span> | ||
</label> | ||
</li> | ||
- <li> | ||
+ <li class="noVNC_hidden"> | ||
<label for="noVNC_setting_reconnect_delay">Reconnect Delay (ms):</label> | ||
<input id="noVNC_setting_reconnect_delay" type="number"> | ||
</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
import { compat, types as T } from "../deps.ts"; | ||
|
||
export const migration: T.ExpectedExports.migration = compat.migrations | ||
.fromMapping({}, "2.0.0" ); | ||
.fromMapping({ | ||
"2.0.0.1": { | ||
up: compat.migrations.updateConfig( | ||
(config: any) => { | ||
config["reconnect"] = false; | ||
return config; | ||
}, | ||
true, | ||
{ version: "2.0.0.1", type: "up" }, | ||
), | ||
down: compat.migrations.updateConfig( | ||
(config: any) => { | ||
delete config["reconnect"]; | ||
return config; | ||
}, | ||
true, | ||
{ version: "2.0.0.1", type: "down" }, | ||
), | ||
}, | ||
}, "2.0.0.1"); |