projects
/
esp-clock.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
db62bcc
)
Добавлена авторизация везде, где ее упустил до того.
author
Roman Bazalevskiy
<rvb@rvb.name>
Wed, 16 Nov 2022 18:42:39 +0000
(21:42 +0300)
committer
Roman Bazalevskiy
<rvb@rvb.name>
Wed, 16 Nov 2022 18:42:39 +0000
(21:42 +0300)
web.cpp
patch
|
blob
|
history
diff --git
a/web.cpp
b/web.cpp
index 7632250fb1a7021bb6e035d5eeca38767544e623..b34d7cf069edfd32f587b532065760afc4554cf0 100644
(file)
--- 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)) {
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")) {
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");
server.onNotFound([](AsyncWebServerRequest *request){
request->send(404,"text/plain","Not found");
@@
-291,6
+290,8
@@
void setupWeb() {
sendInitial(client);
});
sendInitial(client);
});
+ events.setAuthentication(auth_user,auth_pwd);
+
server.addHandler(&events);
server.begin();
server.addHandler(&events);
server.begin();