|
@@ -370,7 +370,17 @@ static esp_err_t httpd_get_config_status(httpd_req_t *req, bool status)
|
|
|
fclose(f);
|
|
|
return rv ? ESP_FAIL : ESP_OK;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+static esp_err_t httpd_get_status(httpd_req_t *req)
|
|
|
+{
|
|
|
+ char timebuf[64];
|
|
|
+ time_t now = time(NULL);
|
|
|
+ const struct tm *tm = localtime(&now);
|
|
|
+ strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M:%S %z (%Z)", tm);
|
|
|
+ setenv("status.localtime", timebuf, 1);
|
|
|
+ return httpd_get_config_status(req, true);
|
|
|
+}
|
|
|
+
|
|
|
static esp_err_t httpd_set_lang(httpd_req_t *req, const char *query)
|
|
|
{
|
|
|
if (query) {
|
|
@@ -429,7 +439,7 @@ static esp_err_t httpd_sys_handler(httpd_req_t *req)
|
|
|
return httpd_lang_redirect(req);
|
|
|
|
|
|
if (STRING_MATCHES(file, filelen, "getstatus"))
|
|
|
- return httpd_get_config_status(req, true);
|
|
|
+ return httpd_get_status(req);
|
|
|
|
|
|
if (STRING_MATCHES(file, filelen, "getconfig"))
|
|
|
return httpd_get_config_status(req, false);
|