diff --git a/src/CHANGES.md b/src/CHANGES.md index cb14cfed..bfd2979f 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -7,6 +7,8 @@ * add option to publish mqtt as json * publish rssi not on ch0 any more, published on `topic/rssi` * add total power to index page (if multiple inverters are configured) +* show device name in html title #1639 +* update AsyncWebserver library to `3.2.2` ## 0.8.122 - 2024-05-23 * add button for donwloading coredump (ESP32 variants only) diff --git a/src/platformio.ini b/src/platformio.ini index 0ed3f298..69359aa4 100644 --- a/src/platformio.ini +++ b/src/platformio.ini @@ -26,7 +26,7 @@ extra_scripts = post:../scripts/add_littlefs_binary.py lib_deps = - https://github.com/esphome/ESPAsyncWebServer @ ^3.2.0 + https://github.com/esphome/ESPAsyncWebServer @ ^3.2.2 https://github.com/nRF24/RF24.git#v1.4.8 paulstoffregen/Time @ ^1.6.1 https://github.com/bertmelis/espMqttClient#v1.7.0 diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 6dffe3bb..3006345e 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -391,6 +391,7 @@ class RestApi { obj[F("modules")] = String(mApp->getVersionModules()); obj[F("build")] = String(AUTO_GIT_HASH); obj[F("env")] = String(ENV_NAME); + obj[F("host")] = mConfig->sys.deviceName; obj[F("menu_prot")] = mApp->isProtected(request->client()->remoteIP().toString().c_str(), "", true); obj[F("menu_mask")] = (uint16_t)(mConfig->sys.protectionMask ); obj[F("menu_protEn")] = (bool) (mConfig->sys.adminPwd[0] != '\0'); @@ -418,7 +419,6 @@ class RestApi { obj[F("dark_mode")] = (bool)mConfig->sys.darkMode; obj[F("sched_reboot")] = (bool)mConfig->sys.schedReboot; - obj[F("hostname")] = mConfig->sys.deviceName; obj[F("pwd_set")] = (strlen(mConfig->sys.adminPwd) > 0); obj[F("prot_mask")] = mConfig->sys.protectionMask; diff --git a/src/web/html/api.js b/src/web/html/api.js index 6c2ccec2..4930ce17 100644 --- a/src/web/html/api.js +++ b/src/web/html/api.js @@ -143,7 +143,7 @@ function parseVersion(obj) { function parseESP(obj) { document.getElementById("esp_type").replaceChildren( - document.createTextNode("Board: " + obj["esp_type"]) + document.createTextNode("Board: " + obj.esp_type) ); } @@ -153,7 +153,11 @@ function parseRssi(obj) { icon = iconWifi1; else if(obj["wifi_rssi"] <= -70) icon = iconWifi2; - document.getElementById("wifiicon").replaceChildren(svg(icon, 32, 32, "icon-fg2", obj["wifi_rssi"])); + document.getElementById("wifiicon").replaceChildren(svg(icon, 32, 32, "icon-fg2", obj.wifi_rssi)); +} + +function parseTitle(obj) { + document.title = obj.host + " - " + document.title } function toIsoDateStr(d) { diff --git a/src/web/html/history.html b/src/web/html/history.html index 9e15daa8..8b3b63c7 100644 --- a/src/web/html/history.html +++ b/src/web/html/history.html @@ -149,6 +149,7 @@ parseNav(obj.generic) parseESP(obj.generic) parseRssi(obj.generic) + parseTitle(obj.generic) window.setInterval("getAjax('/api/powerHistory', parsePowerHistory)", obj.refresh * 1000) setTimeout(() => { window.setInterval("getAjax('/api/powerHistoryDay', parsePowerHistoryDay)", obj.refresh * 1000) diff --git a/src/web/html/index.html b/src/web/html/index.html index 864dc762..442160d4 100644 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -57,8 +57,10 @@ } function parseGeneric(obj) { - if(exeOnce) + if(exeOnce) { parseESP(obj) + parseTitle(obj) + } parseRssi(obj) } diff --git a/src/web/html/serial.html b/src/web/html/serial.html index 835f1766..39ba0ac2 100644 --- a/src/web/html/serial.html +++ b/src/web/html/serial.html @@ -40,10 +40,11 @@ + ("0"+min).substr(-2) + ":" + ("0"+sec).substr(-2); - parseRssi(obj); + parseRssi(obj) if(true == exeOnce) { - parseNav(obj); - parseESP(obj); + parseNav(obj) + parseESP(obj) + parseTitle(obj) window.setInterval("getAjax('/api/generic', parseGeneric)", 5000); exeOnce = false; setTimeOffset(); diff --git a/src/web/html/setup.html b/src/web/html/setup.html index b5f5a6f2..26b7100c 100644 --- a/src/web/html/setup.html +++ b/src/web/html/setup.html @@ -717,9 +717,10 @@ } function parseGeneric(obj) { - parseNav(obj); - parseESP(obj); - parseRssi(obj); + parseNav(obj) + parseESP(obj) + parseRssi(obj) + parseTitle(obj) if(0 != obj.cst_lnk.length) { document.getElementsByName("cstLnk")[0].value = obj.cst_lnk diff --git a/src/web/html/system.html b/src/web/html/system.html index 4b2ea1f7..ec21f8bd 100644 --- a/src/web/html/system.html +++ b/src/web/html/system.html @@ -15,9 +15,10 @@ {#HTML_FOOTER}