8fbbfc90cd
Test project compilation / test (push) Successful in 3m52s
- Fix typo in OTA update status API endpoint (/ota_udpate_status → /ota_update_status) - Replace WebSocket-based update progress with polling mechanism - Add OTA lifecycle callbacks (started, finished, progress, error) - Implement check_update_task with internet connectivity verification - Add LittleFS/SPIFFS update support - Simplify update progress page to use 90-second delay and polling instead of real-time WebSocket updates This refactor improves reliability by checking internet connectivity before attempting updates and simplifies the frontend by removing WebSocket complexity in favor of a timeout-based polling approach.
47 lines
1.4 KiB
HTML
47 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<head>
|
|
<link rel="stylesheet" href="/chota.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div class="container">
|
|
<div class="card bd-success">
|
|
<header class="is-center">
|
|
<h4>Update running</h4>
|
|
</header>
|
|
<div class="is-center" id="progress">
|
|
Running update...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Wait 90 seconds after page load, then start checking if server is up
|
|
window.addEventListener('load', function() {
|
|
setTimeout(checkServerAndRedirect, 90000); // 90 seconds = 90000 ms
|
|
});
|
|
|
|
function checkServerAndRedirect() {
|
|
// Try to fetch the home page to check if server is up
|
|
fetch('/', {
|
|
method: 'GET',
|
|
cache: 'no-cache'
|
|
})
|
|
.then(response => {
|
|
// If we get a response (server is up), redirect to home page
|
|
if (response.ok) {
|
|
window.location.href = '/';
|
|
} else {
|
|
// Server responded but with an error, wait and retry
|
|
setTimeout(checkServerAndRedirect, 5000); // 5 seconds = 5000 ms
|
|
}
|
|
})
|
|
.catch(error => {
|
|
// Fetch failed (server not up yet), wait and retry
|
|
setTimeout(checkServerAndRedirect, 5000); // 5 seconds = 5000 ms
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|