Webinterface: index.html and timezones.json are now saved to the Flash as GZIP compressed binary data. Compression happens on-the-fly during pio run.

This commit is contained in:
2019-12-04 06:13:07 +01:00
parent 84530f76fd
commit fad4f2c707
7 changed files with 505 additions and 42 deletions

14
tools/create_tz_json.sh Normal file
View File

@ -0,0 +1,14 @@
#!/usr/bin/bash
URL="https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv"
(
first=1
echo "{\"timezones\": {"
curl --silent "$URL" | while read line; do
[ $first -ne 1 ] && echo ","
first=0
echo -n "${line/\",\"/\":\"}"
done
echo
echo "}}"
) > src/webinterface/timezones.json

9
tools/post_build.py Normal file
View File

@ -0,0 +1,9 @@
Import("env")
env.Execute("gzip -9 < src/webinterface/index.html > src/webinterface/index.html.gz")
env.Execute("gzip -9 < src/webinterface/timezones.json > src/webinterface/timezones.json.gz")
def build(source, target, env):
env.Execute("rm src/webinterface/index.html.gz src/webinterface/timezones.json.gz")
env.AddPostAction("buildprog", build)