|
|
@ -15,35 +15,37 @@ $.SickGear.numRestartWaits = 0; |
|
|
|
|
|
|
|
function is_alive() { |
|
|
|
timeoutId = 0; |
|
|
|
$.ajax({url: isAliveUrl, |
|
|
|
type: 'GET', |
|
|
|
dataType: 'jsonp', |
|
|
|
success: function(data) { |
|
|
|
|
|
|
|
var resp = data.msg.toString(); |
|
|
|
if ('nope' == resp) { |
|
|
|
// if initialising then just wait and try again
|
|
|
|
|
|
|
|
$('#shut_down_message').find('.spinner,.hide-yes').removeClass(); |
|
|
|
$('#restart_message').removeClass(); |
|
|
|
setTimeout(is_alive, 100); |
|
|
|
|
|
|
|
} else if (/undefined/i.test($.SickGear.PID) || $.SickGear.PID == resp) { |
|
|
|
// if this is before we've even shut down then just try again later
|
|
|
|
|
|
|
|
//noinspection JSUnusedLocalSymbols
|
|
|
|
$.ajax({ |
|
|
|
'url': isAliveUrl, |
|
|
|
'type': 'GET', |
|
|
|
'dataType': 'jsonp', |
|
|
|
'success': function(data) { |
|
|
|
var resp = data.msg.toString(); |
|
|
|
if ('nope' == resp) { |
|
|
|
// if initialising then just wait and try again
|
|
|
|
|
|
|
|
$('#shut_down_message').find('.spinner,.hide-yes').removeClass(); |
|
|
|
$('#restart_message').removeClass(); |
|
|
|
setTimeout(is_alive, 100); |
|
|
|
|
|
|
|
} else if (/undefined/i.test($.SickGear.PID) || $.SickGear.PID == resp) { |
|
|
|
// if this is before we've even shut down then just try again later
|
|
|
|
|
|
|
|
setTimeout(is_alive, 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
// if we're ready to go then redirect to new url
|
|
|
|
|
|
|
|
$('#restart_message').find('.spinner,.hide-yes').removeClass(); |
|
|
|
$('#refresh_message').removeClass(); |
|
|
|
window.location = baseUrl + '/home/'; |
|
|
|
} |
|
|
|
}, |
|
|
|
'error': function(XMLHttpRequest, textStatus, errorThrown) { |
|
|
|
setTimeout(is_alive, 100); |
|
|
|
|
|
|
|
} else { |
|
|
|
// if we're ready to go then redirect to new url
|
|
|
|
|
|
|
|
$('#restart_message').find('.spinner,.hide-yes').removeClass(); |
|
|
|
$('#refresh_message').removeClass(); |
|
|
|
window.location = baseUrl + '/home/'; |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function(XMLHttpRequest, textStatus, errorThrown) { |
|
|
|
setTimeout(is_alive, 100); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
@ -56,11 +58,14 @@ $(document).ready(function() { |
|
|
|
$.SickGear.numRestartWaits += 1; |
|
|
|
|
|
|
|
$('#shut_down_message').find('.spinner,.hide-yes').removeClass(); |
|
|
|
$('#restart_message').removeClass(); |
|
|
|
|
|
|
|
var restart$ = $('#restart_message'); |
|
|
|
restart$.removeClass(); |
|
|
|
|
|
|
|
isAliveUrl = baseUrl + '/home/is_alive/'; |
|
|
|
|
|
|
|
// if https is enabled or you are currently on https and the port or protocol changed just wait 5 seconds then redirect.
|
|
|
|
// This is because the ajax will fail if the cert is untrusted or the the http ajax request from https will fail because of mixed content error.
|
|
|
|
// If using https and the port or protocol changed, then wait 5 seconds before redirect because ajax calls will
|
|
|
|
// fail with untrusted certs or when a http ajax request is made from https with a mixed content error.
|
|
|
|
if ($.SickGear.UseHttps || 'https:' == window.location.protocol) { |
|
|
|
if (browserUrl != baseUrl) { |
|
|
|
|
|
|
@ -78,7 +83,7 @@ $(document).ready(function() { |
|
|
|
// if it is taking forever just give up
|
|
|
|
if (90 < $.SickGear.numRestartWaits) { |
|
|
|
|
|
|
|
$('#restart_message').find('.spinner,.yes,.hide-no').removeClass(); |
|
|
|
restart$.find('.spinner,.yes,.hide-no').removeClass(); |
|
|
|
$('#restart_fail_message').removeClass(); |
|
|
|
return; |
|
|
|
} |
|
|
|