From 93057fc3dc3e8c6ff2831e1dc40cff71f36863a4 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Wed, 21 Jun 2023 22:44:18 +0200 Subject: [PATCH] Feature: Added touch icon for iOS and Android Implements #1060 --- platformio.ini | 2 +- src/WebApi_webapp.cpp | 7 +++++++ webapp/index.html | 2 ++ webapp/public/favicon.png | Bin 0 -> 682 bytes webapp_dist/favicon.png | Bin 0 -> 682 bytes webapp_dist/index.html.gz | Bin 329 -> 363 bytes 6 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 webapp/public/favicon.png create mode 100644 webapp_dist/favicon.png diff --git a/platformio.ini b/platformio.ini index bdc0e93..76b9188 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 diff --git a/src/WebApi_webapp.cpp b/src/WebApi_webapp.cpp index 4976f78..fd42da5 100644 --- a/src/WebApi_webapp.cpp +++ b/src/WebApi_webapp.cpp @@ -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"); diff --git a/webapp/index.html b/webapp/index.html index 36236f1..39a94a0 100644 --- a/webapp/index.html +++ b/webapp/index.html @@ -3,6 +3,8 @@ + + OpenDTU diff --git a/webapp/public/favicon.png b/webapp/public/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..3378b661323215355b212542a9fe59b610adeae1 GIT binary patch literal 682 zcmV;b0#*HqP)Yc1Y}7*P?l{03AtJT4RzxI-h<_!=egl{XkU>KF z^h5+}t&1^w5rN)AMB!rv0PxKGeY@RoyG zB!GHK6>3jNMf-P0;F;Mm^JDI7qN*y__q~fT&XRFW0io-jEVgNPu;m^l(wtDw;O zQztS30W=ed*X$XPl;&jiTcKrYboHmx>DR#lAmR8Y4jc}LvP!6yLbZ16{@hxlom1oN z3$uA*y0vzYDaIH8fSFzXP2S&i-C!+8BJrqenlbVv={RO~#u(^J7n>86N%Qx7rGl~~ zA0rnLpELUN`K&#@0nq5A??lSeq`Uxtgy$b4*zI-$nE*iF_miZ&-|s(dG-l8Ny;kPT z{K$CwF(b+2C|Wj%%jL3l&8IPEg4f7f*b#+JopLRD2Yrf(z?q8wkc>e!?@P~)W-U35ZvO;%Mm>D);IdSt?j#+LNBR2t(lcCg zx==iHwypz!%N!zWt$a%FFLC29!5>!qrv0I!+Z<&kMWS9bd_m}EwaZ%1oM=&P!7MD%nnDD5^s8I#}p|6T?E0Pw3|@?Jmc Qz5oCK07*qoM6N<$f~lH1Y5)KL literal 0 HcmV?d00001 diff --git a/webapp_dist/favicon.png b/webapp_dist/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..3378b661323215355b212542a9fe59b610adeae1 GIT binary patch literal 682 zcmV;b0#*HqP)Yc1Y}7*P?l{03AtJT4RzxI-h<_!=egl{XkU>KF z^h5+}t&1^w5rN)AMB!rv0PxKGeY@RoyG zB!GHK6>3jNMf-P0;F;Mm^JDI7qN*y__q~fT&XRFW0io-jEVgNPu;m^l(wtDw;O zQztS30W=ed*X$XPl;&jiTcKrYboHmx>DR#lAmR8Y4jc}LvP!6yLbZ16{@hxlom1oN z3$uA*y0vzYDaIH8fSFzXP2S&i-C!+8BJrqenlbVv={RO~#u(^J7n>86N%Qx7rGl~~ zA0rnLpELUN`K&#@0nq5A??lSeq`Uxtgy$b4*zI-$nE*iF_miZ&-|s(dG-l8Ny;kPT z{K$CwF(b+2C|Wj%%jL3l&8IPEg4f7f*b#+JopLRD2Yrf(z?q8wkc>e!?@P~)W-U35ZvO;%Mm>D);IdSt?j#+LNBR2t(lcCg zx==iHwypz!%N!zWt$a%FFLC29!5>!qrv0I!+Z<&kMWS9bd_m}EwaZ%1oM=&P!7MD%nnDD5^s8I#}p|6T?E0Pw3|@?Jmc Qz5oCK07*qoM6N<$f~lH1Y5)KL literal 0 HcmV?d00001 diff --git a/webapp_dist/index.html.gz b/webapp_dist/index.html.gz index d0a8c5248d5b683e445218e217e429462811da31..cc2cb3815560274c68bf49a7d9a0278102d8ad22 100644 GIT binary patch literal 363 zcmV-x0hIn9iwFP!000023T;w7Z-X!p-SaE1Ua}Nuw+_J4v_qFfYND#6gD>F3*p_WT z{QDl5s;QC%``LHz<4pdr*}m?-cW=;yR+X!KT0n7K7YsEkR{(i~Tud9zA;7}DzRz@>u9G(i6op?Xtls@-rePdjxx&W~$j24NYI|qRpr%NJ6rm{uQX3{Scm%0skX$9c;tGrB z^yx1~kU?R&wWv4yL!Lz#uYBdC4NIQZh)yBtIODx>vX&aWtH|NmXXHLTdsgOI?1==^ zL*+r zBp6&cgAdMQFe40