mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Cleanup unused http styles
This commit is contained in:
parent
d99e848e19
commit
dab42f7853
@ -103,8 +103,7 @@ const char MAIN_MENU_BUTTON[] PROGMEM =
|
|||||||
const char MIT_LICENSE[] PROGMEM = "</br>MIT License</p>";
|
const char MIT_LICENSE[] PROGMEM = "</br>MIT License</p>";
|
||||||
|
|
||||||
const char HTTP_DOCTYPE[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta charset='utf-8'><meta "
|
const char HTTP_DOCTYPE[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta charset='utf-8'><meta "
|
||||||
"name=\"viewport\" content=\"width=device-width,initial-scale=1,"
|
"name=\"viewport\" content=\"width=device-width,initial-scale=1\"/>";
|
||||||
"user-scalable=no\"/>";
|
|
||||||
const char HTTP_META_GO_BACK[] PROGMEM = "<meta http-equiv='refresh' content='15;url=/'/>";
|
const char HTTP_META_GO_BACK[] PROGMEM = "<meta http-equiv='refresh' content='15;url=/'/>";
|
||||||
const char HTTP_HEADER[] PROGMEM = "<title>%s</title>";
|
const char HTTP_HEADER[] PROGMEM = "<title>%s</title>";
|
||||||
const char HTTP_STYLE[] PROGMEM = "<link rel=\"stylesheet\" href=\"/css\">";
|
const char HTTP_STYLE[] PROGMEM = "<link rel=\"stylesheet\" href=\"/css\">";
|
||||||
@ -123,19 +122,19 @@ const char HTTP_CSS[] PROGMEM =
|
|||||||
";line-height:2.4rem;font-size:1.2rem;width:100%;}"
|
";line-height:2.4rem;font-size:1.2rem;width:100%;}"
|
||||||
//".q{float:right;width:64px;text-align:right;}"
|
//".q{float:right;width:64px;text-align:right;}"
|
||||||
".red{background-color:" D_HTTP_COLOR_BUTTON_RESET ";}"
|
".red{background-color:" D_HTTP_COLOR_BUTTON_RESET ";}"
|
||||||
|
"#doc{text-align:left;display:inline-block;color:" D_HTTP_COLOR_TEXT ";min-width:260px;}"
|
||||||
// ".button3{background-color:#f44336;}"
|
// ".button3{background-color:#f44336;}"
|
||||||
// ".button4{background-color:#e7e7e7;color:black;}"
|
// ".button4{background-color:#e7e7e7;color:black;}"
|
||||||
// ".button5{background-color:#555555;}"
|
// ".button5{background-color:#555555;}"
|
||||||
// ".button6{background-color:#4CAF50;}"
|
// ".button6{background-color:#4CAF50;}"
|
||||||
"td{font-size:0.87rem;padding-bottom:0px;padding-top:0px;}th{padding-top:0.5em;}";
|
"td{font-size:0.87rem;padding-bottom:0px;padding-top:0px;}th{padding-top:0.5em;}";
|
||||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function "
|
// const char HTTP_SCRIPT[] PROGMEM = "<script>function "
|
||||||
"c(l){document.getElementById('s').value=l.innerText||l.textContent;document."
|
// "c(l){document.getElementById('s').value=l.innerText||l.textContent;document."
|
||||||
"getElementById('p').focus();}</script>";
|
// "getElementById('p').focus();}</script>";
|
||||||
const char HTTP_HEADER_END[] PROGMEM =
|
const char HTTP_HEADER_END[] PROGMEM =
|
||||||
"</head><body><div style='text-align:left;display:inline-block;color:" D_HTTP_COLOR_TEXT ";min-width:260px;'>";
|
"</head><body><div id='doc'>";
|
||||||
const char HTTP_END[] PROGMEM = "<div style='text-align:right;font-size:11px;'><hr/><a href='/about' "
|
const char HTTP_FOOTER[] PROGMEM = "<div style='text-align:right;font-size:11px;'><hr/><a href='/about'>" D_MANUFACTURER " ";
|
||||||
"style='color:" D_HTTP_COLOR_TEXT ";'>" D_MANUFACTURER " ";
|
const char HTTP_END[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
||||||
const char HTTP_FOOTER[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -146,12 +145,6 @@ const char HTTP_FOOTER[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
|||||||
// // Default link to compiled Nextion firmware images
|
// // Default link to compiled Nextion firmware images
|
||||||
// String lcdFirmwareUrl = "http://haswitchplate.com/update/HASwitchPlate.tft";
|
// String lcdFirmwareUrl = "http://haswitchplate.com/update/HASwitchPlate.tft";
|
||||||
|
|
||||||
// #if HASP_USE_MQTT > 0
|
|
||||||
// extern char mqttNodeName[16];
|
|
||||||
// #else
|
|
||||||
// char mqttNodeName[3] = "na";
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
String getOption(int value, String label, bool selected)
|
String getOption(int value, String label, bool selected)
|
||||||
{
|
{
|
||||||
@ -251,13 +244,13 @@ bool httpIsAuthenticated(const __FlashStringHelper* notused)
|
|||||||
void webSendFooter()
|
void webSendFooter()
|
||||||
{
|
{
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
webServer.sendContent(HTTP_END);
|
|
||||||
webServer.sendContent(haspDevice.get_version());
|
|
||||||
webServer.sendContent(HTTP_FOOTER);
|
webServer.sendContent(HTTP_FOOTER);
|
||||||
#else
|
|
||||||
webServer.sendContent_P(HTTP_END);
|
|
||||||
webServer.sendContent(haspDevice.get_version());
|
webServer.sendContent(haspDevice.get_version());
|
||||||
|
webServer.sendContent(HTTP_END);
|
||||||
|
#else
|
||||||
webServer.sendContent_P(HTTP_FOOTER);
|
webServer.sendContent_P(HTTP_FOOTER);
|
||||||
|
webServer.sendContent(haspDevice.get_version());
|
||||||
|
webServer.sendContent_P(HTTP_END);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,13 +274,13 @@ void webSendPage(const char* nodename, uint32_t httpdatalength, bool gohome = fa
|
|||||||
uint32_t contentLength = strlen(haspDevice.get_version()); // version length
|
uint32_t contentLength = strlen(haspDevice.get_version()); // version length
|
||||||
contentLength += sizeof(HTTP_DOCTYPE) - 1;
|
contentLength += sizeof(HTTP_DOCTYPE) - 1;
|
||||||
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s
|
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s
|
||||||
contentLength += sizeof(HTTP_SCRIPT) - 1;
|
// contentLength += sizeof(HTTP_SCRIPT) - 1;
|
||||||
contentLength += sizeof(HTTP_STYLE) - 1;
|
contentLength += sizeof(HTTP_STYLE) - 1;
|
||||||
// contentLength += sizeof(HASP_STYLE) - 1;
|
// contentLength += sizeof(HASP_STYLE) - 1;
|
||||||
if(gohome) contentLength += sizeof(HTTP_META_GO_BACK) - 1;
|
if(gohome) contentLength += sizeof(HTTP_META_GO_BACK) - 1;
|
||||||
contentLength += sizeof(HTTP_HEADER_END) - 1;
|
contentLength += sizeof(HTTP_HEADER_END) - 1;
|
||||||
contentLength += sizeof(HTTP_END) - 1;
|
|
||||||
contentLength += sizeof(HTTP_FOOTER) - 1;
|
contentLength += sizeof(HTTP_FOOTER) - 1;
|
||||||
|
contentLength += sizeof(HTTP_END) - 1;
|
||||||
|
|
||||||
if(httpdatalength > HTTP_PAGE_SIZE) {
|
if(httpdatalength > HTTP_PAGE_SIZE) {
|
||||||
LOG_WARNING(TAG_HTTP, F("Sending page with %u static and %u dynamic bytes"), contentLength, httpdatalength);
|
LOG_WARNING(TAG_HTTP, F("Sending page with %u static and %u dynamic bytes"), contentLength, httpdatalength);
|
||||||
@ -305,13 +298,13 @@ void webSendPage(const char* nodename, uint32_t httpdatalength, bool gohome = fa
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(STM32F4xx)
|
#if defined(STM32F4xx)
|
||||||
webServer.sendContent(HTTP_SCRIPT); // 131
|
// webServer.sendContent(HTTP_SCRIPT); // 131
|
||||||
webServer.sendContent(HTTP_STYLE); // 487
|
webServer.sendContent(HTTP_STYLE); // 487
|
||||||
// webServer.sendContent(HASP_STYLE); // 145
|
// webServer.sendContent(HASP_STYLE); // 145
|
||||||
if(gohome) webServer.sendContent(HTTP_META_GO_BACK); // 47
|
if(gohome) webServer.sendContent(HTTP_META_GO_BACK); // 47
|
||||||
webServer.sendContent(HTTP_HEADER_END); // 80
|
webServer.sendContent(HTTP_HEADER_END); // 80
|
||||||
#else
|
#else
|
||||||
webServer.sendContent_P(HTTP_SCRIPT); // 131
|
// webServer.sendContent_P(HTTP_SCRIPT); // 131
|
||||||
webServer.sendContent_P(HTTP_STYLE); // 487
|
webServer.sendContent_P(HTTP_STYLE); // 487
|
||||||
// webServer.sendContent_P(HASP_STYLE); // 145
|
// webServer.sendContent_P(HASP_STYLE); // 145
|
||||||
if(gohome) webServer.sendContent_P(HTTP_META_GO_BACK); // 47
|
if(gohome) webServer.sendContent_P(HTTP_META_GO_BACK); // 47
|
||||||
|
@ -104,8 +104,7 @@ const char MAIN_MENU_BUTTON[] PROGMEM =
|
|||||||
const char MIT_LICENSE[] PROGMEM = "</br>MIT License</p>";
|
const char MIT_LICENSE[] PROGMEM = "</br>MIT License</p>";
|
||||||
|
|
||||||
const char HTTP_DOCTYPE[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta charset='utf-8'><meta "
|
const char HTTP_DOCTYPE[] PROGMEM = "<!DOCTYPE html><html lang=\"en\"><head><meta charset='utf-8'><meta "
|
||||||
"name=\"viewport\" content=\"width=device-width,initial-scale=1,"
|
"name=\"viewport\" content=\"width=device-width,initial-scale=1\"/>";
|
||||||
"user-scalable=no\"/>";
|
|
||||||
const char HTTP_META_GO_BACK[] PROGMEM = "<meta http-equiv='refresh' content='15;url=/'/>";
|
const char HTTP_META_GO_BACK[] PROGMEM = "<meta http-equiv='refresh' content='15;url=/'/>";
|
||||||
const char HTTP_HEADER[] PROGMEM = "<title>%s</title>";
|
const char HTTP_HEADER[] PROGMEM = "<title>%s</title>";
|
||||||
const char HTTP_STYLE[] PROGMEM = "<link rel=\"stylesheet\" href=\"/css\">";
|
const char HTTP_STYLE[] PROGMEM = "<link rel=\"stylesheet\" href=\"/css\">";
|
||||||
@ -124,19 +123,19 @@ const char HTTP_CSS[] PROGMEM =
|
|||||||
";line-height:2.4rem;font-size:1.2rem;width:100%;}"
|
";line-height:2.4rem;font-size:1.2rem;width:100%;}"
|
||||||
//".q{float:right;width:64px;text-align:right;}"
|
//".q{float:right;width:64px;text-align:right;}"
|
||||||
".red{background-color:" D_HTTP_COLOR_BUTTON_RESET ";}"
|
".red{background-color:" D_HTTP_COLOR_BUTTON_RESET ";}"
|
||||||
|
"#doc{text-align:left;display:inline-block;color:" D_HTTP_COLOR_TEXT ";min-width:260px;}"
|
||||||
// ".button3{background-color:#f44336;}"
|
// ".button3{background-color:#f44336;}"
|
||||||
// ".button4{background-color:#e7e7e7;color:black;}"
|
// ".button4{background-color:#e7e7e7;color:black;}"
|
||||||
// ".button5{background-color:#555555;}"
|
// ".button5{background-color:#555555;}"
|
||||||
// ".button6{background-color:#4CAF50;}"
|
// ".button6{background-color:#4CAF50;}"
|
||||||
"td{font-size:0.87rem;padding-bottom:0px;padding-top:0px;}th{padding-top:0.5em;}";
|
"td{font-size:0.87rem;padding-bottom:0px;padding-top:0px;}th{padding-top:0.5em;}";
|
||||||
const char HTTP_SCRIPT[] PROGMEM = "<script>function "
|
// const char HTTP_SCRIPT[] PROGMEM = "<script>function "
|
||||||
"c(l){document.getElementById('s').value=l.innerText||l.textContent;document."
|
// "c(l){document.getElementById('s').value=l.innerText||l.textContent;document."
|
||||||
"getElementById('p').focus();}</script>";
|
// "getElementById('p').focus();}</script>";
|
||||||
const char HTTP_HEADER_END[] PROGMEM =
|
const char HTTP_HEADER_END[] PROGMEM =
|
||||||
"</head><body><div style='text-align:left;display:inline-block;color:" D_HTTP_COLOR_TEXT ";min-width:260px;'>";
|
"</head><body><div id='doc'>";
|
||||||
const char HTTP_END[] PROGMEM = "<div style='text-align:right;font-size:11px;'><hr/><a href='/about' "
|
const char HTTP_FOOTER[] PROGMEM = "<div style='text-align:right;font-size:11px;'><hr/><a href='/about'>" D_MANUFACTURER " ";
|
||||||
"style='color:" D_HTTP_COLOR_TEXT ";'>" D_MANUFACTURER " ";
|
const char HTTP_END[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
||||||
const char HTTP_FOOTER[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -147,12 +146,6 @@ const char HTTP_FOOTER[] PROGMEM = " " D_HTTP_FOOTER "</div></body></html>";
|
|||||||
// // Default link to compiled Nextion firmware images
|
// // Default link to compiled Nextion firmware images
|
||||||
// String lcdFirmwareUrl = "http://haswitchplate.com/update/HASwitchPlate.tft";
|
// String lcdFirmwareUrl = "http://haswitchplate.com/update/HASwitchPlate.tft";
|
||||||
|
|
||||||
// #if HASP_USE_MQTT > 0
|
|
||||||
// extern char mqttNodeName[16];
|
|
||||||
// #else
|
|
||||||
// char mqttNodeName[3] = "na";
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
String getOption(int value, String label, bool selected)
|
String getOption(int value, String label, bool selected)
|
||||||
{
|
{
|
||||||
@ -284,7 +277,7 @@ void webSendPage(AsyncWebServerRequest* request, const char* nodename, const cha
|
|||||||
uint32_t contentLength = strlen(haspDevice.get_version()); // version length
|
uint32_t contentLength = strlen(haspDevice.get_version()); // version length
|
||||||
contentLength += sizeof(HTTP_DOCTYPE) - 1;
|
contentLength += sizeof(HTTP_DOCTYPE) - 1;
|
||||||
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s
|
contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s
|
||||||
contentLength += sizeof(HTTP_SCRIPT) - 1;
|
// contentLength += sizeof(HTTP_SCRIPT) - 1;
|
||||||
contentLength += sizeof(HTTP_STYLE) - 1;
|
contentLength += sizeof(HTTP_STYLE) - 1;
|
||||||
// contentLength += sizeof(HASP_STYLE) - 1;
|
// contentLength += sizeof(HASP_STYLE) - 1;
|
||||||
if(gohome) contentLength += sizeof(HTTP_META_GO_BACK) - 1;
|
if(gohome) contentLength += sizeof(HTTP_META_GO_BACK) - 1;
|
||||||
@ -313,7 +306,7 @@ void webSendPage(AsyncWebServerRequest* request, const char* nodename, const cha
|
|||||||
if(gohome) // webSendFooter(reponse);(HTTP_META_GO_BACK); // 47
|
if(gohome) // webSendFooter(reponse);(HTTP_META_GO_BACK); // 47
|
||||||
// webSendFooter(reponse);(HTTP_HEADER_END); // 80
|
// webSendFooter(reponse);(HTTP_HEADER_END); // 80
|
||||||
#else
|
#else
|
||||||
response->printf_P(HTTP_SCRIPT); // 131
|
// response->printf_P(HTTP_SCRIPT); // 131
|
||||||
response->printf_P(HTTP_STYLE); // 487
|
response->printf_P(HTTP_STYLE); // 487
|
||||||
// //webSendFooter(reponse);_P(HASP_STYLE); // 145
|
// //webSendFooter(reponse);_P(HASP_STYLE); // 145
|
||||||
if(gohome) response->printf_P(HTTP_META_GO_BACK); // 47
|
if(gohome) response->printf_P(HTTP_META_GO_BACK); // 47
|
||||||
|
Loading…
x
Reference in New Issue
Block a user