1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-24 04:33:49 +01:00

Add configuration option to disable the log UI. (#4419)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Dion Hulse
2023-06-22 07:58:49 +10:00
committed by GitHub
parent e8ce7048d8
commit 1cc7428445
4 changed files with 25 additions and 9 deletions

View File

@@ -99,6 +99,11 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
* @param allow_ota.
*/
void set_allow_ota(bool allow_ota) { this->allow_ota_ = allow_ota; }
/** Set whether or not the webserver should expose the Log.
*
* @param expose_log.
*/
void set_expose_log(bool expose_log) { this->expose_log_ = expose_log; }
// ========== INTERNAL METHODS ==========
// (In most use cases you won't need these)
@@ -114,6 +119,9 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
/// Handle an index request under '/'.
void handle_index_request(AsyncWebServerRequest *request);
/// Return the webserver configuration as JSON.
std::string get_config_json();
#ifdef USE_WEBSERVER_CSS_INCLUDE
/// Handle included css request under '/0.css'.
void handle_css_request(AsyncWebServerRequest *request);
@@ -274,6 +282,7 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
#endif
bool include_internal_{false};
bool allow_ota_{true};
bool expose_log_{true};
#ifdef USE_ESP32
std::deque<std::function<void()>> to_schedule_;
SemaphoreHandle_t to_schedule_lock_;