feat: update version to 1.2.3; modify HTML files to reflect new version; enhance firmware update process and UI improvements
This commit is contained in:
		| @@ -1,4 +1,3 @@ | ||||
|  | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
| @@ -13,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.2.1</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.2</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -42,14 +41,13 @@ | ||||
|  | ||||
|         <div class="warning"> | ||||
|             <strong>Warning:</strong> Please do not turn off or restart the device during the update.  | ||||
|                         Configuration files will be automatically backed up and restored after the update. | ||||
|             The device will restart automatically after the update. | ||||
|         </div> | ||||
|  | ||||
|          | ||||
|         <div class="update-form" style="align-items: center;"> | ||||
|             <form id="updateForm" enctype='multipart/form-data' style="text-align: center;"></form> | ||||
|         <div class="update-form"> | ||||
|             <form id="updateForm" enctype='multipart/form-data'> | ||||
|                 <input type='file' name='update' accept='.bin' required> | ||||
|                 <input type='submit' value='Firmware Update starten'> | ||||
|                 <input type='submit' value='Start Firmware Update'> | ||||
|             </form> | ||||
|         </div> | ||||
|  | ||||
| @@ -60,10 +58,21 @@ | ||||
|     </div> | ||||
|  | ||||
|     <script> | ||||
|         // Hide status indicators during update | ||||
|         const statusContainer = document.querySelector('.status-container'); | ||||
|         if (statusContainer) { | ||||
|             statusContainer.style.display = 'none'; | ||||
|         } | ||||
|  | ||||
|         document.getElementById('updateForm').addEventListener('submit', async (e) => { | ||||
|             e.preventDefault(); | ||||
|             const form = e.target; | ||||
|             const file = form.update.files[0]; | ||||
|             if (!file) { | ||||
|                 alert('Please select a firmware file.'); | ||||
|                 return; | ||||
|             } | ||||
|  | ||||
|             const formData = new FormData(); | ||||
|             formData.append('update', file); | ||||
|  | ||||
| @@ -91,21 +100,24 @@ | ||||
|                 try { | ||||
|                     let response = this.responseText; | ||||
|                     try { | ||||
|                         // Versuche als JSON zu parsen | ||||
|                         const jsonResponse = JSON.parse(response); | ||||
|                         response = jsonResponse.message; | ||||
|                          | ||||
|                         if (jsonResponse.restart) { | ||||
|                             // Wenn Gerät neustartet, warte und lade dann neu | ||||
|                             status.textContent = response + " Weiterleitung in 5 Sekunden..."; | ||||
|                             setTimeout(() => { | ||||
|                                 window.location.href = '/'; | ||||
|                             }, 5000); | ||||
|                             status.textContent = response + " Redirecting in 20 seconds..."; | ||||
|                             let countdown = 20; | ||||
|                             const timer = setInterval(() => { | ||||
|                                 countdown--; | ||||
|                                 if (countdown <= 0) { | ||||
|                                     clearInterval(timer); | ||||
|                                     window.location.href = '/'; | ||||
|                                 } else { | ||||
|                                     status.textContent = response + ` Redirecting in ${countdown} seconds...`; | ||||
|                                 } | ||||
|                             }, 1000); | ||||
|                         } | ||||
|                     } catch (e) { | ||||
|                         // Wenn kein JSON, nutze response als Text | ||||
|                         if (!isNaN(response)) { | ||||
|                             // Wenn es eine Zahl ist, update den Fortschritt | ||||
|                             const percent = parseInt(response); | ||||
|                             progress.style.width = percent + '%'; | ||||
|                             progress.textContent = percent + '%'; | ||||
| @@ -121,7 +133,7 @@ | ||||
|                         form.querySelector('input[type=submit]').disabled = false; | ||||
|                     } | ||||
|                 } catch (error) { | ||||
|                     status.textContent = 'Fehler: ' + error.message; | ||||
|                     status.textContent = 'Error: ' + error.message; | ||||
|                     status.classList.add('error'); | ||||
|                     status.style.display = 'block'; | ||||
|                     form.querySelector('input[type=submit]').disabled = false; | ||||
| @@ -129,7 +141,7 @@ | ||||
|             }; | ||||
|  | ||||
|             xhr.onerror = function() { | ||||
|                 status.textContent = 'Update fehlgeschlagen: Netzwerkfehler'; | ||||
|                 status.textContent = 'Update failed: Network error'; | ||||
|                 status.classList.add('error'); | ||||
|                 status.style.display = 'block'; | ||||
|                 form.querySelector('input[type=submit]').disabled = false; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user