put cangrow.css and favicon to sepereate webserver path and not incldue them in the html body
This commit is contained in:
parent
d679d896b2
commit
3517f6abf4
5 changed files with 62 additions and 14 deletions
|
@ -31,6 +31,7 @@
|
|||
* include static files files
|
||||
*/
|
||||
#include "Webserver/File_cangrow_CSS.h"
|
||||
#include "Webserver/File_favicon_ico.h"
|
||||
|
||||
/*
|
||||
* include webpages header files
|
||||
|
@ -85,6 +86,8 @@ void Webserver_Init() {
|
|||
/* url handler definition */
|
||||
webserver.on("/", HTTP_GET, WebPage_root);
|
||||
webserver.on("/cangrow.css", HTTP_GET, WebFile_cangrow_CSS);
|
||||
webserver.on("/favicon.ico", HTTP_GET, WebFile_favicon_ico);
|
||||
|
||||
webserver.on("/wifi/", HTTP_GET, WebPage_wifi);
|
||||
webserver.on("/wifi/", HTTP_POST, WebPage_wifi);
|
||||
webserver.on("/system/", HTTP_GET, WebPage_system);
|
||||
|
@ -99,8 +102,11 @@ void Webserver_Init() {
|
|||
webserver.on("/system/wipe", HTTP_GET, WebPage_system_wipe);
|
||||
webserver.on("/system/wipe", HTTP_POST, WebPage_system_wipe);
|
||||
|
||||
webserver.on("/system/output", HTTP_GET, WebPage_system_output);
|
||||
webserver.on("/system/output", HTTP_POST, WebPage_system_output);
|
||||
webserver.on("/system/output/", HTTP_GET, WebPage_system_output);
|
||||
webserver.on("/system/output/", HTTP_POST, WebPage_system_output);
|
||||
|
||||
webserver.on("/system/output/add", HTTP_GET, WebPage_system_output_add);
|
||||
webserver.on("/system/output/add", HTTP_POST, WebPage_system_output_add);
|
||||
|
||||
requestLogger.setOutput(Serial);
|
||||
// this activates the middleware
|
||||
|
|
|
@ -41,7 +41,7 @@ const char* File_cangrow_CSS PROGMEM = R"(body {
|
|||
}
|
||||
|
||||
.center {
|
||||
width: 100%%;
|
||||
/*width: 100; */
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ a:active {
|
|||
}
|
||||
.nav {
|
||||
background: #333;
|
||||
/*width: 100%%; */
|
||||
/*width: 100; */
|
||||
margin: auto;
|
||||
margin-bottom: 10px;
|
||||
padding: 0;
|
||||
|
@ -207,7 +207,7 @@ input[type=text], input[type=date], input[type=number], input[type=password], se
|
|||
|
||||
@media only screen and (min-width: 1820px) {
|
||||
/*.center, .nav {
|
||||
width: 60%%; min-width: 420px;
|
||||
width: 60; min-width: 420px;
|
||||
}*/
|
||||
.subnav li {
|
||||
display: '';
|
||||
|
|
|
@ -33,10 +33,7 @@ const char* Header_HTML PROGMEM = R"(<!DOCTYPE html>
|
|||
<meta charset='UTF-8'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
||||
<title>%GROWNAME% - CanGrow v%CGVER%</title>
|
||||
<link rel='icon' href='data:;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAAsTAAALEwEAmpwYAAABcElEQVQ4y42TzU/bQBDFf7Nx1qGuAYVgQSuo2khBggPhyIH//9AiJAQ9tEeLqCKiUD6sxF52OMSEBCdW57aa9968fTsr3V5XWVLPO6sANNL7ZRAMNeU6Ea4T1UEI6pr55kcAwhpMrYOpk2/r/yEQmKWkIonf+TZVgex4Fw0bIEtIAALF3gbZ8U5VwKa3PJ18JT9IpiLvyflBwuhLG5veVUM0/0aoCONPa2hQjWZ8uEVeupJnXSBwO8YOH8iTeAKc2Q4Xt2C1VZL93F7MjbK/bxDnp5Zn7b+So+9pdQ+K/Q5qJlrRj5Ts6DM+rK7Ih7Mr3HaM7jYQVZqXQ6Tb6yqBYdTfomhHiFfUyMI3f+01/z7RHNzTGDyWGThP63SA2d8EEfIkrgQpzmOvH0AV+3M4zegNpUwagAYG8Yp4BS0nl4Kz5Mpf0JXJMby6w/66Aa+M+9uE53/Iexsggq4ESOYWC0jmsBfX8xdXhcJjL4cLc3kBl8uJGQ/CrpAAAAAASUVORK5CYII='>
|
||||
<style>
|
||||
%CANGROW_CSS%
|
||||
</style>
|
||||
<link rel='stylesheet' href='/cangrow.css'>
|
||||
</head>
|
||||
<body>
|
||||
<ul class='nav'><li><a href='/'>🌱 %GROWNAME%</a></li>
|
||||
|
|
|
@ -292,6 +292,10 @@ void WebPage_system_wipe(AsyncWebServerRequest *request) {
|
|||
* Subpage output
|
||||
*/
|
||||
String Proc_WebPage_system_output(const String& var) {
|
||||
#ifndef DEBUG
|
||||
Serial.print("DB [Webserver:system:output(Proc)] var: ");
|
||||
Serial.println(var);
|
||||
#endif
|
||||
if(TestHeaderFooter(var)) {
|
||||
return AddHeaderFooter(var, 2);
|
||||
} else if(Test_WebPage_system_SUBNAV(var)) {
|
||||
|
@ -321,3 +325,39 @@ void WebPage_system_output(AsyncWebServerRequest *request) {
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* Subpage output add
|
||||
*/
|
||||
String Proc_WebPage_system_output_add(const String& var) {
|
||||
#ifndef DEBUG
|
||||
Serial.print("DB [Webserver:system:output:add(Proc)] var: ");
|
||||
Serial.println(var);
|
||||
#endif
|
||||
if(TestHeaderFooter(var)) {
|
||||
return AddHeaderFooter(var, 2);
|
||||
} else if(Test_WebPage_system_SUBNAV(var)) {
|
||||
return Proc_WebPage_system_SUBNAV(var, 1);
|
||||
} else{
|
||||
return String();
|
||||
}
|
||||
}
|
||||
|
||||
String Proc_WebPage_system_output_add_POST(const String& var) {
|
||||
if(var == "SAVE_MSG") {
|
||||
return String(Common_HTML_SAVE_MSG);
|
||||
} else {
|
||||
return Proc_WebPage_system_output_add(var);
|
||||
}
|
||||
}
|
||||
|
||||
void WebPage_system_output_add(AsyncWebServerRequest *request) {
|
||||
if(request->method() == HTTP_POST) {
|
||||
request->send_P(200, "text/html", Page_system_output_add_HTML, Proc_WebPage_system_output_add_POST);
|
||||
Serial.println(":: [Webserver:system:output:add] [POST] hello");
|
||||
|
||||
|
||||
} else {
|
||||
request->send_P(200, "text/html", Page_system_output_add_HTML, Proc_WebPage_system_output_add);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ const char* Page_system_HTML PROGMEM = R"(%HEADER%
|
|||
%FOOTER%)";
|
||||
|
||||
const char* Page_system_HTML_SUBNAV PROGMEM = R"(<ul class='subnav'>
|
||||
<li><a class='%ACTIVE_SUBNAV_OUTPUT%' href='/system/output'>⚡ Output configuration</a></li>
|
||||
<li><a class='%ACTIVE_SUBNAV_OUTPUT%' href='/system/output/'>⚡ Output configuration</a></li>
|
||||
<li><a class='%ACTIVE_SUBNAV_UPDATE%' href='/system/update'>🔄 Firmware update</a></li>
|
||||
<li><a class='%ACTIVE_SUBNAV_RESTART%' href='/system/restart' >🔁 CanGrow restart</a></li>
|
||||
<li><a class='%ACTIVE_SUBNAV_WIPE%' href='/system/wipe' >💣 Factory reset</a></li>
|
||||
|
@ -115,8 +115,6 @@ const char* Page_system_restart_HTML_RESTART_MSG_POST PROGMEM = R"(Restarting...
|
|||
* Subpage wipe
|
||||
*/
|
||||
const char* Page_system_wipe_HTML PROGMEM = R"(%HEADER%
|
||||
|
||||
|
||||
%SUBNAV%
|
||||
<div class='warnmsg'>
|
||||
%WIPE_MSG%
|
||||
|
@ -138,7 +136,14 @@ const char* Page_system_wipe_HTML_WIPE_MSG_POST PROGMEM = R"(Restarting...)";
|
|||
* Subpage output
|
||||
*/
|
||||
const char* Page_system_output_HTML PROGMEM = R"(%HEADER%
|
||||
|
||||
%SUBNAV%
|
||||
|
||||
<a class='button' href='/system/output/add'>➕ Add output</a>
|
||||
%FOOTER%)";
|
||||
|
||||
/*
|
||||
* Subpage output add
|
||||
*/
|
||||
const char* Page_system_output_add_HTML PROGMEM = R"(%HEADER%
|
||||
%SUBNAV%
|
||||
<h3>➕ Add output</h3>
|
||||
%FOOTER%)";
|
||||
|
|
Loading…
Reference in a new issue