From dcffec997bf9dcdd524a65b45330f8dbba5d12ca Mon Sep 17 00:00:00 2001 From: openshwprojects Date: Tue, 1 Feb 2022 16:05:18 +0100 Subject: [PATCH] add build date time so I can fast check if OTA works etc --- src/httpserver/new_http.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/httpserver/new_http.c b/src/httpserver/new_http.c index 2d15885b0..5ea0e7337 100644 --- a/src/httpserver/new_http.c +++ b/src/httpserver/new_http.c @@ -32,6 +32,7 @@ const char httpMimeTypeText[] = "text/plain\n\n" ; // TEXT MIME type const char htmlHeader[] = "" ; const char htmlEnd[] = "" ; const char htmlReturnToMenu[] = "Return to menu";; +const char *g_build_str = "Build on " __DATE__ " " __TIME__; #if WINDOWS #define os_free free @@ -241,6 +242,11 @@ int g_total_templates = sizeof(g_templates)/sizeof(g_templates[0]); const char *g_header = "

OpenBK7231

[Read more][Support project]

"; + +void HTTP_AddBuildFooter(char *outbuf, int outBufSize) { + strcat(outbuf,"
",outBufSize); + strcat(outbuf,g_build_str,outBufSize); +} int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { int i, j; char tmpA[128]; @@ -275,6 +281,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,g_header,outBufSize); strcat_safe(outbuf,"About us page.",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_mqtt")) { http_setup(outbuf, httpMimeTypeHTML); @@ -309,6 +316,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { \ ",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_mqtt_set")) { http_setup(outbuf, httpMimeTypeHTML); @@ -340,6 +348,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,"Return to MQTT settings",outBufSize); strcat_safe(outbuf,"
",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_wifi_set")) { http_setup(outbuf, httpMimeTypeHTML); @@ -366,6 +375,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,"Return to WiFi settings",outBufSize); strcat_safe(outbuf,"
",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_wifi")) { // for a test, show password as well... @@ -411,6 +421,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { \ ",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"flash_read_tool")) { int len = 16; @@ -473,6 +484,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { ",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_quick")) { @@ -499,6 +511,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,"",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); @@ -576,6 +589,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,"",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); @@ -593,6 +607,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"setWB2SInputs")) { http_setup(outbuf, httpMimeTypeHTML); @@ -603,6 +618,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { http_setup(outbuf, httpMimeTypeHTML); strcat_safe(outbuf,"Set all inputs for dbg .",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"setAllInputs")) { http_setup(outbuf, httpMimeTypeHTML); @@ -615,6 +631,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { http_setup(outbuf, httpMimeTypeHTML); strcat_safe(outbuf,"Set all inputs for dbg .",outBufSize); strcat_safe(outbuf,htmlReturnToMenu,outBufSize); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat_safe(outbuf,htmlEnd,outBufSize); } else if(http_checkUrlBase(urlStr,"cfg_pins")) { int iChanged = 0; @@ -691,6 +708,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat(outbuf,""); strcat(outbuf,htmlReturnToMenu); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat(outbuf,htmlEnd); } else if(http_checkUrlBase(urlStr,"index")) { int relayFlags; @@ -784,6 +802,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat(outbuf,htmlReturnToMenu); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat(outbuf,htmlEnd); } else if(http_checkUrlBase(urlStr,"ota")) { #if WINDOWS @@ -795,6 +814,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat(outbuf,htmlHeader); strcat(outbuf,"OTA Requested."); strcat(outbuf,htmlReturnToMenu); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat(outbuf,htmlEnd); } else { http_setup(outbuf, httpMimeTypeHTML); @@ -802,6 +822,7 @@ int HTTP_ProcessPacket(const char *recvbuf, char *outbuf, int outBufSize) { strcat_safe(outbuf,g_header,outBufSize); strcat(outbuf,"Not found."); strcat(outbuf,htmlReturnToMenu); + HTTP_AddBuildFooter(outbuf,outBufSize); strcat(outbuf,htmlEnd); }