add header and meta refresh for main page

This commit is contained in:
duhow
2024-05-29 19:37:21 +02:00
parent a4aab07944
commit e9494ffb02
2 changed files with 7 additions and 4 deletions

View File

@@ -1077,7 +1077,8 @@ void WebCfgServer::update()
void WebCfgServer::buildHtml(String& response)
{
buildHtmlHeader(response);
String header = "<meta http-equiv='refresh' content='15'>"; // auto refresh page
buildHtmlHeader(response, header);
response.concat("<br><h3>Info</h3>\n");
response.concat("<table>");
@@ -2024,10 +2025,12 @@ void WebCfgServer::processFactoryReset()
restartEsp(RestartReason::NukiHubReset);
}
void WebCfgServer::buildHtmlHeader(String &response)
void WebCfgServer::buildHtmlHeader(String &response, String additionalHeader)
{
response.concat("<html><head>");
response.concat("<meta name='viewport' content='width=device-width, initial-scale=1'>");
if(strcmp(additionalHeader.c_str(), "") != 0)
response.concat(additionalHeader);
// response.concat("<style>");
// response.concat(stylecss);
// response.concat("</style>");

View File

@@ -53,7 +53,7 @@ private:
void processUnpair(bool opener);
void processFactoryReset();
void buildHtmlHeader(String& response);
void buildHtmlHeader(String& response, String additionalHeader = "");
void printInputField(String& response, const char* token, const char* description, const char* value, const size_t& maxLength, const bool& isPassword = false, const bool& showLengthRestriction = false);
void printInputField(String& response, const char* token, const char* description, const int value, size_t maxLength);
void printCheckBox(String& response, const char* token, const char* description, const bool value, const char* htmlClass);
@@ -92,4 +92,4 @@ private:
String _confirmCode = "----";
bool _enabled = true;
};
};