1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-24 04:33:49 +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

@@ -32,10 +32,6 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
public:
WebServer(web_server_base::WebServerBase *base) : base_(base) {}
void set_username(const char *username) { username_ = username; }
void set_password(const char *password) { password_ = password; }
/** Set the URL to the CSS <link> that's sent to each client. Defaults to
* https://esphome.io/_static/webserver-v1.min.css
*
@@ -85,8 +81,6 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
void handle_js_request(AsyncWebServerRequest *request);
#endif
bool using_auth() { return username_ != nullptr && password_ != nullptr; }
#ifdef USE_SENSOR
void on_sensor_update(sensor::Sensor *obj, float state) override;
/// Handle a sensor request under '/sensor/<id>'.
@@ -184,8 +178,6 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
protected:
web_server_base::WebServerBase *base_;
AsyncEventSource events_{"/events"};
const char *username_{nullptr};
const char *password_{nullptr};
const char *css_url_{nullptr};
const char *css_include_{nullptr};
const char *js_url_{nullptr};