diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f5379e..1137d26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,7 @@ file(GLOB SRCFILES NukiOpenerWrapper.cpp MqttTopics.h Ota.cpp + WebCfgServerConstants.h WebCfgServer.cpp PresenceDetection.cpp PreferencesKeys.h diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index 994f312..80e8b14 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -1,4 +1,5 @@ #include "WebCfgServer.h" +#include "WebCfgServerConstants.h" #include "PreferencesKeys.h" #include "Version.h" #include "hardware/WifiEthServer.h" @@ -53,6 +54,12 @@ void WebCfgServer::initialize() } sendFontsInterMinCss(); }); + _server.on("/favicon.ico", HTTP_GET, [&]() { + if (_hasCredentials && !_server.authenticate(_credUser, _credPassword)) { + return _server.requestAuthentication(); + } + sendFavicon(); + }); _server.on("/cred", [&]() { if (_hasCredentials && !_server.authenticate(_credUser, _credPassword)) { return _server.requestAuthentication(); @@ -832,11 +839,16 @@ void WebCfgServer::handleOtaUpload() void WebCfgServer::sendNewCss() { // escaped by https://www.cescaper.com/ - _server.send(200, "text/plain", newcss); + _server.send(200, "text/plain", newcss, sizeof(newcss)); } void WebCfgServer::sendFontsInterMinCss() { // escaped by https://www.cescaper.com/ - _server.send(200, "text/plain", intercss); + _server.send(200, "text/plain", intercss, sizeof(intercss)); +} + +void WebCfgServer::sendFavicon() +{ + _server.send(200, "image/png", (const char*)favicon_32x32, sizeof(favicon_32x32)); } diff --git a/WebCfgServer.h b/WebCfgServer.h index 09b40da..f33f01e 100644 --- a/WebCfgServer.h +++ b/WebCfgServer.h @@ -39,6 +39,7 @@ private: void buildConfigureWifiHtml(String& response); void sendNewCss(); void sendFontsInterMinCss(); + void sendFavicon(); void processUnpair(bool opener); void buildHtmlHeader(String& response); @@ -61,14 +62,6 @@ private: Preferences* _preferences; Ota _ota; - // escaped by https://www.cescaper.com/ - // source: https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css - const String newcss = ":root{--nc-font-sans:\\'Inter\\',-apple-system,BlinkMacSystemFont,\\'Segoe UI\\',Roboto,Oxygen,Ubuntu,Cantarell,\\'Open Sans\\',\\'Helvetica Neue\\',sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\";--nc-font-mono:Consolas,monaco,\\'Ubuntu Mono\\',\\'Liberation Mono\\',\\'Courier New\\',Courier,monospace;--nc-tx-1:#000000;--nc-tx-2:#1A1A1A;--nc-bg-1:#FFFFFF;--nc-bg-2:#F6F8FA;--nc-bg-3:#E5E7EB;--nc-lk-1:#0070F3;--nc-lk-2:#0366D6;--nc-lk-tx:#FFFFFF;--nc-ac-1:#79FFE1;--nc-ac-tx:#0C4047}@media (prefers-color-scheme:dark){:root{--nc-tx-1:#ffffff;--nc-tx-2:#eeeeee;--nc-bg-1:#000000;--nc-bg-2:#111111;--nc-bg-3:#222222;--nc-lk-1:#3291FF;--nc-lk-2:#0070F3;--nc-lk-tx:#FFFFFF;--nc-ac-1:#7928CA;--nc-ac-tx:#FFFFFF}}*{margin:0;padding:0}address,area,article,aside,audio,blockquote,datalist,details,dl,fieldset,figure,form,iframe,img,input,meter,nav,ol,optgroup,option,output,p,pre,progress,ruby,section,table,textarea,ul,video{margin-bottom:1rem}button,html,input,select{font-family:var(--nc-font-sans)}body{margin:0 auto;max-width:750px;padding:2rem;border-radius:6px;overflow-x:hidden;word-break:break-word;overflow-wrap:break-word;background:var(--nc-bg-1);color:var(--nc-tx-2);font-size:1.03rem;line-height:1.5}::selection{background:var(--nc-ac-1);color:var(--nc-ac-tx)}h1,h2,h3,h4,h5,h6{line-height:1;color:var(--nc-tx-1);padding-top:.875rem}h1,h2,h3{color:var(--nc-tx-1);padding-bottom:2px;margin-bottom:8px;border-bottom:1px solid var(--nc-bg-2)}h4,h5,h6{margin-bottom:.3rem}h1{font-size:2.25rem}h2{font-size:1.85rem}h3{font-size:1.55rem}h4{font-size:1.25rem}h5{font-size:1rem}h6{font-size:.875rem}a{color:var(--nc-lk-1)}a:hover{color:var(--nc-lk-2)}abbr:hover{cursor:help}blockquote{padding:1.5rem;background:var(--nc-bg-2);border-left:5px solid var(--nc-bg-3)}abbr{cursor:help}blockquote :last-child{padding-bottom:0;margin-bottom:0}header{background:var(--nc-bg-2);border-bottom:1px solid var(--nc-bg-3);padding:2rem 1.5rem;margin:-2rem calc(0px - (50vw - 50%)) 2rem;padding-left:calc(50vw - 50%);padding-right:calc(50vw - 50%)}header h1,header h2,header h3{padding-bottom:0;border-bottom:0}header>:first-child{margin-top:0;padding-top:0}header>:last-child{margin-bottom:0}a button,button,input[type=button],input[type=reset],input[type=submit]{font-size:1rem;display:inline-block;padding:6px 12px;text-align:center;text-decoration:none;white-space:nowrap;background:var(--nc-lk-1);color:var(--nc-lk-tx);border:0;border-radius:4px;box-sizing:border-box;cursor:pointer;color:var(--nc-lk-tx)}a button[disabled],button[disabled],input[type=button][disabled],input[type=reset][disabled],input[type=submit][disabled]{cursor:default;opacity:.5;cursor:not-allowed}.button:focus,.button:hover,button:focus,button:hover,input[type=button]:focus,input[type=button]:hover,input[type=reset]:focus,input[type=reset]:hover,input[type=submit]:focus,input[type=submit]:hover{background:var(--nc-lk-2)}code,kbd,pre,samp{font-family:var(--nc-font-mono)}code,kbd,pre,samp{background:var(--nc-bg-2);border:1px solid var(--nc-bg-3);border-radius:4px;padding:3px 6px;font-size:.9rem}kbd{border-bottom:3px solid var(--nc-bg-3)}pre{padding:1rem 1.4rem;max-width:100%;overflow:auto}pre code{background:inherit;font-size:inherit;color:inherit;border:0;padding:0;margin:0}code pre{display:inline;background:inherit;font-size:inherit;color:inherit;border:0;padding:0;margin:0}details{padding:.6rem 1rem;background:var(--nc-bg-2);border:1px solid var(--nc-bg-3);border-radius:4px}summary{cursor:pointer;font-weight:700}details[open]{padding-bottom:.75rem}details[open] summary{margin-bottom:6px}details[open]>:last-child{margin-bottom:0}dt{font-weight:700}dd::before{content:\\'→ \\'}hr{border:0;border-bottom:1px solid var(--nc-bg-3);margin:1rem auto}fieldset{margin-top:1rem;padding:2rem;border:1px solid var(--nc-bg-3);border-radius:4px}legend{padding:auto .5rem}table{border-collapse:collapse;width:100%}td,th{border:1px solid var(--nc-bg-3);text-align:left;padding:.5rem}th{background:var(--nc-bg-2)}tr:nth-child(even){background:var(--nc-bg-2)}table caption{font-weight:700;margin-bottom:.5rem}textarea{max-width:100%}ol,ul{padding-left:2rem}li{margin-top:.4rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}mark{padding:3px 6px;background:var(--nc-ac-1);color:var(--nc-ac-tx)}input,select,textarea{padding:6px 12px;margin-bottom:.5rem;background:var(--nc-bg-2);color:var(--nc-tx-2);border:1px solid var(--nc-bg-3);border-radius:4px;box-shadow:none;box-sizing:border-box}img{max-width:100%}"; - - // escaped by https://www.cescaper.com/ - // source: https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css - const String intercss = "@font-face{font-family:Inter;src:url(src/inter/Inter-Thin.woff2) format(\\'woff2\\'),url(src/inter/Inter-Thin.woff) format(\\'woff\\'),url(src/inter/Inter-Thin.ttf) format(\\'truetype\\');font-weight:100;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraLight.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraLight.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraLight.ttf) format(\\'truetype\\');font-weight:200;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Light.woff2) format(\\'woff2\\'),url(src/inter/Inter-Light.woff) format(\\'woff\\'),url(src/inter/Inter-Light.ttf) format(\\'truetype\\');font-weight:300;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Regular.woff2) format(\\'woff2\\'),url(src/inter/Inter-Regular.woff) format(\\'woff\\'),url(src/inter/Inter-Regular.ttf) format(\\'truetype\\');font-weight:400;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Medium.woff2) format(\\'woff2\\'),url(src/inter/Inter-Medium.woff) format(\\'woff\\'),url(src/inter/Inter-Medium.ttf) format(\\'truetype\\');font-weight:500;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-SemiBold.woff2) format(\\'woff2\\'),url(src/inter/Inter-SemiBold.woff) format(\\'woff\\'),url(src/inter/Inter-SemiBold.ttf) format(\\'truetype\\');font-weight:600;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Bold.woff2) format(\\'woff2\\'),url(src/inter/Inter-Bold.woff) format(\\'woff\\'),url(src/inter/Inter-Bold.ttf) format(\\'truetype\\');font-weight:700;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraBold.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraBold.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraBold.ttf) format(\\'truetype\\');font-weight:800;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Black.woff2) format(\\'woff2\\'),url(src/inter/Inter-Black.woff) format(\\'woff\\'),url(src/inter/Inter-Black.ttf) format(\\'truetype\\');font-weight:900;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ThinItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ThinItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ThinItalic.ttf) format(\\'truetype\\');font-weight:100;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraLightItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraLightItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraLightItalic.ttf) format(\\'truetype\\');font-weight:200;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-LightItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-LightItalic.woff) format(\\'woff\\'),url(src/inter/Inter-LightItalic.ttf) format(\\'truetype\\');font-weight:300;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-Italic.woff2) format(\\'woff2\\'),url(src/inter/Inter-Italic.woff) format(\\'woff\\'),url(src/inter/Inter-Italic.ttf) format(\\'truetype\\');font-weight:400;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-MediumItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-MediumItalic.woff) format(\\'woff\\'),url(src/inter/Inter-MediumItalic.ttf) format(\\'truetype\\');font-weight:500;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-SemiBoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-SemiBoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-SemiBoldItalic.ttf) format(\\'truetype\\');font-weight:600;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-BoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-BoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-BoldItalic.ttf) format(\\'truetype\\');font-weight:700;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraBoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraBoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraBoldItalic.ttf) format(\\'truetype\\');font-weight:800;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-BlackItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-BlackItalic.woff) format(\\'woff\\'),url(src/inter/Inter-BlackItalic.ttf) format(\\'truetype\\');font-weight:900;font-style:italic}"; - bool _hasCredentials = false; char _credUser[31] = {0}; char _credPassword[31] = {0}; diff --git a/WebCfgServerConstants.h b/WebCfgServerConstants.h new file mode 100644 index 0000000..a6bbb56 --- /dev/null +++ b/WebCfgServerConstants.h @@ -0,0 +1,66 @@ +#pragma once + + +// escaped by https://www.cescaper.com/ +// source: https://cdn.jsdelivr.net/npm/@exampledev/new.css@1.1.2/new.min.css +const char newcss[] = ":root{--nc-font-sans:\\'Inter\\',-apple-system,BlinkMacSystemFont,\\'Segoe UI\\',Roboto,Oxygen,Ubuntu,Cantarell,\\'Open Sans\\',\\'Helvetica Neue\\',sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\";--nc-font-mono:Consolas,monaco,\\'Ubuntu Mono\\',\\'Liberation Mono\\',\\'Courier New\\',Courier,monospace;--nc-tx-1:#000000;--nc-tx-2:#1A1A1A;--nc-bg-1:#FFFFFF;--nc-bg-2:#F6F8FA;--nc-bg-3:#E5E7EB;--nc-lk-1:#0070F3;--nc-lk-2:#0366D6;--nc-lk-tx:#FFFFFF;--nc-ac-1:#79FFE1;--nc-ac-tx:#0C4047}@media (prefers-color-scheme:dark){:root{--nc-tx-1:#ffffff;--nc-tx-2:#eeeeee;--nc-bg-1:#000000;--nc-bg-2:#111111;--nc-bg-3:#222222;--nc-lk-1:#3291FF;--nc-lk-2:#0070F3;--nc-lk-tx:#FFFFFF;--nc-ac-1:#7928CA;--nc-ac-tx:#FFFFFF}}*{margin:0;padding:0}address,area,article,aside,audio,blockquote,datalist,details,dl,fieldset,figure,form,iframe,img,input,meter,nav,ol,optgroup,option,output,p,pre,progress,ruby,section,table,textarea,ul,video{margin-bottom:1rem}button,html,input,select{font-family:var(--nc-font-sans)}body{margin:0 auto;max-width:750px;padding:2rem;border-radius:6px;overflow-x:hidden;word-break:break-word;overflow-wrap:break-word;background:var(--nc-bg-1);color:var(--nc-tx-2);font-size:1.03rem;line-height:1.5}::selection{background:var(--nc-ac-1);color:var(--nc-ac-tx)}h1,h2,h3,h4,h5,h6{line-height:1;color:var(--nc-tx-1);padding-top:.875rem}h1,h2,h3{color:var(--nc-tx-1);padding-bottom:2px;margin-bottom:8px;border-bottom:1px solid var(--nc-bg-2)}h4,h5,h6{margin-bottom:.3rem}h1{font-size:2.25rem}h2{font-size:1.85rem}h3{font-size:1.55rem}h4{font-size:1.25rem}h5{font-size:1rem}h6{font-size:.875rem}a{color:var(--nc-lk-1)}a:hover{color:var(--nc-lk-2)}abbr:hover{cursor:help}blockquote{padding:1.5rem;background:var(--nc-bg-2);border-left:5px solid var(--nc-bg-3)}abbr{cursor:help}blockquote :last-child{padding-bottom:0;margin-bottom:0}header{background:var(--nc-bg-2);border-bottom:1px solid var(--nc-bg-3);padding:2rem 1.5rem;margin:-2rem calc(0px - (50vw - 50%)) 2rem;padding-left:calc(50vw - 50%);padding-right:calc(50vw - 50%)}header h1,header h2,header h3{padding-bottom:0;border-bottom:0}header>:first-child{margin-top:0;padding-top:0}header>:last-child{margin-bottom:0}a button,button,input[type=button],input[type=reset],input[type=submit]{font-size:1rem;display:inline-block;padding:6px 12px;text-align:center;text-decoration:none;white-space:nowrap;background:var(--nc-lk-1);color:var(--nc-lk-tx);border:0;border-radius:4px;box-sizing:border-box;cursor:pointer;color:var(--nc-lk-tx)}a button[disabled],button[disabled],input[type=button][disabled],input[type=reset][disabled],input[type=submit][disabled]{cursor:default;opacity:.5;cursor:not-allowed}.button:focus,.button:hover,button:focus,button:hover,input[type=button]:focus,input[type=button]:hover,input[type=reset]:focus,input[type=reset]:hover,input[type=submit]:focus,input[type=submit]:hover{background:var(--nc-lk-2)}code,kbd,pre,samp{font-family:var(--nc-font-mono)}code,kbd,pre,samp{background:var(--nc-bg-2);border:1px solid var(--nc-bg-3);border-radius:4px;padding:3px 6px;font-size:.9rem}kbd{border-bottom:3px solid var(--nc-bg-3)}pre{padding:1rem 1.4rem;max-width:100%;overflow:auto}pre code{background:inherit;font-size:inherit;color:inherit;border:0;padding:0;margin:0}code pre{display:inline;background:inherit;font-size:inherit;color:inherit;border:0;padding:0;margin:0}details{padding:.6rem 1rem;background:var(--nc-bg-2);border:1px solid var(--nc-bg-3);border-radius:4px}summary{cursor:pointer;font-weight:700}details[open]{padding-bottom:.75rem}details[open] summary{margin-bottom:6px}details[open]>:last-child{margin-bottom:0}dt{font-weight:700}dd::before{content:\\'→ \\'}hr{border:0;border-bottom:1px solid var(--nc-bg-3);margin:1rem auto}fieldset{margin-top:1rem;padding:2rem;border:1px solid var(--nc-bg-3);border-radius:4px}legend{padding:auto .5rem}table{border-collapse:collapse;width:100%}td,th{border:1px solid var(--nc-bg-3);text-align:left;padding:.5rem}th{background:var(--nc-bg-2)}tr:nth-child(even){background:var(--nc-bg-2)}table caption{font-weight:700;margin-bottom:.5rem}textarea{max-width:100%}ol,ul{padding-left:2rem}li{margin-top:.4rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}mark{padding:3px 6px;background:var(--nc-ac-1);color:var(--nc-ac-tx)}input,select,textarea{padding:6px 12px;margin-bottom:.5rem;background:var(--nc-bg-2);color:var(--nc-tx-2);border:1px solid var(--nc-bg-3);border-radius:4px;box-shadow:none;box-sizing:border-box}img{max-width:100%}"; + +// escaped by https://www.cescaper.com/ +// source: https://cdn.jsdelivr.net/npm/open-fonts@1.1.1/fonts/inter.min.css +const char intercss[] = "@font-face{font-family:Inter;src:url(src/inter/Inter-Thin.woff2) format(\\'woff2\\'),url(src/inter/Inter-Thin.woff) format(\\'woff\\'),url(src/inter/Inter-Thin.ttf) format(\\'truetype\\');font-weight:100;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraLight.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraLight.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraLight.ttf) format(\\'truetype\\');font-weight:200;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Light.woff2) format(\\'woff2\\'),url(src/inter/Inter-Light.woff) format(\\'woff\\'),url(src/inter/Inter-Light.ttf) format(\\'truetype\\');font-weight:300;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Regular.woff2) format(\\'woff2\\'),url(src/inter/Inter-Regular.woff) format(\\'woff\\'),url(src/inter/Inter-Regular.ttf) format(\\'truetype\\');font-weight:400;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Medium.woff2) format(\\'woff2\\'),url(src/inter/Inter-Medium.woff) format(\\'woff\\'),url(src/inter/Inter-Medium.ttf) format(\\'truetype\\');font-weight:500;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-SemiBold.woff2) format(\\'woff2\\'),url(src/inter/Inter-SemiBold.woff) format(\\'woff\\'),url(src/inter/Inter-SemiBold.ttf) format(\\'truetype\\');font-weight:600;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Bold.woff2) format(\\'woff2\\'),url(src/inter/Inter-Bold.woff) format(\\'woff\\'),url(src/inter/Inter-Bold.ttf) format(\\'truetype\\');font-weight:700;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraBold.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraBold.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraBold.ttf) format(\\'truetype\\');font-weight:800;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-Black.woff2) format(\\'woff2\\'),url(src/inter/Inter-Black.woff) format(\\'woff\\'),url(src/inter/Inter-Black.ttf) format(\\'truetype\\');font-weight:900;font-style:normal}@font-face{font-family:Inter;src:url(src/inter/Inter-ThinItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ThinItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ThinItalic.ttf) format(\\'truetype\\');font-weight:100;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraLightItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraLightItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraLightItalic.ttf) format(\\'truetype\\');font-weight:200;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-LightItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-LightItalic.woff) format(\\'woff\\'),url(src/inter/Inter-LightItalic.ttf) format(\\'truetype\\');font-weight:300;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-Italic.woff2) format(\\'woff2\\'),url(src/inter/Inter-Italic.woff) format(\\'woff\\'),url(src/inter/Inter-Italic.ttf) format(\\'truetype\\');font-weight:400;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-MediumItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-MediumItalic.woff) format(\\'woff\\'),url(src/inter/Inter-MediumItalic.ttf) format(\\'truetype\\');font-weight:500;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-SemiBoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-SemiBoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-SemiBoldItalic.ttf) format(\\'truetype\\');font-weight:600;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-BoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-BoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-BoldItalic.ttf) format(\\'truetype\\');font-weight:700;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-ExtraBoldItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-ExtraBoldItalic.woff) format(\\'woff\\'),url(src/inter/Inter-ExtraBoldItalic.ttf) format(\\'truetype\\');font-weight:800;font-style:italic}@font-face{font-family:Inter;src:url(src/inter/Inter-BlackItalic.woff2) format(\\'woff2\\'),url(src/inter/Inter-BlackItalic.woff) format(\\'woff\\'),url(src/inter/Inter-BlackItalic.ttf) format(\\'truetype\\');font-weight:900;font-style:italic}"; + +// converted to char array by https://notisrac.github.io/FileToCArray/ +const unsigned char favicon_32x32[] = { + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a, + 0xf4, 0x00, 0x00, 0x02, 0xfb, 0x49, 0x44, 0x41, 0x54, 0x58, 0x47, 0xcd, 0x97, 0x4b, 0x4c, 0x53, + 0x41, 0x14, 0x86, 0xff, 0x69, 0xa5, 0x3c, 0x8a, 0x12, 0x14, 0x84, 0xa6, 0x96, 0x60, 0x6d, 0xd0, + 0x50, 0x14, 0x51, 0xd1, 0x6a, 0x4c, 0x51, 0x63, 0x88, 0x8a, 0x06, 0x63, 0x42, 0xc0, 0x85, 0x01, + 0xc3, 0xae, 0xe8, 0x0a, 0x0d, 0x4a, 0x30, 0x31, 0x18, 0xd1, 0x84, 0x18, 0x83, 0x46, 0x5d, 0xa9, + 0x09, 0xb8, 0x01, 0xa2, 0x31, 0x82, 0x31, 0x82, 0x6e, 0x48, 0x78, 0xb6, 0x74, 0xe1, 0x8b, 0x47, + 0xb0, 0x3e, 0x0a, 0xb4, 0x05, 0xa1, 0xe1, 0x25, 0x14, 0x68, 0xeb, 0x9d, 0x22, 0xb7, 0x40, 0x1f, + 0x1b, 0xef, 0xa5, 0xce, 0xea, 0xde, 0x99, 0xce, 0x39, 0xdf, 0xfc, 0x7f, 0x67, 0xee, 0x1c, 0xe2, + 0xbc, 0x0e, 0x81, 0xe3, 0x84, 0xba, 0x58, 0x40, 0x88, 0xc6, 0x09, 0x48, 0xb0, 0x0a, 0x8d, 0x00, + 0x26, 0x07, 0x71, 0x3e, 0x14, 0xd4, 0x37, 0x95, 0x11, 0x7b, 0x87, 0xba, 0x84, 0x10, 0x72, 0x63, + 0x15, 0xf2, 0x7a, 0xa4, 0x70, 0x12, 0xe7, 0x35, 0xe2, 0xe8, 0x48, 0x33, 0x81, 0x20, 0x36, 0x10, + 0x00, 0x4c, 0x4e, 0x33, 0x71, 0x68, 0xd3, 0x18, 0xe5, 0x03, 0xd7, 0xfe, 0x6f, 0x80, 0x86, 0xb6, + 0x51, 0xd4, 0xbe, 0x1b, 0x66, 0xe5, 0xd1, 0x64, 0x49, 0x91, 0xb2, 0x35, 0xdc, 0xaf, 0x5c, 0x25, + 0x8f, 0xbe, 0xc1, 0x36, 0xeb, 0x60, 0x7f, 0x93, 0x79, 0x28, 0x0a, 0x07, 0x93, 0x23, 0x7c, 0xce, + 0xf1, 0xab, 0xc0, 0x9d, 0x67, 0x46, 0x5c, 0xae, 0x30, 0xb0, 0x93, 0x93,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0xed, 0x06, 0xb0, 0xce, 0xb5, 0xc4, 0xb4, 0x59, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, + 0xae, 0x42, 0x60, 0x82 +}; \ No newline at end of file diff --git a/icon/favicon-16x16.png b/icon/favicon-16x16.png new file mode 100755 index 0000000..68ca69e Binary files /dev/null and b/icon/favicon-16x16.png differ diff --git a/icon/favicon-32x32.png b/icon/favicon-32x32.png new file mode 100755 index 0000000..d6c6c8b Binary files /dev/null and b/icon/favicon-32x32.png differ diff --git a/icon/icon-192x192.png b/icon/icon-192x192.png new file mode 100755 index 0000000..096e93f Binary files /dev/null and b/icon/icon-192x192.png differ diff --git a/icon/icon-512x512.png b/icon/icon-512x512.png new file mode 100755 index 0000000..0918d60 Binary files /dev/null and b/icon/icon-512x512.png differ diff --git a/icon/link.txt b/icon/link.txt new file mode 100644 index 0000000..82b1972 --- /dev/null +++ b/icon/link.txt @@ -0,0 +1,2 @@ +Created by: +https://favicon.io/favicon-generator/ \ No newline at end of file diff --git a/lib/WebServer/src/WebServer.cpp b/lib/WebServer/src/WebServer.cpp index a37883b..4313ad4 100644 --- a/lib/WebServer/src/WebServer.cpp +++ b/lib/WebServer/src/WebServer.cpp @@ -413,6 +413,15 @@ void WebServer::send(int code, const char* content_type, const String& content) sendContent(content); } +void WebServer::send(int code, const char *content_type, const char *content, size_t contentLength) +{ + String header; + _prepareHeader(header, code, content_type, contentLength); + _currentClientWrite(header.c_str(), header.length()); + if(contentLength) + sendContent(content, contentLength); +} + void WebServer::send_P(int code, PGM_P content_type, PGM_P content) { size_t contentLength = 0; @@ -429,6 +438,7 @@ void WebServer::send_P(int code, PGM_P content_type, PGM_P content) { } void WebServer::send_P(int code, PGM_P content_type, PGM_P content, size_t contentLength) { + _chunked = true; String header; char type[64]; memccpy_P((void*)type, (PGM_VOID_P)content_type, 0, sizeof(type)); diff --git a/lib/WebServer/src/WebServer.h b/lib/WebServer/src/WebServer.h index e609ebf..5ed6c90 100644 --- a/lib/WebServer/src/WebServer.h +++ b/lib/WebServer/src/WebServer.h @@ -119,6 +119,7 @@ public: // content_type - HTTP content type, like "text/plain" or "image/png" // content - actual content body void send(int code, const char* content_type = NULL, const String& content = String("")); + void send(int code, const char* content_type, const char* content, size_t contentLength); void send(int code, char* content_type, const String& content); void send(int code, const String& content_type, const String& content); void send_P(int code, PGM_P content_type, PGM_P content);