Optional HSV sliders instead of color wheel.
PIN code optimizations & fixes.
This commit is contained in:
parent
d4ef26e0f3
commit
9667365d9e
@ -267,7 +267,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings/settings.js?p=0\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=0\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -279,7 +279,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=1\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=1\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -291,7 +291,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=2\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=2\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -303,7 +303,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=7\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=7\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -315,7 +315,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=3\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=3\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -327,7 +327,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=4\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=4\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -339,7 +339,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=5\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=5\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -351,7 +351,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=6\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=6\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -363,7 +363,7 @@ writeChunks(
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=8\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=8\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
@ -420,7 +420,7 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
|
||||
str
|
||||
.replace(
|
||||
/function GetV().*\<\/script\>/gms,
|
||||
"</script><script src=\"settings.js?p=9\"></script>"
|
||||
"</script><script src=\"/settings/s.js?p=9\"></script>"
|
||||
)
|
||||
},
|
||||
{
|
||||
|
@ -1419,7 +1419,8 @@ function requestJson(command=null)
|
||||
}
|
||||
var s = json.state ? json.state : json;
|
||||
readState(s);
|
||||
//load presets, and open websocket sequentially
|
||||
|
||||
//load presets and open websocket sequentially
|
||||
setTimeout(()=>{
|
||||
loadPresets(()=>{
|
||||
if (!(ws && ws.readyState === WebSocket.OPEN)) makeWS();
|
||||
@ -2328,6 +2329,7 @@ function search(f,l=null)
|
||||
f.nextElementSibling.style.display=(f.value!=='')?'block':'none';
|
||||
if (!l) return;
|
||||
var el = gId(l).querySelectorAll('.lstI');
|
||||
// filter list items but leave (Default & Solid) always visible
|
||||
for (i = (l==='pcont'?0:1); i < el.length; i++) {
|
||||
var it = el[i];
|
||||
var itT = it.querySelector('.lstIname').innerText.toUpperCase();
|
||||
|
@ -57,6 +57,7 @@
|
||||
</div>
|
||||
<h2>Security & Update setup</h2>
|
||||
Settings PIN: <input type="password" id="PIN" name="PIN" size="4" maxlength="4" minlength="4" onkeydown="checkNum(this)" pattern="[0-9]*" inputmode="numeric" title="Please enter a 4 digit number"><br>
|
||||
⚠ Unencrypted transmission. Do NOT use your banking, door, or SIM pin!<br><br>
|
||||
Lock wireless (OTA) software update: <input type="checkbox" name="NO"><br>
|
||||
Passphrase: <input type="password" name="OP" maxlength="32"><br>
|
||||
To enable OTA, for security reasons you need to also enter the correct password!<br>
|
||||
@ -66,7 +67,7 @@
|
||||
Deny access to WiFi settings if locked: <input type="checkbox" name="OW"><br><br>
|
||||
Factory reset: <input type="checkbox" name="RS"><br>
|
||||
All settings and presets will be erased.<br><br>
|
||||
HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
||||
⚠ HTTP traffic is unencrypted. An attacker in the same network can intercept form data!
|
||||
<hr>
|
||||
<h3>Software Update</h3>
|
||||
<button type="button" onclick="U()">Manual OTA Update</button><br>
|
||||
|
@ -41,48 +41,48 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
|
||||
#endif
|
||||
|
||||
// Autogenerated from wled00/data/update.htm, do not edit!!
|
||||
const uint16_t PAGE_update_length = 626;
|
||||
const uint16_t PAGE_update_length = 630;
|
||||
const uint8_t PAGE_update[] PROGMEM = {
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x75, 0x53, 0xc1, 0x6e, 0xd4, 0x30,
|
||||
0x10, 0xbd, 0xe7, 0x2b, 0x5c, 0x9f, 0x76, 0x25, 0xd6, 0x29, 0xe5, 0x44, 0x71, 0x52, 0x58, 0x5a,
|
||||
0x10, 0xbd, 0xe7, 0x2b, 0x5c, 0x9f, 0x76, 0x25, 0xd6, 0x29, 0xe5, 0x44, 0x49, 0x52, 0x58, 0x5a,
|
||||
0xa1, 0x4a, 0x48, 0xad, 0xd4, 0x16, 0xc4, 0x09, 0x39, 0xf6, 0x64, 0x63, 0xd6, 0xb1, 0x53, 0x7b,
|
||||
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 0x2c, 0xa7, 0x1b, 0x68, 0x36, 0x85,
|
||||
0x10, 0x54, 0x3b, 0x47, 0x73, 0x3b, 0xb9, 0xc1, 0x4c, 0x60, 0x3e, 0x20, 0x5d, 0x10, 0x68, 0x11,
|
||||
0x22, 0x29, 0xa8, 0x23, 0xa4, 0x66, 0x0a, 0xac, 0x53, 0x1b, 0x60, 0xe7, 0x4b, 0x99, 0x13, 0x1f,
|
||||
0x71, 0x8f, 0x53, 0x39, 0x8e, 0xe8, 0xf8, 0xf0, 0xff, 0x00, 0x46, 0x63, 0xca, 0x71, 0x0e, 0x04,
|
||||
0x00, 0x00
|
||||
0xb2, 0xab, 0x08, 0xf5, 0xdf, 0x99, 0x38, 0xbb, 0x55, 0x0b, 0xe2, 0x12, 0xc5, 0xf1, 0x7b, 0x6f,
|
||||
0x66, 0xde, 0x9b, 0x14, 0x27, 0x97, 0x37, 0x9f, 0xef, 0x7f, 0xdc, 0x5e, 0xb1, 0x16, 0x3b, 0x5b,
|
||||
0x15, 0x87, 0x27, 0x48, 0x5d, 0x15, 0x1d, 0xa0, 0x64, 0xca, 0x3b, 0x04, 0x87, 0x25, 0xdf, 0x1b,
|
||||
0x8d, 0x6d, 0xa9, 0x61, 0x67, 0x14, 0xac, 0xd2, 0x81, 0x33, 0x27, 0x3b, 0x28, 0xf9, 0xce, 0xc0,
|
||||
0xbe, 0xf7, 0x01, 0x79, 0x95, 0x15, 0x68, 0xd0, 0x42, 0xf5, 0xfd, 0xeb, 0xd5, 0x25, 0x7b, 0xe8,
|
||||
0xb5, 0x44, 0x28, 0xf2, 0xf9, 0x53, 0x11, 0x55, 0x30, 0x3d, 0x56, 0x59, 0x33, 0x38, 0x85, 0xc6,
|
||||
0x3b, 0xb6, 0x5e, 0x2c, 0x7f, 0xef, 0x8d, 0xd3, 0x7e, 0x2f, 0x5a, 0x13, 0xd1, 0x87, 0x51, 0xd4,
|
||||
0x52, 0x6d, 0x17, 0xcb, 0xa7, 0x67, 0xc8, 0x03, 0x41, 0xb4, 0x57, 0x43, 0x47, 0x1d, 0x88, 0x0d,
|
||||
0xe0, 0x95, 0x85, 0xe9, 0x75, 0x3d, 0x5e, 0xeb, 0x05, 0x1f, 0x1a, 0xbe, 0x14, 0x11, 0x47, 0x0b,
|
||||
0x42, 0x9b, 0xd8, 0x5b, 0x39, 0x96, 0xdc, 0x79, 0x07, 0xfc, 0xcd, 0x7f, 0x29, 0x5d, 0xdc, 0xfc,
|
||||
0xcb, 0xa9, 0xad, 0x57, 0x5b, 0xfe, 0x94, 0x15, 0xf9, 0xa1, 0xc5, 0x43, 0xab, 0x2c, 0x06, 0x55,
|
||||
0xf2, 0x3c, 0x02, 0xa2, 0x71, 0x9b, 0x98, 0x47, 0xf1, 0x2b, 0x5e, 0xf4, 0xe5, 0x7b, 0x5e, 0xbd,
|
||||
0x40, 0x4e, 0x52, 0x55, 0xf6, 0xd1, 0x74, 0x93, 0x01, 0x6c, 0x08, 0x76, 0xc1, 0x67, 0x79, 0x15,
|
||||
0x23, 0x5f, 0x7e, 0x20, 0x64, 0x42, 0x14, 0xf9, 0x6c, 0x69, 0xed, 0xf5, 0xc8, 0xbc, 0xb3, 0x5e,
|
||||
0xea, 0x92, 0x7f, 0x01, 0xfc, 0xb6, 0x58, 0x92, 0x5c, 0x7b, 0x56, 0x65, 0xc9, 0xb2, 0x3b, 0xdf,
|
||||
0xe0, 0x5e, 0x06, 0x78, 0xf6, 0x8e, 0x6e, 0x8a, 0xc6, 0x87, 0x8e, 0x51, 0x16, 0xad, 0x27, 0xce,
|
||||
0xed, 0xcd, 0xdd, 0x3d, 0x67, 0x32, 0xd9, 0x43, 0xcd, 0x0d, 0x09, 0xc7, 0x99, 0xa1, 0x2b, 0xf2,
|
||||
0x83, 0x65, 0x40, 0xce, 0x8d, 0x3d, 0x85, 0xd2, 0x0d, 0x16, 0x4d, 0x2f, 0x03, 0xe6, 0x13, 0x7f,
|
||||
0x45, 0x30, 0xc9, 0xa9, 0x72, 0x1c, 0xea, 0xce, 0x50, 0x9a, 0x0f, 0x53, 0xe1, 0x6b, 0x17, 0x51,
|
||||
0x5a, 0x0b, 0x9a, 0xed, 0x20, 0x44, 0x52, 0x3c, 0x67, 0x45, 0xec, 0xa5, 0x63, 0x99, 0xb2, 0x32,
|
||||
0xc6, 0x92, 0x47, 0xd3, 0xf3, 0xea, 0x54, 0xbc, 0x7d, 0x27, 0xce, 0x56, 0xb5, 0x3d, 0xa5, 0x69,
|
||||
0xe8, 0x96, 0xa6, 0x08, 0xd5, 0xa5, 0xdf, 0xa7, 0x29, 0x18, 0xb6, 0xc0, 0x2c, 0xf5, 0x10, 0x91,
|
||||
0xd5, 0xc6, 0xc9, 0x30, 0x92, 0x86, 0x64, 0x59, 0x1b, 0xa0, 0x29, 0x79, 0x8b, 0xd8, 0xc7, 0xf3,
|
||||
0x3c, 0xdf, 0x18, 0x6c, 0x87, 0x5a, 0x28, 0xdf, 0xe5, 0x9f, 0x4c, 0x50, 0xde, 0xfb, 0xad, 0x81,
|
||||
0x7c, 0x1a, 0x39, 0x0f, 0x60, 0x41, 0x46, 0x88, 0x9c, 0xa1, 0x0c, 0x94, 0x57, 0xc9, 0x7f, 0xd6,
|
||||
0x56, 0xba, 0x2d, 0xd9, 0x62, 0xba, 0x0d, 0xcb, 0x52, 0x08, 0x47, 0x1d, 0xfa, 0x22, 0x62, 0x6b,
|
||||
0xc0, 0xea, 0x28, 0x8c, 0x3f, 0xc8, 0x1e, 0x25, 0xfe, 0x96, 0x16, 0x71, 0xb7, 0xb9, 0x48, 0xf6,
|
||||
0x97, 0x0d, 0x75, 0xb8, 0x8a, 0x8f, 0x03, 0x59, 0x3b, 0x2d, 0x69, 0x2e, 0xd3, 0x0c, 0x85, 0x71,
|
||||
0xfd, 0x80, 0x6c, 0xf6, 0xab, 0x31, 0x96, 0x7c, 0x3c, 0xcc, 0x5d, 0xe3, 0x71, 0xb7, 0x8f, 0x06,
|
||||
0x07, 0x78, 0x1c, 0x4c, 0x00, 0xfd, 0x92, 0x98, 0xcd, 0xcc, 0xd9, 0xd2, 0x57, 0xdc, 0x9d, 0xb4,
|
||||
0x03, 0xdd, 0xcc, 0x29, 0x9e, 0xf0, 0x99, 0x54, 0x0f, 0x88, 0xb4, 0xd3, 0x33, 0x69, 0x3e, 0xbc,
|
||||
0x22, 0x65, 0xde, 0x29, 0x6b, 0xd4, 0xb6, 0xe4, 0xeb, 0x29, 0x9c, 0x35, 0xfd, 0x0b, 0x45, 0x3e,
|
||||
0xe3, 0x68, 0x7f, 0xa6, 0x14, 0xab, 0x42, 0x9b, 0x5d, 0xca, 0x7a, 0x5a, 0x64, 0x52, 0xac, 0x52,
|
||||
0x05, 0xda, 0x4e, 0x21, 0x04, 0x61, 0x53, 0x9d, 0xec, 0x36, 0xb9, 0xc1, 0xb4, 0x67, 0xce, 0x23,
|
||||
0x15, 0xf0, 0x74, 0xf0, 0x81, 0x26, 0x68, 0x02, 0xc4, 0x36, 0x05, 0xd6, 0xcb, 0x0d, 0xb0, 0xf3,
|
||||
0x65, 0x91, 0x93, 0x1e, 0x69, 0x4f, 0x5b, 0x39, 0xad, 0xe8, 0xf4, 0xef, 0xff, 0x01, 0x17, 0xda,
|
||||
0x9b, 0x0e, 0x11, 0x04, 0x00, 0x00
|
||||
};
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2204261
|
||||
#define VERSION 2204271
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
|
@ -7,6 +7,11 @@
|
||||
bool handleIfNoneMatchCacheHeader(AsyncWebServerRequest* request);
|
||||
void setStaticContentCacheHeaders(AsyncWebServerResponse *response);
|
||||
|
||||
// define flash strings once (saves flash memory)
|
||||
static const char s_redirecting[] PROGMEM = "Redirecting...";
|
||||
static const char s_content_enc[] PROGMEM = "Content-Encoding";
|
||||
static const char s_unlock_ota [] PROGMEM = "Please unlock OTA in security settings!";
|
||||
|
||||
//Is this an IP?
|
||||
bool isIp(String str) {
|
||||
for (size_t i = 0; i < str.length(); i++) {
|
||||
@ -20,7 +25,7 @@ bool isIp(String str) {
|
||||
|
||||
void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t index, uint8_t *data, size_t len, bool final) {
|
||||
if (otaLock || !correctPIN) {
|
||||
if (final) request->send(500, "text/plain", F("Please unlock OTA in security settings!"));
|
||||
if (final) request->send(500, "text/plain", FPSTR(s_unlock_ota));
|
||||
return;
|
||||
}
|
||||
if (!index) {
|
||||
@ -44,6 +49,7 @@ void handleUpload(AsyncWebServerRequest *request, const String& filename, size_t
|
||||
}
|
||||
|
||||
void createEditHandler(bool enable) {
|
||||
if (editHandler != nullptr) server.removeHandler(editHandler);
|
||||
if (enable) {
|
||||
#ifdef WLED_ENABLE_FS_EDITOR
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@ -57,8 +63,9 @@ void createEditHandler(bool enable) {
|
||||
});
|
||||
#endif
|
||||
} else {
|
||||
editHandler = &server.on("/edit", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 500, "Access Denied", F("Please unlock settings page!"), 254);
|
||||
editHandler = &server.on("/edit", HTTP_ANY, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 500, "Access Denied", otaLock ? FPSTR(s_unlock_ota) : F("Please enter PIN in settings!"), 254);
|
||||
//serveSettings(request,request->method() == HTTP_POST); // request PIN
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -91,7 +98,7 @@ void initServer()
|
||||
server.on("/liveview", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_liveviewws, PAGE_liveviewws_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
//request->send_P(200, "text/html", PAGE_liveviewws);
|
||||
@ -100,7 +107,7 @@ void initServer()
|
||||
server.on("/liveview", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_liveview, PAGE_liveview_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
//request->send_P(200, "text/html", PAGE_liveview);
|
||||
@ -112,14 +119,12 @@ void initServer()
|
||||
serveSettings(request);
|
||||
});
|
||||
|
||||
server.on("/settings.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveSettingsJS(request);
|
||||
});
|
||||
// "/settings/settings.js&p=x" request also handled by serveSettings()
|
||||
|
||||
server.on("/style.css", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/css", PAGE_settingsCss, PAGE_settingsCss_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
@ -205,7 +210,7 @@ void initServer()
|
||||
server.on("/u", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_usermod, PAGE_usermod_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
//request->send_P(200, "text/html", PAGE_usermod);
|
||||
@ -230,7 +235,7 @@ void initServer()
|
||||
if (handleFileRead(request, "/simple.htm")) return;
|
||||
if (handleIfNoneMatchCacheHeader(request)) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", PAGE_simple, PAGE_simple_L);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
@ -238,44 +243,45 @@ void initServer()
|
||||
|
||||
server.on("/iro.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "application/javascript", iroJs, iroJs_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
server.on("/rangetouch.js", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(200, "application/javascript", rangetouchJs, rangetouchJs_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
});
|
||||
|
||||
createEditHandler(correctPIN);
|
||||
createEditHandler(correctPIN && !otaLock);
|
||||
|
||||
#ifndef WLED_DISABLE_OTA
|
||||
//if OTA is allowed
|
||||
if (!otaLock) {
|
||||
//init ota page
|
||||
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
AsyncWebServerResponse *response;
|
||||
if (correctPIN) response = request->beginResponse_P(200, "text/html", PAGE_update, PAGE_update_length);
|
||||
else response = request->beginResponse_P(200, "text/html", PAGE_settings_pin, PAGE_settings_pin_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
if (otaLock) {
|
||||
serveMessage(request, 500, "Access Denied", FPSTR(s_unlock_ota), 254);
|
||||
} else
|
||||
serveSettings(request); // checks for "upd" in URL and handles PIN
|
||||
});
|
||||
|
||||
server.on("/update", HTTP_POST, [](AsyncWebServerRequest *request){
|
||||
if (Update.hasError() || !correctPIN) {
|
||||
if (!correctPIN) {
|
||||
serveSettings(request, true); // handle PIN page POST request
|
||||
return;
|
||||
}
|
||||
if (Update.hasError() || otaLock) {
|
||||
serveMessage(request, 500, F("Update failed!"), F("Please check your file and retry!"), 254);
|
||||
} else {
|
||||
serveMessage(request, 200, F("Update successful!"), F("Rebooting..."), 131);
|
||||
doReboot = true;
|
||||
}
|
||||
},[](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final){
|
||||
if (!correctPIN) return;
|
||||
if (!correctPIN || otaLock) return;
|
||||
if(!index){
|
||||
DEBUG_PRINTLN(F("OTA Update Start"));
|
||||
lastEditTime = millis(); // make sure PIN does not lock during update
|
||||
#ifdef ESP8266
|
||||
Update.runAsync(true);
|
||||
#endif
|
||||
@ -290,11 +296,6 @@ void initServer()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 500, "Access Denied", F("Please unlock OTA in security settings!"), 254);
|
||||
});
|
||||
}
|
||||
#else
|
||||
server.on("/update", HTTP_GET, [](AsyncWebServerRequest *request){
|
||||
serveMessage(request, 501, "Not implemented", F("OTA updating is disabled in this build."), 254);
|
||||
@ -341,7 +342,7 @@ void initServer()
|
||||
#endif
|
||||
if(handleFileRead(request, request->url())) return;
|
||||
AsyncWebServerResponse *response = request->beginResponse_P(404, "text/html", PAGE_404, PAGE_404_length);
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
//request->send_P(404, "text/html", PAGE_404);
|
||||
@ -397,7 +398,7 @@ void serveIndex(AsyncWebServerRequest* request)
|
||||
#endif
|
||||
response = request->beginResponse_P(200, "text/html", PAGE_index, PAGE_index_L);
|
||||
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
}
|
||||
@ -475,11 +476,16 @@ void serveSettingsJS(AsyncWebServerRequest* request)
|
||||
char buf[SETTINGS_STACK_BUF_SIZE+37];
|
||||
buf[0] = 0;
|
||||
byte subPage = request->arg(F("p")).toInt();
|
||||
if (subPage<0 || subPage>9) {
|
||||
if (subPage > 9) {
|
||||
strcpy_P(buf, PSTR("alert('Settings for this request are not implemented.');"));
|
||||
request->send(501, "application/javascript", buf);
|
||||
return;
|
||||
}
|
||||
if (subPage > 0 && !correctPIN && strlen(settingsPIN)>0) {
|
||||
strcpy_P(buf, PSTR("alert('PIN incorrect.');"));
|
||||
request->send(403, "application/javascript", buf);
|
||||
return;
|
||||
}
|
||||
strcat_P(buf,PSTR("function GetV(){var d=document;"));
|
||||
getSettingsJS(subPage, buf+strlen(buf)); // this may overflow by 35bytes!!!
|
||||
strcat_P(buf,PSTR("}"));
|
||||
@ -489,8 +495,9 @@ void serveSettingsJS(AsyncWebServerRequest* request)
|
||||
|
||||
void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
{
|
||||
byte subPage = 0;
|
||||
byte subPage = 0, originalSubPage = 0;
|
||||
const String& url = request->url();
|
||||
|
||||
if (url.indexOf("sett") >= 0)
|
||||
{
|
||||
if (url.indexOf(".js") > 0) subPage = 254;
|
||||
@ -503,16 +510,21 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
else if (url.indexOf("sec") > 0) subPage = 6;
|
||||
else if (url.indexOf("dmx") > 0) subPage = 7;
|
||||
else if (url.indexOf("um") > 0) subPage = 8;
|
||||
} else subPage = 255; //welcome page
|
||||
else if (url.indexOf("lock") > 0) subPage = 251;
|
||||
}
|
||||
else if (url.indexOf("/update") >= 0) subPage = 9; // update page, for PIN check
|
||||
//else if (url.indexOf("/edit") >= 0) subPage = 10;
|
||||
else subPage = 255; // welcome page
|
||||
|
||||
if (subPage > 0 && subPage < 9 && strlen(settingsPIN)>0 && !correctPIN) {
|
||||
if (!correctPIN && strlen(settingsPIN) > 0 && (subPage > 0 && subPage < 11)) {
|
||||
originalSubPage = subPage;
|
||||
subPage = 252; // require PIN
|
||||
}
|
||||
|
||||
// if OTA locked or too frequent PIN entry requests fail hard
|
||||
if ((subPage == 1 && wifiLock && otaLock) || (post && !correctPIN && millis()-lastEditTime < 3000))
|
||||
{
|
||||
serveMessage(request, 500, "Access Denied", F("Please unlock OTA in security settings!"), 254); return;
|
||||
serveMessage(request, 500, "Access Denied", FPSTR(s_unlock_ota), 254); return;
|
||||
}
|
||||
|
||||
if (post) { //settings/set POST request, saving
|
||||
@ -533,24 +545,20 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
case 252: strcpy_P(s, correctPIN ? PSTR("PIN accepted") : PSTR("PIN rejected")); break;
|
||||
}
|
||||
|
||||
if (subPage != 252) strcat_P(s, PSTR(" settings saved."));
|
||||
else {
|
||||
server.removeHandler(editHandler);
|
||||
createEditHandler(correctPIN);
|
||||
}
|
||||
if (!s2[0]) strcpy_P(s2, PSTR("Redirecting..."));
|
||||
if (subPage == 252) {
|
||||
createEditHandler(correctPIN && !otaLock);
|
||||
} else
|
||||
strcat_P(s, PSTR(" settings saved."));
|
||||
|
||||
serveMessage(request, 200, s, s2, (subPage == 1 || (subPage == 6 && doReboot)) ? 129 : (correctPIN ? 1 : 10));
|
||||
//if (subPage == 6) doReboot = true;
|
||||
if (subPage == 252 && correctPIN) {
|
||||
subPage = originalSubPage; // on correct PIN load settings page the user intended
|
||||
} else {
|
||||
if (!s2[0]) strcpy_P(s2, s_redirecting);
|
||||
|
||||
serveMessage(request, 200, s, s2, (subPage == 1 || (subPage == 6 && doReboot)) ? 129 : (correctPIN ? 1 : 3));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef WLED_DISABLE_MOBILE_UI //disable welcome page if not enough storage
|
||||
if (subPage == 255) {serveIndex(request); return;}
|
||||
#endif
|
||||
|
||||
optionType = subPage;
|
||||
}
|
||||
|
||||
AsyncWebServerResponse *response;
|
||||
switch (subPage)
|
||||
@ -563,13 +571,20 @@ void serveSettings(AsyncWebServerRequest* request, bool post)
|
||||
case 6: response = request->beginResponse_P(200, "text/html", PAGE_settings_sec, PAGE_settings_sec_length); break;
|
||||
case 7: response = request->beginResponse_P(200, "text/html", PAGE_settings_dmx, PAGE_settings_dmx_length); break;
|
||||
case 8: response = request->beginResponse_P(200, "text/html", PAGE_settings_um, PAGE_settings_um_length); break;
|
||||
case 9: response = request->beginResponse_P(200, "text/html", PAGE_update, PAGE_update_length); break;
|
||||
case 251: {
|
||||
correctPIN = !strlen(settingsPIN); // lock if a pin is set
|
||||
createEditHandler(correctPIN && !otaLock);
|
||||
serveMessage(request, 200, strlen(settingsPIN) > 0 ? PSTR("Settings locked") : PSTR("No PIN set"), FPSTR(s_redirecting), 1);
|
||||
return;
|
||||
}
|
||||
case 252: response = request->beginResponse_P(200, "text/html", PAGE_settings_pin, PAGE_settings_pin_length); break;
|
||||
case 253: response = request->beginResponse_P(200, "text/css", PAGE_settingsCss, PAGE_settingsCss_length); break;
|
||||
case 254: serveSettingsJS(request); return;
|
||||
case 255: response = request->beginResponse_P(200, "text/html", PAGE_welcome, PAGE_welcome_length); break;
|
||||
default: response = request->beginResponse_P(200, "text/html", PAGE_settings, PAGE_settings_length); break;
|
||||
}
|
||||
response->addHeader(F("Content-Encoding"),"gzip");
|
||||
response->addHeader(FPSTR(s_content_enc),"gzip");
|
||||
setStaticContentCacheHeaders(response);
|
||||
request->send(response);
|
||||
}
|
@ -319,7 +319,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('c',SET_F("CR"),cctFromRgb);
|
||||
sappend('v',SET_F("CB"),strip.cctBlending);
|
||||
sappend('v',SET_F("FR"),strip.getTargetFps());
|
||||
sappend('v',SET_F("AW"),strip.autoWhiteMode);
|
||||
sappend('v',SET_F("AW"),Bus::getAutoWhiteMode());
|
||||
|
||||
for (uint8_t s=0; s < busses.getNumBusses(); s++) {
|
||||
Bus* bus = busses.getBus(s);
|
||||
@ -564,7 +564,11 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
|
||||
if (subPage == 6)
|
||||
{
|
||||
sappends('s',SET_F("PIN"),settingsPIN);
|
||||
byte l = strlen(settingsPIN);
|
||||
char fpass[l+1]; //fill PIN field with 0000
|
||||
fpass[l] = 0;
|
||||
memset(fpass,'0',l);
|
||||
sappends('s',SET_F("PIN"),fpass);
|
||||
sappend('c',SET_F("NO"),otaLock);
|
||||
sappend('c',SET_F("OW"),wifiLock);
|
||||
sappend('c',SET_F("AO"),aOtaEnabled);
|
||||
|
Loading…
Reference in New Issue
Block a user