-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: refresh auth hash before restarting streams after a long tab hide #5093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
36ca9aa
48db87b
52400cf
0ac31d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -477,18 +477,6 @@ function startVisibleMonitors() { | |
| } | ||
| } | ||
|
|
||
| function refreshAuthAndStartMonitors() { | ||
| $j.getJSON(zmAuth.appendTo(thisUrl + '?view=request&request=status&entity=navBar')) | ||
| .done(function(data) { | ||
| zmAuth.update(data); | ||
| startVisibleMonitors(); | ||
| }) | ||
| .fail(function() { | ||
| // Even if refresh fails, try to start with whatever auth we have | ||
| startVisibleMonitors(); | ||
| }); | ||
| } | ||
|
|
||
| function reloadWebSite(ndx) { | ||
| document.getElementById('imageFeed'+ndx).innerHTML = document.getElementById('imageFeed'+ndx).innerHTML; | ||
| } | ||
|
|
@@ -701,7 +689,10 @@ function initPage() { | |
| ayswModal = insertModalHtml('AYSWModal', data.html); | ||
| ayswModal.on('hidden.bs.modal', function() { | ||
| idleTimeoutTriggered = false; | ||
| refreshAuthAndStartMonitors(); | ||
| // The modal may have sat here for hours with the monitors - | ||
| // and their status polls - stopped, so the auth hash baked | ||
| // into their srcs can be dead (auth-helpers.js). | ||
| whenAuthFresh(startVisibleMonitors); | ||
| }); | ||
|
Comment on lines
689
to
696
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right — the description predated 52400cf, which folded montage.js in and replaced the hidden-timestamp approach ( Your suppressed note about 401 vs 403 was the useful one. Chasing it turned up a real bug rather than a comment slip: the probe was going out as So past 0ac31d9 sends the probe bare, which also makes the failure handling mean what its comment claimed — a rejection now really is a dead session rather than a dead hash, and the comment says 401 and 403 as you noted. Four new |
||
| ayswModal.modal('show'); | ||
| }) | ||
|
|
@@ -1099,7 +1090,7 @@ document.onvisibilitychange = () => { | |
| if (!idleTimeoutTriggered) { | ||
| // Refresh auth hash before restarting streams, since browsers throttle | ||
| // timers for hidden tabs and the auth hash may have gone stale. | ||
| refreshAuthAndStartMonitors(); | ||
| whenAuthFresh(startVisibleMonitors); | ||
| } // end if not AYSW | ||
| } | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 0ac31d9.
authIsStale()is a strict comparison and the test asserts the exactly-one-hour boundary is still fresh, so the comment now reads "anything last confirmed longer ago than that", dropping the "or more".