Prechádzať zdrojové kódy

Merge branch 'master-cmake' of https://github.com/sle118/squeezelite-esp32.git into master-cmake

Sebastien 5 rokov pred
rodič
commit
e7feeaddbe

+ 1 - 1
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
 						
 )
  

+ 1 - 1
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

BIN
components/wifi-manager/favicon.ico


+ 11 - 9
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");

+ 1 - 0
components/wifi-manager/index.html

@@ -4,6 +4,7 @@
         <meta charset="utf-8"/>
         <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
         <meta name="apple-mobile-web-app-capable" content="yes" />
+        <link rel="shortcut icon" type="image/x-icon" href="/res/favicon.ico">
         <link rel="stylesheet" href="/res/bootstrap.css">
         <link rel="stylesheet" href="/res/style.css">
         <script src="/res/jquery.js"></script>