Calibre-web reboot now waits for calibre-web to come back

This commit is contained in:
Ozzie Isaacs
2026-08-16 19:13:35 +02:00
parent 06da2ae7c1
commit 748eacfff2
+24 -18
View File
@@ -326,6 +326,20 @@ $(function() {
$("#RestartDialog").modal("hide");
}
function waitForAdminAlive(onAvailable) {
var aliveInterval = setInterval(function () {
$.get({
url: getPath() + "/admin/alive",
success: function (d, statusText, xhr) {
if (xhr.status < 400) {
clearInterval(aliveInterval);
onAvailable();
}
},
});
}, 1000);
}
function cleanUp() {
clearInterval(updateTimerID);
$("#spinner2").hide();
@@ -456,7 +470,7 @@ $(function() {
data: JSON.stringify({"parameter":0}),
success: function success() {
$("#spinner").show();
setTimeout(restartTimer, 3000);
waitForAdminAlive(restartTimer);
}
});
});
@@ -781,26 +795,18 @@ $(function() {
$("#flash_danger").remove();
$.post(getPath() + request_path, $(this).closest("form").serialize(), function(data) {
$('#config_upload_formats').val(data.config_upload);
if(data.reboot) {
if (data.reboot) {
$("#spinning_success").show();
var rebootInterval = setInterval(function(){
$.get({
url:getPath() + "/admin/alive",
success: function (d, statusText, xhr) {
if (xhr.status < 400) {
$("#spinning_success").hide();
clearInterval(rebootInterval);
if (data.result) {
handle_response(data.result);
data.result = "";
}
}
},
});
}, 1000);
waitForAdminAlive(function () {
$("#spinning_success").hide();
if (data.result) {
handle_response(data.result);
data.result = "";
}
});
} else {
handle_response(data.result);
}
}
});
});