1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-03 10:32:21 +01:00

Merge pull request from GHSA-48mj-p7x2-5jfm

* Move web_server auth to web_server_base

* Fix

* Fix

* Add middleware system
This commit is contained in:
Otto Winter
2021-09-28 02:53:38 +02:00
committed by GitHub
parent 5596751c2c
commit be965a60eb
5 changed files with 81 additions and 25 deletions

View File

@@ -17,6 +17,17 @@ namespace web_server_base {
static const char *const TAG = "web_server_base";
void WebServerBase::add_handler(AsyncWebHandler *handler) {
// remove all handlers
if (!credentials_.username.empty()) {
handler = new internal::AuthMiddlewareHandler(handler, &credentials_);
}
this->handlers_.push_back(handler);
if (this->server_ != nullptr)
this->server_->addHandler(handler);
}
void report_ota_error() {
StreamString ss;
Update.printError(ss);