Added timestamp to stored json that did not contain it

This will allow cached data to include the time it was refreshed at.
This commit is contained in:
Risto Lahtela 2021-02-06 09:33:07 +02:00 committed by Risto Lahtela
parent aca573e353
commit 54874175d8

View File

@ -66,7 +66,11 @@ public interface JSONStorage extends SubSystem {
public final long timestamp;
public StoredJSON(String json, long timestamp) {
this.json = json;
if (!json.startsWith("{\"") || json.contains("timestamp")) {
this.json = json;
} else {
this.json = "{\"timestamp\": " + timestamp + ",\"" + json.substring(2);
}
this.timestamp = timestamp;
}