1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 22: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

@@ -158,9 +158,6 @@ void WebServer::setup() {
void WebServer::dump_config() {
ESP_LOGCONFIG(TAG, "Web Server:");
ESP_LOGCONFIG(TAG, " Address: %s:%u", network::get_use_address().c_str(), this->base_->get_port());
if (this->using_auth()) {
ESP_LOGCONFIG(TAG, " Basic authentication enabled");
}
}
float WebServer::get_setup_priority() const { return setup_priority::WIFI - 1.0f; }
@@ -764,10 +761,6 @@ bool WebServer::canHandle(AsyncWebServerRequest *request) {
return false;
}
void WebServer::handleRequest(AsyncWebServerRequest *request) {
if (this->using_auth() && !request->authenticate(this->username_, this->password_)) {
return request->requestAuthentication();
}
if (request->url() == "/") {
this->handle_index_request(request);
return;