Feature: Added touch icon for iOS and Android

Implements #1060
This commit is contained in:
Thomas Basler 2023-06-21 22:44:18 +02:00
parent 582867cdb9
commit 93057fc3dc
6 changed files with 10 additions and 1 deletions

View File

@ -22,7 +22,7 @@ framework = arduino
platform = espressif32@6.3.1
build_flags =
-DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/js/app.js.gz
-DCOMPONENT_EMBED_FILES=webapp_dist/index.html.gz:webapp_dist/zones.json.gz:webapp_dist/favicon.ico:webapp_dist/favicon.png:webapp_dist/js/app.js.gz
-DPIOENV=\"$PIOENV\"
-Wall -Wextra -Werror
-std=c++17

View File

@ -6,11 +6,13 @@
extern const uint8_t file_index_html_start[] asm("_binary_webapp_dist_index_html_gz_start");
extern const uint8_t file_favicon_ico_start[] asm("_binary_webapp_dist_favicon_ico_start");
extern const uint8_t file_favicon_png_start[] asm("_binary_webapp_dist_favicon_png_start");
extern const uint8_t file_zones_json_start[] asm("_binary_webapp_dist_zones_json_gz_start");
extern const uint8_t file_app_js_start[] asm("_binary_webapp_dist_js_app_js_gz_start");
extern const uint8_t file_index_html_end[] asm("_binary_webapp_dist_index_html_gz_end");
extern const uint8_t file_favicon_ico_end[] asm("_binary_webapp_dist_favicon_ico_end");
extern const uint8_t file_favicon_png_end[] asm("_binary_webapp_dist_favicon_png_end");
extern const uint8_t file_zones_json_end[] asm("_binary_webapp_dist_zones_json_gz_end");
extern const uint8_t file_app_js_end[] asm("_binary_webapp_dist_js_app_js_gz_end");
@ -41,6 +43,11 @@ void WebApiWebappClass::init(AsyncWebServer* server)
request->send(response);
});
_server->on("/favicon.png", HTTP_GET, [](AsyncWebServerRequest* request) {
AsyncWebServerResponse* response = request->beginResponse_P(200, "image/png", file_favicon_png_start, file_favicon_png_end - file_favicon_png_start);
request->send(response);
});
_server->on("/zones.json", HTTP_GET, [](AsyncWebServerRequest* request) {
AsyncWebServerResponse* response = request->beginResponse_P(200, "application/json", file_zones_json_start, file_zones_json_end - file_zones_json_start);
response->addHeader("Content-Encoding", "gzip");

View File

@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<link rel="shortcut icon" type="image/png" href="/favicon.png">
<link rel="apple-touch-icon" href="/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenDTU</title>
</head>

BIN
webapp/public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

BIN
webapp_dist/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 B

Binary file not shown.