- respect Settings PIN lock in /json/cfg
pull/3238/head
Blaz Kristan 2023-06-07 21:43:32 +02:00
rodzic eb8e95723c
commit fec2d1f7ee
3 zmienionych plików z 9 dodań i 3 usunięć

Wyświetl plik

@ -320,7 +320,8 @@
// WLED Error modes
#define ERR_NONE 0 // All good :)
#define ERR_EEP_COMMIT 2 // Could not commit to EEPROM (wrong flash layout?)
#define ERR_DENIED 1 // Permission denied
#define ERR_EEP_COMMIT 2 // Could not commit to EEPROM (wrong flash layout?) OBSOLETE
#define ERR_NOBUF 3 // JSON buffer was not released in time, request cannot be handled at this time
#define ERR_JSON 9 // JSON parsing failed (input too large?)
#define ERR_FS_BEGIN 10 // Could not init filesystem (no partition?)

Wyświetl plik

@ -195,7 +195,7 @@ void initServer()
JsonObject root = doc.as<JsonObject>();
if (error || root.isNull()) {
releaseJSONBufferLock();
request->send(400, "application/json", F("{\"error\":9}"));
request->send(400, "application/json", F("{\"error\":9}")); // ERR_JSON
return;
}
const String& url = request->url();
@ -210,6 +210,11 @@ void initServer()
*/
verboseResponse = deserializeState(root);
} else {
if (!correctPIN && strlen(settingsPIN)>0) {
request->send(403, "application/json", F("{\"error\":1}")); // ERR_DENIED
releaseJSONBufferLock();
return;
}
verboseResponse = deserializeConfig(root); //use verboseResponse to determine whether cfg change should be saved immediately
}
releaseJSONBufferLock();

Wyświetl plik

@ -78,7 +78,7 @@ void wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTyp
if((info->index + len) == info->len){
if(info->final){
if(info->message_opcode == WS_TEXT) {
client->text(F("{\"error\":9}")); //we do not handle split packets right now
client->text(F("{\"error\":9}")); // ERR_JSON we do not handle split packets right now
}
}
}