textarea with response

This commit is contained in:
hidaba
2023-04-22 10:13:50 +02:00
committed by GitHub
parent 2c7bbcd8bb
commit a66cc9d99d

View File

@ -227,14 +227,7 @@ void handleReq()
respOK = sendCommandAndReadSerialResponse(server.arg("code").c_str()); respOK = sendCommandAndReadSerialResponse(server.arg("code").c_str());
} }
if(respOK) handleRoot();
{
server.send(200, "text/plain", g_szRecvBuff);
}
else
{
server.send(500, "text/plain", "????");
}
} }
void handleJsonOut() void handleJsonOut()
@ -271,8 +264,10 @@ void handleRoot() {
strncat(szTmp, "<BR><a href='/log'>Runtime log</a><HR>", sizeof(szTmp)-1); strncat(szTmp, "<BR><a href='/log'>Runtime log</a><HR>", sizeof(szTmp)-1);
strncat(szTmp, "<form action='/req' method='get'>Command:<input type='text' name='code'/><input type='submit'></form><a href='/req?code=pwr'>Power</a> | <a href='/req?code=help'>Help</a> | <a href='/req?code=log'>Event Log</a> | <a href='/req?code=time'>Time</a>", sizeof(szTmp)-1); strncat(szTmp, "<form action='/req' method='get'>Command:<input type='text' name='code'/><input type='submit'><a href='/req?code=pwr'>Power</a> | <a href='/req?code=help'>Help</a> | <a href='/req?code=log'>Event Log</a> | <a href='/req?code=time'>Time</a><br>", sizeof(szTmp)-1);
strncat(szTmp, "</html>", sizeof(szTmp)-1); strncat(szTmp, "<textarea rows='80' cols='180'>", sizeof(szTmp)-1);
strncat(szTmp, g_szRecvBuff, sizeof(szTmp)-1);
strncat(szTmp, "</textarea></form>", sizeof(szTmp)-1); strncat(szTmp, "</html>", sizeof(szTmp)-1);
server.send(200, "text/html", szTmp); server.send(200, "text/html", szTmp);
} }