add more in /api/info

This commit is contained in:
btsimonh
2022-02-16 18:51:59 +00:00
parent 819628ef39
commit 271ea04778
3 changed files with 26 additions and 2 deletions

View File

@ -62,14 +62,17 @@ const char *apppage1 =
" <script>"
" var root = '";
#if WINDOWS
const char *obktype = "windows";
const char * apppage2 = "';"
" var obktype = 'windows';"
" var device = 'http://";
#elif PLATFORM_XR809
const char *obktype = "XR809";
const char * apppage2 = "';"
" var obktype = 'XR809';"
" var device = 'http://";
#else
const char *obktype = "beken";
const char * apppage2 = "';"
" var obktype = 'beken';"
" var device = 'http://";
@ -495,9 +498,17 @@ static int http_rest_post_logconfig(http_request_t *request){
static int http_rest_get_info(http_request_t *request){
char macstr[3*6+1];
http_setup(request, httpMimeTypeJson);
hprintf128(request, "{\"uptimes\":%d,", Time_getUpTimeSeconds());
hprintf128(request, "\"build\":\"%s\"}", g_build_str);
hprintf128(request, "{\"uptime_s\":%d,", Time_getUpTimeSeconds());
hprintf128(request, "\"build\":\"%s\",", g_build_str);
hprintf128(request, "\"sys\":\"%s\",", obktype);
hprintf128(request, "\"ip\":\"%s\",", getMyIp());
hprintf128(request, "\"mac\":\"%s\",", getMACStr(macstr));
hprintf128(request, "\"mqtthost\":\"%s:%d\",", CFG_GetMQTTHost(), CFG_GetMQTTPort());
hprintf128(request, "\"mqtttopic\":\"%s\"}", CFG_GetShortDeviceName());
poststr(request, NULL);
return 0;
}