mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-24 16:52:06 +00:00
Fix for shutdown/restart from UI.
This commit is contained in:
parent
50901a3b04
commit
02551f2486
2 changed files with 40 additions and 6 deletions
|
@ -188,7 +188,7 @@ def doShutdown():
|
|||
else:
|
||||
stop_file.write(str(''))
|
||||
stop_file.close()
|
||||
sys.exit(0)
|
||||
os._exit(0)
|
||||
return ''
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ def restart():
|
|||
logging.info('Bazarr is being restarted...')
|
||||
restart_file.write(str(''))
|
||||
restart_file.close()
|
||||
sys.exit(0)
|
||||
os._exit(0)
|
||||
return ''
|
||||
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@
|
|||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></a>
|
||||
<div class="dropdown-menu dropdown-menu-right scale-up">
|
||||
<ul class="dropdown-user">
|
||||
<li><a href="{{ url_for('restart') }}"><i class="fas fa-redo"></i> Restart</a></li>
|
||||
<li><a href="{{ url_for('shutdown') }}"><i class="fas fa-power-off"></i>
|
||||
<li><a id="restart"><i class="fas fa-redo"></i> Restart</a></li>
|
||||
<li><a id="shutdown""><i class="fas fa-power-off"></i>
|
||||
Shutdown</a></li>
|
||||
<li><a href="{{ url_for('logout') }}"><i class="fas fa-sign-out-alt"></i> Logout</a>
|
||||
</li>
|
||||
|
@ -259,8 +259,8 @@
|
|||
|
||||
<div id="reconnect_overlay" class="overlay">
|
||||
<div class="overlay-content">
|
||||
<p style="color: white;">Connection to Backend Lost.</p>
|
||||
<button class="btn btn-info" onclick="window.location.reload()">Reload</button>
|
||||
<p id="loader_text" style="color: white;">Connection to Backend Lost.</p>
|
||||
<button id="loader_button" class="btn btn-info" onclick="window.location.reload()">Reload</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock page_body %}
|
||||
|
@ -390,6 +390,40 @@
|
|||
$(window).on('beforeunload', function() {
|
||||
events.close();
|
||||
});
|
||||
|
||||
$('#restart').on('click', function() {
|
||||
$('#loader_button').prop("hidden", true);
|
||||
$('#loader_text').text("Bazarr is restarting, please wait...");
|
||||
$('#reconnect_overlay').show();
|
||||
$.ajax({
|
||||
url: "{{ url_for('restart') }}",
|
||||
async: true,
|
||||
error: (function () {
|
||||
setTimeout(function () {
|
||||
setInterval(ping, 2000);
|
||||
}, 8000);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
function ping() {
|
||||
$.ajax({
|
||||
url: window.location.href,
|
||||
success: function() {
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#shutdown').on('click', function(){
|
||||
document.open();
|
||||
document.write('Bazarr has shutdown.');
|
||||
document.close();
|
||||
$.ajax({
|
||||
url: "{{ url_for('shutdown') }}",
|
||||
async: true
|
||||
})
|
||||
});
|
||||
</script>
|
||||
{% endblock tail_js %}
|
||||
{% block tail %}
|
||||
|
|
Loading…
Reference in a new issue