Fix missing config handling and auto-restart after setup

This commit is contained in:
Mikhail Chusavitin
2026-02-04 10:19:35 +03:00
parent fabd30650d
commit 7c606af2bb
3 changed files with 17 additions and 5 deletions

View File

@@ -158,6 +158,16 @@
}, 1000); // Check every second
}
async function requestRestartAndWait() {
showStatus('Перезапуск приложения...', 'info');
try {
await fetch('/api/restart', { method: 'POST' });
} catch (e) {
// Ignore network errors here: restart may break connection immediately.
}
checkServerReady();
}
document.getElementById('setup-form').addEventListener('submit', async function(e) {
e.preventDefault();
showStatus('Сохранение настроек...', 'info');
@@ -176,9 +186,8 @@
// Check if restart is required
if (data.restart_required) {
// In normal mode, restart must be done manually
setTimeout(() => {
showStatus('⚠️ Пожалуйста, перезапустите приложение вручную для применения изменений', 'warning');
requestRestartAndWait();
}, 2000);
} else {
// In setup mode, auto-restart is happening