add favicon

This commit is contained in:
technyon
2022-08-06 09:47:23 +02:00
parent 651a2aab53
commit 241d39a2e4
11 changed files with 95 additions and 10 deletions

View File

@@ -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));
}