diff --git a/components/wifi-manager/CMakeLists.txt b/components/wifi-manager/CMakeLists.txt index 1ffcd350..103276b7 100644 --- a/components/wifi-manager/CMakeLists.txt +++ b/components/wifi-manager/CMakeLists.txt @@ -2,7 +2,7 @@ idf_component_register( SRC_DIRS . INCLUDE_DIRS . ${IDF_PATH}/components/esp_http_server/src ${IDF_PATH}/components/esp_http_server/src/port/esp32 ${IDF_PATH}/components/esp_http_server/src/util ${IDF_PATH}/components/esp_http_server/src/ REQUIRES squeezelite-ota json mdns PRIV_REQUIRES tools services platform_config esp_common json newlib freertos spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server - EMBED_FILES style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz + EMBED_FILES style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz favicon.ico ) diff --git a/components/wifi-manager/component.mk b/components/wifi-manager/component.mk index 491db5eb..d2d213f3 100644 --- a/components/wifi-manager/component.mk +++ b/components/wifi-manager/component.mk @@ -6,7 +6,7 @@ # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, # please read the SDK documents if you need to do this. # -COMPONENT_EMBED_FILES := style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz +COMPONENT_EMBED_FILES := style.css code.js index.html bootstrap.min.css.gz jquery.min.js.gz popper.min.js.gz bootstrap.min.js.gz favicon.ico COMPONENT_ADD_INCLUDEDIRS := . COMPONENT_EXTRA_INCLUDES += $(IDF_PATH)/components/esp_http_server/src $(IDF_PATH)/components/esp_http_server/src/port/esp32 $(IDF_PATH)/components/esp_http_server/src/util $(IDF_PATH)/components/esp_http_server/src/ CFLAGS += -D LOG_LOCAL_LEVEL=ESP_LOG_INFO diff --git a/components/wifi-manager/favicon.ico b/components/wifi-manager/favicon.ico new file mode 100644 index 00000000..1af98935 Binary files /dev/null and b/components/wifi-manager/favicon.ico differ diff --git a/components/wifi-manager/http_server_handlers.c b/components/wifi-manager/http_server_handlers.c index d16e4be4..a11603ec 100644 --- a/components/wifi-manager/http_server_handlers.c +++ b/components/wifi-manager/http_server_handlers.c @@ -101,6 +101,8 @@ extern const uint8_t code_js_start[] asm("_binary_code_js_start"); extern const uint8_t code_js_end[] asm("_binary_code_js_end"); extern const uint8_t index_html_start[] asm("_binary_index_html_start"); extern const uint8_t index_html_end[] asm("_binary_index_html_end"); +extern const uint8_t favicon_ico_start[] asm("_binary_favicon_ico_start"); +extern const uint8_t favicon_ico_end[] asm("_binary_favicon_ico_end"); esp_err_t redirect_processor(httpd_req_t *req, httpd_err_code_t error); @@ -407,35 +409,35 @@ esp_err_t resource_filehandler(httpd_req_t *req){ const size_t file_size = (code_js_end - code_js_start); set_content_type_from_file(req, filename); httpd_resp_send(req, (const char *)code_js_start, file_size); - } - else if(strstr(filename, "style.css")) { + } else if(strstr(filename, "style.css")) { set_content_type_from_file(req, filename); const size_t file_size = (style_css_end - style_css_start); httpd_resp_send(req, (const char *)style_css_start, file_size); + } else if(strstr(filename, "favicon.ico")) { + set_content_type_from_file(req, filename); + const size_t file_size = (favicon_ico_end - favicon_ico_start); + httpd_resp_send(req, (const char *)favicon_ico_start, file_size); } else if(strstr(filename, "jquery.js")) { set_content_type_from_file(req, filename); httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); const size_t file_size = (jquery_gz_end - jquery_gz_start); httpd_resp_send(req, (const char *)jquery_gz_start, file_size); - }else if(strstr(filename, "popper.js")) { + } else if(strstr(filename, "popper.js")) { set_content_type_from_file(req, filename); httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); const size_t file_size = (popper_gz_end - popper_gz_start); httpd_resp_send(req, (const char *)popper_gz_start, file_size); - } - else if(strstr(filename, "bootstrap.js")) { + } else if(strstr(filename, "bootstrap.js")) { set_content_type_from_file(req, filename); httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); const size_t file_size = (bootstrap_js_gz_end - bootstrap_js_gz_start); httpd_resp_send(req, (const char *)bootstrap_js_gz_start, file_size); - } - else if(strstr(filename, "bootstrap.css")) { + } else if(strstr(filename, "bootstrap.css")) { set_content_type_from_file(req, filename); httpd_resp_set_hdr(req, "Content-Encoding", "gzip"); const size_t file_size = (bootstrap_css_gz_end - bootstrap_css_gz_start); httpd_resp_send(req, (const char *)bootstrap_css_gz_start, file_size); - } - else { + } else { ESP_LOGE_LOC(TAG, "Unknown resource [%s] from path [%s] ", filename,filepath); /* Respond with 404 Not Found */ httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "File does not exist"); diff --git a/components/wifi-manager/index.html b/components/wifi-manager/index.html index 445bd99a..98625b79 100644 --- a/components/wifi-manager/index.html +++ b/components/wifi-manager/index.html @@ -4,6 +4,7 @@ +