1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-24 12:43:51 +01:00

Make OTA function switchable in web_server component (#2685)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Laszlo Gazdag
2021-11-10 20:31:22 +01:00
committed by GitHub
parent 99c775d8cb
commit 0bdb48bcac
5 changed files with 23 additions and 5 deletions

View File

@@ -58,6 +58,12 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
*/
void set_js_include(const char *js_include);
/** Set whether or not the webserver should expose the OTA form and handler.
*
* @param allow_ota.
*/
void set_allow_ota(bool allow_ota) { this->allow_ota_ = allow_ota; }
// ========== INTERNAL METHODS ==========
// (In most use cases you won't need these)
/// Setup the internal web server and register handlers.
@@ -182,6 +188,7 @@ class WebServer : public Controller, public Component, public AsyncWebHandler {
const char *css_include_{nullptr};
const char *js_url_{nullptr};
const char *js_include_{nullptr};
bool allow_ota_{true};
};
} // namespace web_server