From c5d4eef56fde6bcb240c8e4c15d2d762366bba55 Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Wed, 7 Aug 2024 19:31:21 +0200 Subject: [PATCH 1/4] web_server --- esphome/components/web_server/web_server.h | 2 +- esphome/components/web_server_base/web_server_base.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/esphome/components/web_server/web_server.h b/esphome/components/web_server/web_server.h index 5b98806af1..d4ab592b7b 100644 --- a/esphome/components/web_server/web_server.h +++ b/esphome/components/web_server/web_server.h @@ -334,7 +334,7 @@ class WebServer : public Controller, public Component, public AsyncWebHandler { /// Override the web handler's handleRequest method. void handleRequest(AsyncWebServerRequest *request) override; /// This web handle is not trivial. - bool isRequestHandlerTrivial() override; + bool isRequestHandlerTrivial() override; // NOLINT(readability-identifier-naming) void add_entity_to_sorting_list(EntityBase *entity, float weight); diff --git a/esphome/components/web_server_base/web_server_base.h b/esphome/components/web_server_base/web_server_base.h index c312126472..e5b72a8ec9 100644 --- a/esphome/components/web_server_base/web_server_base.h +++ b/esphome/components/web_server_base/web_server_base.h @@ -31,6 +31,7 @@ class MiddlewareHandler : public AsyncWebHandler { void handleBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) override { next_->handleBody(request, data, len, index, total); } + // NOLINTNEXTLINE(readability-identifier-naming) bool isRequestHandlerTrivial() override { return next_->isRequestHandlerTrivial(); } protected: @@ -104,8 +105,8 @@ class WebServerBase : public Component { std::shared_ptr get_server() const { return server_; } float get_setup_priority() const override; - void set_auth_username(std::string auth_username) { credentials_.username = std::move(auth_username); } - void set_auth_password(std::string auth_password) { credentials_.password = std::move(auth_password); } + void set_auth_username(std::string &&auth_username) { credentials_.username = std::move(auth_username); } + void set_auth_password(std::string &&auth_password) { credentials_.password = std::move(auth_password); } void add_handler(AsyncWebHandler *handler); @@ -133,7 +134,7 @@ class OTARequestHandler : public AsyncWebHandler { bool canHandle(AsyncWebServerRequest *request) override { return request->url() == "/update" && request->method() == HTTP_POST; } - + // NOLINTNEXTLINE(readability-identifier-naming) bool isRequestHandlerTrivial() override { return false; } protected: From 76ae57c19be078fba0a6e97ee2132a8f94f1a050 Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Wed, 7 Aug 2024 19:47:43 +0200 Subject: [PATCH 2/4] use const instead of move --- esphome/components/web_server_base/web_server_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/web_server_base/web_server_base.h b/esphome/components/web_server_base/web_server_base.h index e5b72a8ec9..8da0322565 100644 --- a/esphome/components/web_server_base/web_server_base.h +++ b/esphome/components/web_server_base/web_server_base.h @@ -105,8 +105,8 @@ class WebServerBase : public Component { std::shared_ptr get_server() const { return server_; } float get_setup_priority() const override; - void set_auth_username(std::string &&auth_username) { credentials_.username = std::move(auth_username); } - void set_auth_password(std::string &&auth_password) { credentials_.password = std::move(auth_password); } + void set_auth_username(const std::string &auth_username) { credentials_.username = auth_username; } + void set_auth_password(const std::string &auth_password) { credentials_.password = auth_password; } void add_handler(AsyncWebHandler *handler); From b2702c53ed267230c06e9def375c302d669b5bf7 Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Wed, 7 Aug 2024 19:50:19 +0200 Subject: [PATCH 3/4] rollback --- esphome/components/web_server_base/web_server_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/web_server_base/web_server_base.h b/esphome/components/web_server_base/web_server_base.h index 8da0322565..8c7746e8eb 100644 --- a/esphome/components/web_server_base/web_server_base.h +++ b/esphome/components/web_server_base/web_server_base.h @@ -105,8 +105,8 @@ class WebServerBase : public Component { std::shared_ptr get_server() const { return server_; } float get_setup_priority() const override; - void set_auth_username(const std::string &auth_username) { credentials_.username = auth_username; } - void set_auth_password(const std::string &auth_password) { credentials_.password = auth_password; } + void set_auth_username(std::string auth_username) { credentials_.username = auth_username; } + void set_auth_password(std::string auth_password) { credentials_.password = auth_password; } void add_handler(AsyncWebHandler *handler); From 0396ca60e14afbbfca564f47185595aca43c8d5c Mon Sep 17 00:00:00 2001 From: Tomasz Duda Date: Wed, 7 Aug 2024 19:51:13 +0200 Subject: [PATCH 4/4] rollback --- esphome/components/web_server_base/web_server_base.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/web_server_base/web_server_base.h b/esphome/components/web_server_base/web_server_base.h index 8c7746e8eb..6077580200 100644 --- a/esphome/components/web_server_base/web_server_base.h +++ b/esphome/components/web_server_base/web_server_base.h @@ -105,8 +105,8 @@ class WebServerBase : public Component { std::shared_ptr get_server() const { return server_; } float get_setup_priority() const override; - void set_auth_username(std::string auth_username) { credentials_.username = auth_username; } - void set_auth_password(std::string auth_password) { credentials_.password = auth_password; } + void set_auth_username(std::string auth_username) { credentials_.username = std::move(auth_username); } + void set_auth_password(std::string auth_password) { credentials_.password = std::move(auth_password); } void add_handler(AsyncWebHandler *handler);