diff --git a/src/tic.cpp b/src/tic.cpp index 30dd646..f6f77d1 100644 --- a/src/tic.cpp +++ b/src/tic.cpp @@ -251,6 +251,23 @@ void tic_get_json_dict(String &data, bool restricted __attribute__((unused))) // interface pour webserver http://wifinfo/ const char *tic_get_value(const char *label) { + static String buf; // pas top, mais suffisant et simple + + if (strcmp(label, "watt") == 0) + { + buf = String(tinfo.watt()); + return buf.c_str(); + } + if (strcmp(label, "seconds") == 0) + { + buf = tinfo.get_seconds(); + return buf.c_str(); + } + if (strcmp(label, "timestamp") == 0) + { + buf = tinfo.get_timestamp_iso8601(); + return buf.c_str(); + } return tinfo.get_value(label, nullptr, true); } diff --git a/src/webserver.cpp b/src/webserver.cpp index 4124695..871e12f 100644 --- a/src/webserver.cpp +++ b/src/webserver.cpp @@ -103,6 +103,7 @@ void webserver_handle_notfound() if (value != nullptr) { + server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); server.send(200, mime::mimeTable[mime::txt].mimeType, value); } else @@ -214,6 +215,13 @@ void webserver_setup() file.close(); }); + /* + server.on(F("/firmware"), []() { + server.sendHeader("Cache-Control", "max-age=86400"); + server.send(200, mime::mimeTable[mime::txt].mimeType, WIFINFO_VERSION); + }); + */ + // serves all read-only web file with 24hr max-age control // to avoid multiple requests to ESP server.serveStatic("/fonts", WIFINFO_FS, "/fonts", "max-age=86400");