Skip to content

Commit 796494e

Browse files
committed
Tweaks in OTA UI
- added OTA section toggle - added ignore upload - fix for missing "NoXXX" ID - rely on 404 for /dmxmap
1 parent 7973fd8 commit 796494e

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

wled00/data/common.js

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

wled00/data/settings_sec.htm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ <h2>Security & Update setup</h2>
5353
Factory reset: <input type="checkbox" name="RS"><br>
5454
All settings and presets will be erased.<br><br>
5555
<div class="warn">&#9888; Unencrypted transmission. An attacker on the same network can intercept form data!</div>
56-
<hr>
56+
<span id="OTA"><hr>
5757
<h3>Software Update</h3>
5858
<button type="button" onclick="U()">Manual OTA Update</button><br>
5959
<div id="aOTA">Enable ArduinoOTA: <input type="checkbox" name="AO"></div>
6060
Only allow update from same network/WiFi: <input type="checkbox" name="SU"><br>
6161
<i class="warn">&#9888; If you are using multiple VLANs (i.e. IoT or guest network) either set PIN or disable this option.<br>
62-
Disabling this option will make your device less secure.</i><br>
62+
Disabling this option will make your device less secure.</i><br></span>
6363
<hr id="backup">
6464
<h3>Backup & Restore</h3>
6565
<div class="warn">&#9888; Restoring presets/configuration will OVERWRITE your current presets/configuration.<br>

wled00/wled_server.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -454,16 +454,12 @@ void initServer()
454454
serveMessage(request, 501, FPSTR(s_notimplemented), F("This build does not support OTA update."), 254);
455455
};
456456
server.on(_update, HTTP_GET, notSupported);
457-
server.on(_update, HTTP_POST, notSupported);
457+
server.on(_update, HTTP_POST, notSupported, [](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool isFinal){});
458458
#endif
459459

460460
#ifdef WLED_ENABLE_DMX
461461
server.on(F("/dmxmap"), HTTP_GET, [](AsyncWebServerRequest *request){
462-
request->send_P(200, FPSTR(CONTENT_TYPE_HTML), PAGE_dmxmap , dmxProcessor);
463-
});
464-
#else
465-
server.on(F("/dmxmap"), HTTP_GET, [](AsyncWebServerRequest *request){
466-
serveMessage(request, 501, FPSTR(s_notimplemented), F("DMX support is not enabled in this build."), 254);
462+
request->send_P(200, FPSTR(CONTENT_TYPE_HTML), PAGE_dmxmap, dmxProcessor);
467463
});
468464
#endif
469465

wled00/xml.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,11 @@ void getSettingsJS(byte subPage, Print& settingsScript)
596596
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s (build %d)"),versionString,VERSION);
597597
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
598598
settingsScript.printf_P(PSTR("sd=\"%s\";"), serverDescription);
599-
#ifndef WLED_ENABLE_AOTA
600599
//hide settings if not compiled
600+
#ifdef WLED_DISABLE_OTA
601+
settingsScript.print(F("toggle('OTA');")); // hide update section
602+
#endif
603+
#ifndef WLED_ENABLE_AOTA
601604
settingsScript.print(F("toggle('aOTA');")); // hide ArduinoOTA checkbox
602605
#endif
603606
}

0 commit comments

Comments
 (0)