Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rene-d committed Mar 14, 2020
2 parents 2196487 + 4e67d1c commit e91efa7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/tic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,23 @@ void tic_get_json_dict(String &data, bool restricted __attribute__((unused)))
// interface pour webserver http://wifinfo/<ETIQUETTE>
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);
}

Expand Down
8 changes: 8 additions & 0 deletions src/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit e91efa7

Please sign in to comment.