[web_server] Move the CSS and JS setters into the header (#19286)

This commit is contained in:
J. Nick Koston
2026-09-16 17:15:07 +12:00
committed by GitHub
parent cc9f4730b4
commit 031b980421
3 changed files with 4 additions and 15 deletions
@@ -336,13 +336,6 @@ void DeferredUpdateEventSourceList::on_client_disconnect_(DeferredUpdateEventSou
WebServer::WebServer(web_server_base::WebServerBase *base) : base_(base) {}
#ifdef USE_WEBSERVER_CSS_INCLUDE
void WebServer::set_css_include(const char *css_include) { this->css_include_ = css_include; }
#endif
#ifdef USE_WEBSERVER_JS_INCLUDE
void WebServer::set_js_include(const char *js_include) { this->js_include_ = js_include; }
#endif
json::SerializationBuffer<> WebServer::get_config_json() {
json::JsonBuilder builder;
JsonObject root = builder.root();
+4 -4
View File
@@ -204,14 +204,14 @@ class WebServer final : public Controller, public Component, public AsyncWebHand
*
* @param css_url The url to the web server stylesheet.
*/
void set_css_url(const char *css_url);
void set_css_url(const char *css_url) { this->css_url_ = css_url; }
/** Set the URL to the script that's embedded in the index page. Defaults to
* https://oi.esphome.io/v1/webserver-v1.min.js
*
* @param js_url The url to the web server script.
*/
void set_js_url(const char *js_url);
void set_js_url(const char *js_url) { this->js_url_ = js_url; }
#endif
#ifdef USE_WEBSERVER_CSS_INCLUDE
@@ -219,7 +219,7 @@ class WebServer final : public Controller, public Component, public AsyncWebHand
*
* @param css_include Local path to web server script.
*/
void set_css_include(const char *css_include);
void set_css_include(const char *css_include) { this->css_include_ = css_include; }
#endif
#ifdef USE_WEBSERVER_JS_INCLUDE
@@ -227,7 +227,7 @@ class WebServer final : public Controller, public Component, public AsyncWebHand
*
* @param js_include Local path to web server script.
*/
void set_js_include(const char *js_include);
void set_js_include(const char *js_include) { this->js_include_ = js_include; }
#endif
/** Determine whether internal components should be displayed on the web server.
@@ -69,10 +69,6 @@ void write_row(AsyncResponseStream *stream, EntityBase *obj, const std::string &
stream->print("</tr>");
}
void WebServer::set_css_url(const char *css_url) { this->css_url_ = css_url; }
void WebServer::set_js_url(const char *js_url) { this->js_url_ = js_url; }
void WebServer::handle_index_request(AsyncWebServerRequest *request) {
AsyncResponseStream *stream = request->beginResponseStream(ESPHOME_F("text/html"));
const auto &title = App.get_name();