cache static files

This commit is contained in:
duhow
2024-05-29 20:55:57 +02:00
parent a4aab07944
commit f242e0f5f4

View File

@@ -2028,9 +2028,6 @@ void WebCfgServer::buildHtmlHeader(String &response)
{ {
response.concat("<html><head>"); response.concat("<html><head>");
response.concat("<meta name='viewport' content='width=device-width, initial-scale=1'>"); response.concat("<meta name='viewport' content='width=device-width, initial-scale=1'>");
// response.concat("<style>");
// response.concat(stylecss);
// response.concat("</style>");
response.concat("<link rel='stylesheet' href='/style.css'>"); response.concat("<link rel='stylesheet' href='/style.css'>");
response.concat("<title>Nuki Hub</title></head><body>"); response.concat("<title>Nuki Hub</title></head><body>");
@@ -2299,11 +2296,13 @@ void WebCfgServer::handleOtaUpload()
void WebCfgServer::sendCss() void WebCfgServer::sendCss()
{ {
// escaped by https://www.cescaper.com/ // escaped by https://www.cescaper.com/
_server.sendHeader("Cache-Control", "public, max-age=3600");
_server.send(200, "text/css", stylecss, sizeof(stylecss)); _server.send(200, "text/css", stylecss, sizeof(stylecss));
} }
void WebCfgServer::sendFavicon() void WebCfgServer::sendFavicon()
{ {
_server.sendHeader("Cache-Control", "public, max-age=604800");
_server.send(200, "image/png", (const char*)favicon_32x32, sizeof(favicon_32x32)); _server.send(200, "image/png", (const char*)favicon_32x32, sizeof(favicon_32x32));
} }
@@ -2349,4 +2348,4 @@ String WebCfgServer::getPreselectionForGpio(const uint8_t &pin)
} }
return String((int8_t)PinRole::Disabled); return String((int8_t)PinRole::Disabled);
} }