mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-08 06:15:28 +00:00
Revert "Status information auto-updates, tweaked HTML"
This commit is contained in:
@ -105,7 +105,6 @@ int http_fn_testmsg(http_request_t *request) {
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int http_fn_index(http_request_t *request) {
|
||||
int j, i;
|
||||
char tmpA[128];
|
||||
@ -115,13 +114,10 @@ int http_fn_index(http_request_t *request) {
|
||||
bRawPWMs = CFG_HasFlag(OBK_FLAG_LED_RAWCHANNELSMODE);
|
||||
forceShowRGBCW = CFG_HasFlag(OBK_FLAG_LED_FORCESHOWRGBCWCONTROLLER);
|
||||
|
||||
// use ?state URL parameter to only request current state
|
||||
if(!http_getArg(request->url, "state", tmpA, sizeof(tmpA))) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, NULL);
|
||||
poststr(request, "<div id=\"statediv\">"); // replaceable content follows
|
||||
}
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
poststr(request,htmlHeader);
|
||||
//poststr(request,"<style>.r { background-color: red; } .g { background-color: green; }</style>");
|
||||
HTTP_AddHeader(request);
|
||||
if(http_getArg(request->url,"tgl",tmpA,sizeof(tmpA))) {
|
||||
j = atoi(tmpA);
|
||||
if(j == SPECIAL_CHANNEL_LEDPOWER) {
|
||||
@ -459,6 +455,16 @@ int http_fn_index(http_request_t *request) {
|
||||
RESET_ScheduleModuleReset(3);
|
||||
}
|
||||
|
||||
poststr(request,"<form action=\"cfg\"><input type=\"submit\" value=\"Config\"/></form>");
|
||||
|
||||
poststr(request,"<form action=\"/index\">\
|
||||
<input type=\"hidden\" id=\"restart\" name=\"restart\" value=\"1\">\
|
||||
<input class=\"bred\" type=\"submit\" value=\"Restart\" onclick=\"return confirm('Are you sure to restart module?')\">\
|
||||
</form> ");
|
||||
|
||||
poststr(request,"<form action=\"/app\" target=\"_blank\"><input type=\"submit\" value=\"Launch Web Application\"\"></form> ");
|
||||
poststr(request,"<form action=\"about\"><input type=\"submit\" value=\"About\"/></form>");
|
||||
|
||||
if(1) {
|
||||
int bFirst = true;
|
||||
hprintf128(request,"<h5>");
|
||||
@ -480,51 +486,10 @@ int http_fn_index(http_request_t *request) {
|
||||
hprintf128(request,"<h5>Ping watchdog - %i lost, %i ok!</h5>",
|
||||
PingWatchDog_GetTotalLost(),PingWatchDog_GetTotalReceived());
|
||||
|
||||
// for normal page loads, show the rest of the HTML
|
||||
if(!http_getArg(request->url,"state",tmpA,sizeof(tmpA))) {
|
||||
poststr(request, "</div>"); // end id=statediv
|
||||
|
||||
// Shared UI elements
|
||||
poststr(request, "<form action=\"cfg\"><input type=\"submit\" value=\"Config\"/></form>");
|
||||
|
||||
poststr(request, "<form action=\"/index\">"
|
||||
"<input type=\"hidden\" id=\"restart\" name=\"restart\" value=\"1\">"
|
||||
"<input class=\"bred\" type=\"submit\" value=\"Restart\" onclick=\"return confirm('Are you sure to restart module?')\">"
|
||||
"</form>");
|
||||
|
||||
poststr(request, "<form action=\"/app\" target=\"_blank\"><input type=\"submit\" value=\"Launch Web Application\"\"></form> ");
|
||||
poststr(request, "<form action=\"about\"><input type=\"submit\" value=\"About\"/></form>");
|
||||
|
||||
poststr(request, htmlFooterRefreshLink);
|
||||
http_html_end(request);
|
||||
|
||||
// refresh status section every 3 seconds
|
||||
poststr(
|
||||
request,
|
||||
"<script type='text/javascript'>"
|
||||
"var firstTime, lastTime, req=null;"
|
||||
"eb=s=>document.getElementById(s);"
|
||||
"function showState() { "
|
||||
"clearTimeout(firstTime);"
|
||||
"clearTimeout(lastTime);"
|
||||
"if (req!=null) { req.abort() }"
|
||||
"req=new XMLHttpRequest();"
|
||||
"req.onreadystatechange=()=>{"
|
||||
"if(req.readyState==4 && req.status==200){"
|
||||
"var s=req.responseText;"
|
||||
"eb('statediv').innerHTML=s;"
|
||||
"clearTimeout(firstTime);"
|
||||
"clearTimeout(lastTime);"
|
||||
"lastTime=setTimeout(showState, 3000);"
|
||||
"}};"
|
||||
"req.open('GET','index?state=1', true);"
|
||||
"req.send();"
|
||||
"firstTime=setTimeout(showState, 3000);"
|
||||
"}"
|
||||
"window.addEventListener('load', showState);"
|
||||
"</script>"
|
||||
);
|
||||
}
|
||||
poststr(request,htmlRefresh);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
@ -532,10 +497,12 @@ int http_fn_index(http_request_t *request) {
|
||||
|
||||
int http_fn_about(http_request_t *request){
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "About");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h2>Open source firmware for BK7231N, BK7231T, XR809 and BL602 by OpenSHWProjects</h2>");
|
||||
poststr(request,htmlFooterReturnToMenu);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -546,7 +513,8 @@ int http_fn_about(http_request_t *request){
|
||||
int http_fn_cfg_mqtt(http_request_t *request) {
|
||||
int i;
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "MQTT");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h2> Use this to connect to your MQTT</h2>");
|
||||
poststr(request,"<form action=\"/cfg_mqtt_set\">\
|
||||
<label for=\"host\">Host:</label><br>\
|
||||
@ -574,8 +542,9 @@ int http_fn_cfg_mqtt(http_request_t *request) {
|
||||
poststr(request,"\"><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure? Please check MQTT data twice?')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -583,7 +552,8 @@ int http_fn_cfg_mqtt(http_request_t *request) {
|
||||
int http_fn_cfg_mqtt_set(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Saving MQTT");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
if(http_getArg(request->url,"host",tmpA,sizeof(tmpA))) {
|
||||
CFG_SetMQTTHost(tmpA);
|
||||
@ -608,15 +578,21 @@ int http_fn_cfg_mqtt_set(http_request_t *request) {
|
||||
poststr(request,"<br>");
|
||||
poststr(request,"<a href=\"cfg_mqtt\">Return to MQTT settings</a>");
|
||||
poststr(request,"<br>");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int http_fn_cfg_webapp(http_request_t *request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set Webapp");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h2> Use this to set the URL of the Webapp</h2>");
|
||||
poststr(request,"<form action=\"/cfg_webapp_set\">\
|
||||
<label for=\"url\">Url:</label><br>\
|
||||
@ -625,8 +601,9 @@ int http_fn_cfg_webapp(http_request_t *request) {
|
||||
poststr(request,"\"><br>\
|
||||
<input type=\"submit\" value=\"Submit\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -634,7 +611,8 @@ int http_fn_cfg_webapp(http_request_t *request) {
|
||||
int http_fn_cfg_webapp_set(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Saving Webapp");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
if(http_getArg(request->url,"url",tmpA,sizeof(tmpA))) {
|
||||
if(CFG_SetWebappRoot(tmpA)) {
|
||||
@ -647,8 +625,9 @@ int http_fn_cfg_webapp_set(http_request_t *request) {
|
||||
}
|
||||
|
||||
poststr(request,"<br>");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -664,7 +643,8 @@ int http_fn_cfg_ping(http_request_t *request) {
|
||||
int bChanged;
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set Watchdog");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
bChanged = 0;
|
||||
poststr(request,"<h3> Ping watchdog (backup reconnect mechanism)</h3>");
|
||||
poststr(request,"<p> By default, all OpenBeken devices automatically tries to reconnect to WiFi when a connection is lost.");
|
||||
@ -724,8 +704,10 @@ int http_fn_cfg_ping(http_request_t *request) {
|
||||
poststr(request,"\"><br><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure?')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -735,7 +717,8 @@ int http_fn_cfg_wifi(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set Wifi");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
/*bChanged = 0;
|
||||
if(http_getArg(recvbuf,"ssid",tmpA,sizeof(tmpA))) {
|
||||
CFG_SetWiFiSSID(tmpA);
|
||||
@ -818,8 +801,10 @@ int http_fn_cfg_wifi(http_request_t *request) {
|
||||
poststr(request,"\"><br><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure? Please check SSID and pass twice?')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -830,7 +815,8 @@ int http_fn_cfg_name(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set name");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
poststr(request,"<h2> Change device names for display. </h2> Remember that short name is used by MQTT.<br>");
|
||||
if(http_getArg(request->url,"shortName",tmpA,sizeof(tmpA))) {
|
||||
@ -855,18 +841,20 @@ int http_fn_cfg_name(http_request_t *request) {
|
||||
poststr(request,"\"><br><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure? Short name might be used by MQTT, so you will have to reconfig some stuff.')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_fn_cfg_wifi_set(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
addLogAdv(LOG_INFO, LOG_FEATURE_HTTP,"HTTP_ProcessPacket: generating cfg_wifi_set \r\n");
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Saving Wifi");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
if(http_getArg(request->url,"open",tmpA,sizeof(tmpA))) {
|
||||
CFG_SetWiFiSSID("");
|
||||
CFG_SetWiFiPass("");
|
||||
@ -888,18 +876,24 @@ int http_fn_cfg_wifi_set(http_request_t *request) {
|
||||
poststr(request,"<br>");
|
||||
poststr(request,"<a href=\"cfg_wifi\">Return to WiFi settings</a>");
|
||||
poststr(request,"<br>");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int http_fn_cfg_loglevel_set(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
addLogAdv(LOG_INFO, LOG_FEATURE_HTTP,"HTTP_ProcessPacket: generating cfg_loglevel_set \r\n");
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set log level");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
if(http_getArg(request->url,"loglevel",tmpA,sizeof(tmpA))) {
|
||||
#if WINDOWS
|
||||
#else
|
||||
@ -922,8 +916,9 @@ int http_fn_cfg_loglevel_set(http_request_t *request) {
|
||||
poststr(request,"<br>");
|
||||
poststr(request,"<a href=\"cfg\">Return to config settings</a>");
|
||||
poststr(request,"<br>");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -936,7 +931,8 @@ int http_fn_cfg_mac(http_request_t *request) {
|
||||
int i;
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set MAC address");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
if(http_getArg(request->url,"mac",tmpA,sizeof(tmpA))) {
|
||||
for( i = 0; i < 6; i++ )
|
||||
@ -954,6 +950,7 @@ int http_fn_cfg_mac(http_request_t *request) {
|
||||
|
||||
WiFI_GetMacAddress((char *)mac);
|
||||
|
||||
|
||||
poststr(request,"<h2> Here you can change MAC address.</h2>");
|
||||
poststr(request,"<form action=\"/cfg_mac\">\
|
||||
<label for=\"mac\">MAC:</label><br>\
|
||||
@ -962,8 +959,10 @@ int http_fn_cfg_mac(http_request_t *request) {
|
||||
poststr(request,"\"><br><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure? Please check MAC hex string twice?')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -981,7 +980,8 @@ int http_fn_flash_read_tool(http_request_t *request) {
|
||||
char tmpB[64];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Flash read");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>Flash Read Tool</h4>");
|
||||
if( http_getArg(request->url,"hex",tmpA,sizeof(tmpA))){
|
||||
hex = atoi(tmpA);
|
||||
@ -1055,8 +1055,11 @@ int http_fn_flash_read_tool(http_request_t *request) {
|
||||
<input type=\"submit\" value=\"Submit\">\
|
||||
</form> ");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1072,7 +1075,8 @@ int http_fn_cmd_tool(http_request_t *request) {
|
||||
//char tmpB[64];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Command tool");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>Command Tool</h4>");
|
||||
|
||||
if( http_getArg(request->url,"cmd",tmpA,sizeof(tmpA))) {
|
||||
@ -1093,8 +1097,11 @@ int http_fn_cmd_tool(http_request_t *request) {
|
||||
<input type=\"submit\" value=\"Submit\">\
|
||||
</form> ");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1103,7 +1110,8 @@ int http_fn_startup_command(http_request_t *request) {
|
||||
char tmpA[512];
|
||||
const char *cmd;
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Set startup command");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>Set/Change/Clear startup command line</h4>");
|
||||
poststr(request,"<h5>Startup command is a shorter, smaller alternative to LittleFS autoexec.bat."
|
||||
"The startup commands are ran at device startup."
|
||||
@ -1132,8 +1140,11 @@ int http_fn_startup_command(http_request_t *request) {
|
||||
<input type=\"submit\" value=\"Submit\">\
|
||||
</form> ");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1141,9 +1152,12 @@ int http_fn_uart_tool(http_request_t *request) {
|
||||
char tmpA[256];
|
||||
int resultLen = 0;
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "UART tool");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>UART Tool</h4>");
|
||||
|
||||
|
||||
|
||||
if(http_getArg(request->url,"data",tmpA,sizeof(tmpA))) {
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
byte results[128];
|
||||
@ -1179,19 +1193,25 @@ int http_fn_uart_tool(http_request_t *request) {
|
||||
<input type=\"submit\" value=\"Submit\">\
|
||||
</form> ");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_fn_config_dump_table(http_request_t *request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Dump config");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
poststr(request,"Not implemented <br>");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1203,7 +1223,8 @@ int http_fn_cfg_quick(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
int j;
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Quick Config");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>Quick Config</h4>");
|
||||
|
||||
if(http_getArg(request->url,"dev",tmpA,sizeof(tmpA))) {
|
||||
@ -1219,8 +1240,10 @@ int http_fn_cfg_quick(http_request_t *request) {
|
||||
poststr(request,"</select>");
|
||||
poststr(request,"<input type=\"submit\" value=\"Set\"/></form>");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1250,7 +1273,8 @@ int http_fn_cfg_ha(http_request_t *request) {
|
||||
baseName = CFG_GetShortDeviceName();
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Home Assistant Setup");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h4>Home Assistant Cfg</h4>");
|
||||
hprintf128(request,"<h4>Note that your short device name is: %s</h4>",baseName);
|
||||
poststr(request,"<h4>Paste this to configuration yaml</h4>");
|
||||
@ -1333,8 +1357,10 @@ int http_fn_cfg_ha(http_request_t *request) {
|
||||
|
||||
poststr(request,"</textarea>");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1472,7 +1498,8 @@ int http_fn_cm(http_request_t *request) {
|
||||
|
||||
int http_fn_cfg(http_request_t *request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Config");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<form action=\"cfg_pins\"><input type=\"submit\" value=\"Configure Module\"/></form>");
|
||||
poststr(request,"<form action=\"cfg_generic\"><input type=\"submit\" value=\"Configure General\"/></form>");
|
||||
poststr(request,"<form action=\"cfg_startup\"><input type=\"submit\" value=\"Configure Startup\"/></form>");
|
||||
@ -1504,8 +1531,9 @@ int http_fn_cfg(http_request_t *request) {
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
poststr(request,htmlFooterReturnToMenu);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1518,7 +1546,8 @@ int http_fn_cfg_pins(http_request_t *request) {
|
||||
char tmpB[64];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Pin config");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"<h5> First textfield is used to enter channel index (relay index), used to support multiple relays and buttons</h5>");
|
||||
poststr(request,"<h5> (so, first button and first relay should have channel 1, second button and second relay have channel 2, etc)</h5>");
|
||||
poststr(request,"<h5> Second textfield (only for buttons) is used to enter channel to toggle when doing double click</h5>");
|
||||
@ -1629,8 +1658,10 @@ int http_fn_cfg_pins(http_request_t *request) {
|
||||
}
|
||||
poststr(request,"<input type=\"submit\" value=\"Save\"/></form>");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1658,7 +1689,8 @@ int http_fn_cfg_generic(http_request_t *request) {
|
||||
char tmpB[64];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Generic config");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
if( http_getArg(request->url,"boot_ok_delay",tmpA,sizeof(tmpA))) {
|
||||
i = atoi(tmpA);
|
||||
@ -1714,8 +1746,10 @@ int http_fn_cfg_generic(http_request_t *request) {
|
||||
poststr(request,"\"><br>");
|
||||
poststr(request,"<input type=\"submit\" value=\"Save\"/></form>");
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1726,7 +1760,9 @@ int http_fn_cfg_startup(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Config startup");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
hprintf128(request,"<h5>Here you can set pin start values<h5>");
|
||||
hprintf128(request,"<h5>For relays, simply use 1 or 0</h5>");
|
||||
hprintf128(request,"<h5>For 'remember last power state', use -1 as a special value</h5>");
|
||||
@ -1770,8 +1806,10 @@ int http_fn_cfg_startup(http_request_t *request) {
|
||||
}
|
||||
}
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1780,7 +1818,8 @@ int http_fn_cfg_dgr(http_request_t *request) {
|
||||
char tmpA[128];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Device groups");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
|
||||
hprintf128(request,"<h5>Here you can configure Tasmota Device Groups<h5>");
|
||||
|
||||
@ -1859,8 +1898,10 @@ int http_fn_cfg_dgr(http_request_t *request) {
|
||||
poststr(request," </tr></table> <input type=\"submit\" value=\"Submit\"></form>");
|
||||
}
|
||||
|
||||
poststr(request,htmlFooterReturnToCfgLink);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToCfg);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -1872,7 +1913,7 @@ int http_fn_ota_exec(http_request_t *request) {
|
||||
//char tmpB[64];
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "OTA request");
|
||||
poststr(request,htmlHeader);
|
||||
if(http_getArg(request->url,"host",tmpA,sizeof(tmpA))) {
|
||||
hprintf128(request,"<h3>OTA requested for %s!</h3>",tmpA);
|
||||
addLogAdv(LOG_INFO, LOG_FEATURE_HTTP,"http_fn_ota_exec: will try to do OTA for %s \r\n",tmpA);
|
||||
@ -1888,15 +1929,17 @@ int http_fn_ota_exec(http_request_t *request) {
|
||||
otarequest(tmpA);
|
||||
#endif
|
||||
}
|
||||
poststr(request,htmlFooterReturnToMenu);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_fn_ota(http_request_t *request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "OTA system");
|
||||
poststr(request,htmlHeader);
|
||||
poststr(request,"<p>Simple OTA system (you should rather use the OTA from App panel where you can drag and drop file easily without setting up server). Use RBL file for OTA. In the OTA below, you should paste link to RBL file (you need HTTP server).</p>");
|
||||
poststr(request,"<form action=\"/ota_exec\">\
|
||||
<label for=\"host\">URL for new bin file:</label><br>\
|
||||
@ -1904,18 +1947,22 @@ int http_fn_ota(http_request_t *request) {
|
||||
poststr(request,"\"><br>\
|
||||
<input type=\"submit\" value=\"Submit\" onclick=\"return confirm('Are you sure?')\">\
|
||||
</form> ");
|
||||
poststr(request,htmlFooterReturnToMenu);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int http_fn_other(http_request_t *request) {
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "Not found");
|
||||
poststr(request,htmlHeader);
|
||||
HTTP_AddHeader(request);
|
||||
poststr(request,"Not found.<br/>");
|
||||
poststr(request,htmlFooterReturnToMenu);
|
||||
http_html_end(request);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
HTTP_AddBuildFooter(request);
|
||||
poststr(request,htmlEnd);
|
||||
poststr(request, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -19,70 +19,12 @@ const char httpMimeTypeHTML[] = "text/html" ; // HTML MIME type
|
||||
const char httpMimeTypeText[] = "text/plain" ; // TEXT MIME type
|
||||
const char httpMimeTypeJson[] = "application/json" ; // TEXT MIME type
|
||||
const char httpMimeTypeBinary[] = "application/octet-stream" ; // binary/file MIME type
|
||||
const char htmlDoctype[] =
|
||||
"<!DOCTYPE html><html>";
|
||||
const char htmlHeadMain[] =
|
||||
"<meta charset=\"utf-8\">"
|
||||
"<meta name=\"viewport\" content=\"width=device-width,initial-scale=1,user-scalable=no\">"
|
||||
"<meta name=\"robots\" content=\"none\">";
|
||||
const char htmlHeadStyle[] =
|
||||
"<style>"
|
||||
"div,fieldset,input,select{padding:5px;font-size:"
|
||||
"1em;margin: 0 0 0.2em 0}"
|
||||
"fieldset{background:#4f4f4f;}"
|
||||
"p{margin:0.5em 0;}"
|
||||
"input{width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-"
|
||||
"moz-box-sizing:border-box;background:#dddddd;color:#000000;}"
|
||||
"form{margin-bottom:0.5em}"
|
||||
"input[type=checkbox],input[type=radio]{width:1em;margin-"
|
||||
"right:6px;vertical-align:-1px;}"
|
||||
"input[type=range]{width:99%;}"
|
||||
"select{width:100%;background:#dddddd;color:#000000;}"
|
||||
"textarea{resize:vertical;width:98%;height:318px;padding:5px;"
|
||||
"overflow:auto;background:#1f1f1f;color:#65c115;}"
|
||||
"body{text-align:center;font-family:verdana,sans-serif;background:#21333e; "
|
||||
"color:#eaeaea}"
|
||||
"h1 a{background:#21333e; color:#eaeaea}"
|
||||
"td{padding:0px;}"
|
||||
"input[type=submit]{border:0;border-radius:0.3rem;background:#1fa3ec;"
|
||||
"color:#faffff;line-height:2.4rem;font-size:1.2rem;"
|
||||
"width:100%;-webkit-transition-duration:0.4s;transition-duration:0.4s;"
|
||||
"cursor:pointer;margin-buttom:0.5em}"
|
||||
"input[type=submit]:hover{background:#0e70a4;}"
|
||||
".bred{background:#d43535 !important;}"
|
||||
".bred:hover{background:#931f1f !important;}"
|
||||
".bgrn{background:#47c266 !important;}"
|
||||
".bgrn:hover{background:#5aaf6f !important;}"
|
||||
"a{color:#1fa3ec;text-decoration:none;}"
|
||||
".p{float:left;text-align:left;}"
|
||||
".q{float:right;text-align:right;}"
|
||||
".r{border-radius:0.3em;padding:2px;margin:6px 2px;}"
|
||||
".hf{display:none;}"
|
||||
".hdiv{width:95%;white-space:nowrap;}"
|
||||
".hele{width:210px;display:inline-block;margin-left:2px;}"
|
||||
"div#statediv{padding:0}"
|
||||
"div#main{text-align:left; display:inline-block; color:#eaeaea;min-width:340px;max-width:800px;}"
|
||||
"</style>";
|
||||
const char htmlBodyStart[] =
|
||||
"<body>"
|
||||
"<noscript>To use this device, please enable JavaScript.<br></noscript>"
|
||||
"<div id=\"main\">"
|
||||
"<h1>"
|
||||
"<a target=\"_blank\" href=\"https://github.com/openshwprojects/OpenBK7231T_App/\">";
|
||||
const char htmlBodyStart2[] =
|
||||
"</a></h1>";
|
||||
const char htmlBodyEnd[] = "</div></body></html>" ;
|
||||
|
||||
const char htmlFooterReturnToMenu[] = "<a href=\"index\">Return to menu</a>";
|
||||
const char htmlFooterRefreshLink[] = "<a href=\"index\">Refresh</a>";
|
||||
const char htmlFooterReturnToCfgLink[] = "<a href=\"cfg\">Return to cfg</a>";
|
||||
|
||||
const char htmlFooterInfo[] =
|
||||
"<a target=\"_blank\" "
|
||||
"href=\"https://www.elektroda.com/rtvforum/"
|
||||
"viewtopic.php?p=19841301#19841301\">Read more</a> | "
|
||||
"<a target=\"_blank\" "
|
||||
"href=\"https://paypal.me/openshwprojects\">Support project</a><br>";
|
||||
const char htmlHeader[] = "<!DOCTYPE html><html><head><style>div,fieldset,input,select{padding:5px;font-size:1em;margin: 0 0 0.2em 0}fieldset{background:#4f4f4f;}p{margin:0.5em 0;}input{width:100%;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;background:#dddddd;color:#000000;}form{margin-bottom:0.5em}input[type=checkbox],input[type=radio]{width:1em;margin-right:6px;vertical-align:-1px;}input[type=range]{width:99%;}select{width:100%;background:#dddddd;color:#000000;}textarea{resize:vertical;width:98%;height:318px;padding:5px;overflow:auto;background:#1f1f1f;color:#65c115;}body{text-align:center;font-family:verdana,sans-serif;background:#21333e; color:#eaeaea}h1 a{background:#21333e; color:#eaeaea}td{padding:0px;}input[type=submit]{border:0;border-radius:0.3rem;background:#1fa3ec;color:#faffff;line-height:2.4rem;font-size:1.2rem;width:100%;-webkit-transition-duration:0.4s;transition-duration:0.4s;cursor:pointer;margin-buttom:0.5em}input[type=submit]:hover{background:#0e70a4;}.bred{background:#d43535 !important;}.bred:hover{background:#931f1f !important;}.bgrn{background:#47c266 !important;}.bgrn:hover{background:#5aaf6f !important;}a{color:#1fa3ec;text-decoration:none;}.p{float:left;text-align:left;}.q{float:right;text-align:right;}.r{border-radius:0.3em;padding:2px;margin:6px 2px;}.hf{display:none;}.hdiv{width:95%;white-space:nowrap;}.hele{width:210px;display:inline-block;margin-left:2px;}</style></head><body><div style=\"text-align:left; display:inline-block; color:#eaeaea; min-width:340px;max-width:800px;\">" ;
|
||||
//const char htmlHeader[] = "<!DOCTYPE html><html><body>" ;
|
||||
const char htmlEnd[] = "</div></body></html>" ;
|
||||
const char htmlReturnToMenu[] = "<a href=\"index\">Return to menu</a>";
|
||||
const char htmlRefresh[] = "<a href=\"index\">Refresh</a>";
|
||||
const char htmlReturnToCfg[] = "<a href=\"cfg\">Return to cfg</a>";
|
||||
|
||||
// make sure that USER_SW_VER is set on all platforms
|
||||
#ifndef USER_SW_VER
|
||||
@ -200,46 +142,6 @@ void http_setup(http_request_t *request, const char *type){
|
||||
poststr(request,"\r\n");
|
||||
}
|
||||
|
||||
void http_html_start(http_request_t *request, const char *pagename) {
|
||||
// void HTTP_AddHeader(http_request_t *request) {
|
||||
poststr(request, htmlDoctype);
|
||||
poststr(request, "<title>");
|
||||
poststr(request, CFG_GetDeviceName()); // todo: check escaping
|
||||
if (pagename) {
|
||||
poststr(request, " - ");
|
||||
poststr(request, pagename);
|
||||
}
|
||||
poststr(request, "</title>");
|
||||
poststr(request, htmlHeadMain);
|
||||
poststr(request, htmlHeadStyle);
|
||||
poststr(request, htmlBodyStart);
|
||||
poststr(request, CFG_GetDeviceName()); // todo: check escaping
|
||||
poststr(request, htmlBodyStart2);
|
||||
}
|
||||
|
||||
void http_html_end(http_request_t *request) {
|
||||
// was void HTTP_AddBuildFooter(http_request_t *request) {
|
||||
char upTimeStr[128];
|
||||
unsigned char mac[32];
|
||||
|
||||
poststr(request, " | ");
|
||||
poststr(request, htmlFooterInfo);
|
||||
poststr(request, "<br>");
|
||||
poststr(request, g_build_str);
|
||||
poststr(request, "<br>Online for ");
|
||||
misc_formatUpTimeString(Time_getUpTimeSeconds(), upTimeStr);
|
||||
poststr(request, upTimeStr);
|
||||
|
||||
WiFI_GetMacAddress((char *)mac);
|
||||
|
||||
sprintf(upTimeStr, "<br>Device MAC: %02X:%02X:%02X:%02X:%02X:%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
|
||||
poststr(request, upTimeStr);
|
||||
sprintf(upTimeStr, "<br>Short name: %s, Chipset %s",CFG_GetShortDeviceName(),PLATFORM_MCU_NAME);
|
||||
poststr(request, upTimeStr);
|
||||
|
||||
poststr(request, htmlBodyEnd);
|
||||
}
|
||||
|
||||
const char *http_checkArg(const char *p, const char *n) {
|
||||
while(1) {
|
||||
if(*n == 0 && (*p == 0 || *p == '='))
|
||||
@ -393,6 +295,37 @@ void setupAllWB2SPinsAsButtons() {
|
||||
PIN_SetPinChannelForPinIndex(27,1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char *g_header_start = "<h1><a href=\"https://github.com/openshwprojects/OpenBK7231T_App/\">";
|
||||
const char *g_header_end = "</a></h1><h3><a href=\"https://www.elektroda.com/rtvforum/viewtopic.php?p=19841301#19841301\">[Read more]</a><a href=\"https://paypal.me/openshwprojects\">[Support project]</a></h3>";
|
||||
|
||||
|
||||
void HTTP_AddHeader(http_request_t *request) {
|
||||
poststr(request,g_header_start);
|
||||
poststr(request,CFG_GetDeviceName());
|
||||
poststr(request,g_header_end);
|
||||
}
|
||||
|
||||
void HTTP_AddBuildFooter(http_request_t *request) {
|
||||
char upTimeStr[128];
|
||||
unsigned char mac[32];
|
||||
|
||||
poststr(request,"<br>");
|
||||
poststr(request,g_build_str);
|
||||
poststr(request,"<br> Online for ");
|
||||
misc_formatUpTimeString(Time_getUpTimeSeconds(), upTimeStr);
|
||||
poststr(request,upTimeStr);
|
||||
|
||||
WiFI_GetMacAddress((char *)mac);
|
||||
|
||||
sprintf(upTimeStr,"<br> Device MAC: %02X%02X%02X%02X%02X%02X",mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
|
||||
poststr(request,upTimeStr);
|
||||
sprintf(upTimeStr,"<br> Short name: %s, Chipset %s",CFG_GetShortDeviceName(),PLATFORM_MCU_NAME);
|
||||
poststr(request,upTimeStr);
|
||||
}
|
||||
|
||||
// add some more output safely, sending if necessary.
|
||||
// call with str == NULL to force send. - can be binary.
|
||||
// supply length
|
||||
|
||||
@ -7,10 +7,11 @@ extern const char httpMimeTypeHTML[]; // HTML MIME type
|
||||
extern const char httpMimeTypeText[]; // TEXT MIME type
|
||||
extern const char httpMimeTypeJson[];
|
||||
extern const char httpMimeTypeBinary[];
|
||||
|
||||
extern const char htmlFooterReturnToMenu[];
|
||||
extern const char htmlFooterRefreshLink[];
|
||||
extern const char htmlFooterReturnToCfgLink[];
|
||||
extern const char htmlHeader[];
|
||||
extern const char htmlEnd[];
|
||||
extern const char htmlReturnToMenu[];
|
||||
extern const char htmlRefresh[];
|
||||
extern const char htmlReturnToCfg[];
|
||||
|
||||
extern const char *htmlPinRoleNames[];
|
||||
|
||||
@ -20,6 +21,8 @@ extern const char *g_build_str;
|
||||
#define HTTP_RESPONSE_NOT_FOUND 404
|
||||
#define HTTP_RESPONSE_SERVER_ERROR 500
|
||||
|
||||
|
||||
|
||||
#define MAX_QUERY 16
|
||||
#define MAX_HEADERS 16
|
||||
typedef struct http_request_tag {
|
||||
@ -50,13 +53,11 @@ typedef struct http_request_tag {
|
||||
|
||||
int HTTP_ProcessPacket(http_request_t *request);
|
||||
void http_setup(http_request_t *request, const char *type);
|
||||
void http_html_start(http_request_t *request, const char *pagename);
|
||||
void http_html_end(http_request_t *request);
|
||||
int poststr(http_request_t *request, const char *str);
|
||||
int postany(http_request_t *request, const char *str, int len);
|
||||
void misc_formatUpTimeString(int totalSeconds, char *o);
|
||||
// void HTTP_AddBuildFooter(http_request_t *request);
|
||||
// void HTTP_AddHeader(http_request_t *request);
|
||||
void HTTP_AddBuildFooter(http_request_t *request);
|
||||
void HTTP_AddHeader(http_request_t *request);
|
||||
int http_getArg(const char *base, const char *name, char *o, int maxSize);
|
||||
int http_getArgInteger(const char *base, const char *name);
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@ static int http_rest_get(http_request_t *request){
|
||||
return http_rest_get_flash_advanced(request);
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp(request->url, "api/dumpconfig")){
|
||||
return http_rest_get_dumpconfig(request);
|
||||
}
|
||||
@ -191,11 +192,13 @@ static int http_rest_get(http_request_t *request){
|
||||
return http_rest_get_flash_vars_test(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "GET REST API");
|
||||
poststr(request, "GET of ");
|
||||
poststr(request, request->url);
|
||||
http_html_end(request);
|
||||
poststr(request, htmlEnd);
|
||||
poststr(request,NULL);
|
||||
return 0;
|
||||
}
|
||||
@ -254,7 +257,6 @@ static int http_rest_post(http_request_t *request){
|
||||
#endif
|
||||
|
||||
http_setup(request, httpMimeTypeHTML);
|
||||
http_html_start(request, "POST REST API");
|
||||
poststr(request, "POST to ");
|
||||
poststr(request, request->url);
|
||||
poststr(request, "<br/>Content Length:");
|
||||
@ -263,11 +265,16 @@ static int http_rest_post(http_request_t *request){
|
||||
poststr(request, "<br/>Content:[");
|
||||
poststr(request, request->bodystart);
|
||||
poststr(request, "]<br/>");
|
||||
http_html_end(request);
|
||||
poststr(request, htmlEnd);
|
||||
poststr(request,NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int http_rest_app(http_request_t *request){
|
||||
const char *webhost = CFG_GetWebappRoot();
|
||||
const char *ourip = HAL_GetMyIPString(); //CFG_GetOurIP();
|
||||
@ -281,10 +288,9 @@ static int http_rest_app(http_request_t *request){
|
||||
poststr(request, webhost);
|
||||
poststr(request, apppage4);
|
||||
} else {
|
||||
http_html_start(request, "Not available");
|
||||
poststr(request, htmlFooterReturnToMenu);
|
||||
poststr(request, "no APP available<br/>");
|
||||
http_html_end(request);
|
||||
poststr(request,htmlHeader);
|
||||
poststr(request,htmlReturnToMenu);
|
||||
poststr(request,"no APP available<br/>");
|
||||
}
|
||||
poststr(request,NULL);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user