mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Auto redirect if available before countdown on state change
This commit is contained in:
parent
27183483a9
commit
d47daba8c1
2 changed files with 46 additions and 15 deletions
|
@ -35,6 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="javascriptIncludes()">
|
<%def name="javascriptIncludes()">
|
||||||
<script>
|
<script>
|
||||||
// Use p.countdown as container, pass redirect, duration, and optional message
|
// Use p.countdown as container, pass redirect, duration, and optional message
|
||||||
|
@ -49,5 +50,35 @@
|
||||||
function reloadPage() {
|
function reloadPage() {
|
||||||
window.location.href = "${new_http_root}index";
|
window.location.href = "${new_http_root}index";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Redirect to home page if page is available.
|
||||||
|
var checkOnline = setInterval(checkPageOffline, 1000);
|
||||||
|
|
||||||
|
function checkPageOffline() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'HEAD',
|
||||||
|
url: 'index',
|
||||||
|
timeout: 1000,
|
||||||
|
error: function () {
|
||||||
|
% if signal != 'shutdown':
|
||||||
|
clearInterval(checkOnline);
|
||||||
|
setInterval(checkPageOnline, 1000);
|
||||||
|
% else:
|
||||||
|
reloadPage();
|
||||||
|
% endif
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function checkPageOnline() {
|
||||||
|
$.ajax({
|
||||||
|
type: 'HEAD',
|
||||||
|
url: 'index',
|
||||||
|
timeout: 1000,
|
||||||
|
success: function () {
|
||||||
|
reloadPage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
|
@ -3324,7 +3324,7 @@ class WebInterface(object):
|
||||||
else:
|
else:
|
||||||
new_http_root = '/'
|
new_http_root = '/'
|
||||||
|
|
||||||
return serve_template(templatename="shutdown.html", title=title,
|
return serve_template(templatename="shutdown.html", signal=signal, title=title,
|
||||||
new_http_root=new_http_root, message=message, timer=timer, quote=quote)
|
new_http_root=new_http_root, message=message, timer=timer, quote=quote)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue