WebServer: fixed 404 handling and listanim
This commit is contained in:
parent
1410124e49
commit
af3adf99db
|
@ -21,6 +21,11 @@ WebServer::WebServer(void)
|
||||||
bool WebServer::serveFile(String filename, httpsserver::HTTPResponse *res)
|
bool WebServer::serveFile(String filename, httpsserver::HTTPResponse *res)
|
||||||
{
|
{
|
||||||
uint8_t buf[1024];
|
uint8_t buf[1024];
|
||||||
|
|
||||||
|
if(!SPIFFS.exists(filename)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
File f = SPIFFS.open(filename.c_str(), "r");
|
File f = SPIFFS.open(filename.c_str(), "r");
|
||||||
|
|
||||||
if(!f) {
|
if(!f) {
|
||||||
|
@ -151,7 +156,9 @@ void WebServer::handleListAnim(httpsserver::HTTPRequest *req, httpsserver::HTTPR
|
||||||
for(size_t i = 0; i < AnimationController::AnimationNames.size(); i++) {
|
for(size_t i = 0; i < AnimationController::AnimationNames.size(); i++) {
|
||||||
res->print("{\"id\":");
|
res->print("{\"id\":");
|
||||||
res->print(i);
|
res->print(i);
|
||||||
res->print("}");
|
res->print(",\"name\":\"");
|
||||||
|
res->print(AnimationController::AnimationNames[i]);
|
||||||
|
res->print("\"}");
|
||||||
|
|
||||||
if(i < AnimationController::AnimationNames.size()-1) {
|
if(i < AnimationController::AnimationNames.size()-1) {
|
||||||
res->print(",");
|
res->print(",");
|
||||||
|
|
Loading…
Reference in a new issue