From c593b152e8181bc82364728090b7b652cad4acd6 Mon Sep 17 00:00:00 2001 From: PaulVua Date: Wed, 13 May 2026 12:39:40 +0200 Subject: [PATCH] v1.8.3: Affichage version firmware dans la sidebar Ajoute la version firmware sous le nom du capteur dans la sidebar, visible sur toutes les pages. Permet d'identifier d'un coup d'oeil le chemin de mise a jour disponible (online git pull vs offline ZIP upload >= v1.4.0). - launcher.php: get_config_sqlite injecte firmware_version (lu depuis VERSION) - sidebar.html: ajout d'un sous sideBar_sensorName (statique) - topbar-logo.js: peuple .sideBar_firmwareVersion via le fetch existant + MutationObserver (aucun nouveau fetch -> respecte la limite 6 connexions) Co-Authored-By: Claude Opus 4.7 (1M context) --- VERSION | 2 +- changelog.json | 18 ++++++++++++++++++ html/assets/js/topbar-logo.js | 13 ++++++++++++- html/launcher.php | 10 +++++++++- html/sidebar.html | 1 + 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 53adb84..a7ee35a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.2 +1.8.3 diff --git a/changelog.json b/changelog.json index 66edd23..66bdab7 100644 --- a/changelog.json +++ b/changelog.json @@ -1,5 +1,23 @@ { "versions": [ + { + "version": "1.8.3", + "date": "2026-05-13", + "changes": { + "features": [ + "Sidebar: affichage de la version firmware juste sous le nom du capteur (visible sur toutes les pages)" + ], + "improvements": [ + "launcher.php: get_config_sqlite renvoie maintenant firmware_version (lu depuis le fichier VERSION) — pas de nouveau endpoint, pas de nouveau fetch côté UI", + "topbar-logo.js: peuple .sideBar_firmwareVersion via le fetch config existant + MutationObserver (compatible avec le chargement asynchrone de sidebar.html)" + ], + "fixes": [], + "compatibility": [ + "Aucun risque sur les pages existantes: les handlers AJAX par page restent inchangés, seul launcher.php ajoute un champ dans la réponse JSON" + ] + }, + "notes": "Permet d'identifier d'un coup d'oeil la version firmware d'un capteur depuis n'importe quelle page de l'UI — utile pour decider du chemin de mise a jour (online git pull >= v0.x, offline ZIP upload >= v1.4.0) sans avoir a fouiller dans admin.html ou en SSH." + }, { "version": "1.8.2", "date": "2026-05-12", diff --git a/html/assets/js/topbar-logo.js b/html/assets/js/topbar-logo.js index ba2293a..fd8c40e 100644 --- a/html/assets/js/topbar-logo.js +++ b/html/assets/js/topbar-logo.js @@ -37,7 +37,18 @@ document.addEventListener('DOMContentLoaded', () => { } } - // 2. Sidebar Screen Tab Logic - Use class since ID might be duplicated (desktop/mobile) + // 2. Sidebar firmware version display + const versionElements = document.querySelectorAll('.sideBar_firmwareVersion'); + if (versionElements.length > 0 && config.firmware_version) { + const versionText = 'v' + config.firmware_version; + versionElements.forEach(el => { + if (el.textContent !== versionText) { + el.textContent = versionText; + } + }); + } + + // 3. Sidebar Screen Tab Logic - Use class since ID might be duplicated (desktop/mobile) const navScreenElements = document.querySelectorAll('.nav-screen-item'); if (navScreenElements.length > 0) { navScreenElements.forEach(navScreen => { diff --git a/html/launcher.php b/html/launcher.php index 183672f..094d3c9 100755 --- a/html/launcher.php +++ b/html/launcher.php @@ -65,7 +65,15 @@ if ($type == "get_config_sqlite") { $result[$key] = $parsed_value; } - + + // Inject firmware version (read from VERSION file, not from DB) + // Piggybacks on this existing fetch so the sidebar can show it without + // a separate AJAX call (avoids hitting the 6-connection browser limit). + $versionFile = '/var/www/nebuleair_pro_4g/VERSION'; + $result['firmware_version'] = file_exists($versionFile) + ? trim(file_get_contents($versionFile)) + : 'unknown'; + // Return JSON response header('Content-Type: application/json'); echo json_encode($result, JSON_PRETTY_PRINT); diff --git a/html/sidebar.html b/html/sidebar.html index 0bfea5b..3a85024 100755 --- a/html/sidebar.html +++ b/html/sidebar.html @@ -93,6 +93,7 @@