X-Git-Url: https://git.rvb.name/esp-clock.git/blobdiff_plain/db62bcceea4a80b5eac31432a11c56518c7fb61f..9d5bed5c1af4aca9cb37dbff3e111f51c67da451:/web.cpp diff --git a/web.cpp b/web.cpp index 7632250..b34d7cf 100644 --- a/web.cpp +++ b/web.cpp @@ -135,7 +135,6 @@ void setupWeb() { server.on("/action", HTTP_GET, [](AsyncWebServerRequest* request) { if (auth_user && auth_pwd && auth_user[0] && auth_pwd[0] && !request->authenticate(auth_user, auth_pwd)) { - Serial.print("Failed auth as user: "); Serial.print(auth_user); Serial.print(':'); Serial.print(auth_pwd); Serial.println('!'); return request-> requestAuthentication(); } if(request->hasParam("name")) { @@ -279,9 +278,9 @@ void setupWeb() { } }); - server.serveStatic("ui", LittleFS, "/ui.json"); + server.serveStatic("ui", LittleFS, "/ui.json").setAuthentication(auth_user,auth_pwd); - server.serveStatic("/", LittleFS, "/web/").setDefaultFile("index.html"); + server.serveStatic("/", LittleFS, "/web/").setDefaultFile("index.html").setAuthentication(auth_user,auth_pwd); server.onNotFound([](AsyncWebServerRequest *request){ request->send(404,"text/plain","Not found"); @@ -291,6 +290,8 @@ void setupWeb() { sendInitial(client); }); + events.setAuthentication(auth_user,auth_pwd); + server.addHandler(&events); server.begin();