Tweaks in OTA UI

- added OTA section toggle
- added ignore upload
- fix for missing "NoXXX" ID
- rely on 404 for /dmxmap
This commit is contained in:
Blaz Kristan 2025-06-26 11:36:39 +02:00
parent 7973fd84f1
commit 796494e925
4 changed files with 9 additions and 10 deletions

View File

@ -13,7 +13,7 @@ function isN(n) { return !isNaN(parseFloat(n)) && isFinite(n); } // isNumber
// https://stackoverflow.com/questions/3885817/how-do-i-check-that-a-number-is-float-or-integer
function isF(n) { return n === +n && n !== (n|0); } // isFloat
function isI(n) { return n === +n && n === (n|0); } // isInteger
function toggle(el) { gId(el).classList.toggle("hide"); gId('No'+el).classList.toggle("hide"); }
function toggle(el) { gId(el).classList.toggle("hide"); let n = gId('No'+el); if (n) n.classList.toggle("hide"); }
function tooltip(cont=null) {
d.querySelectorAll((cont?cont+" ":"")+"[title]").forEach((element)=>{
element.addEventListener("pointerover", ()=>{

View File

@ -53,13 +53,13 @@
Factory reset: <input type="checkbox" name="RS"><br>
All settings and presets will be erased.<br><br>
<div class="warn">&#9888; Unencrypted transmission. An attacker on the same network can intercept form data!</div>
<hr>
<span id="OTA"><hr>
<h3>Software Update</h3>
<button type="button" onclick="U()">Manual OTA Update</button><br>
<div id="aOTA">Enable ArduinoOTA: <input type="checkbox" name="AO"></div>
Only allow update from same network/WiFi: <input type="checkbox" name="SU"><br>
<i class="warn">&#9888; If you are using multiple VLANs (i.e. IoT or guest network) either set PIN or disable this option.<br>
Disabling this option will make your device less secure.</i><br>
Disabling this option will make your device less secure.</i><br></span>
<hr id="backup">
<h3>Backup & Restore</h3>
<div class="warn">&#9888; Restoring presets/configuration will OVERWRITE your current presets/configuration.<br>

View File

@ -454,16 +454,12 @@ void initServer()
serveMessage(request, 501, FPSTR(s_notimplemented), F("This build does not support OTA update."), 254);
};
server.on(_update, HTTP_GET, notSupported);
server.on(_update, HTTP_POST, notSupported);
server.on(_update, HTTP_POST, notSupported, [](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){});
#endif
#ifdef WLED_ENABLE_DMX
server.on(F("/dmxmap"), HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, FPSTR(CONTENT_TYPE_HTML), PAGE_dmxmap , dmxProcessor);
});
#else
server.on(F("/dmxmap"), HTTP_GET, [](AsyncWebServerRequest *request){
serveMessage(request, 501, FPSTR(s_notimplemented), F("DMX support is not enabled in this build."), 254);
request->send_P(200, FPSTR(CONTENT_TYPE_HTML), PAGE_dmxmap, dmxProcessor);
});
#endif

View File

@ -596,8 +596,11 @@ void getSettingsJS(byte subPage, Print& settingsScript)
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s (build %d)"),versionString,VERSION);
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
settingsScript.printf_P(PSTR("sd=\"%s\";"), serverDescription);
#ifndef WLED_ENABLE_AOTA
//hide settings if not compiled
#ifdef WLED_DISABLE_OTA
settingsScript.print(F("toggle('OTA');")); // hide update section
#endif
#ifndef WLED_ENABLE_AOTA
settingsScript.print(F("toggle('aOTA');")); // hide ArduinoOTA checkbox
#endif
}