diff --git a/.gitignore b/.gitignore index 2c35b56..292e133 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,7 @@ src/secrets.h # macOS .DS_Store + +node_modules/ +.vite/ +dist/ \ No newline at end of file diff --git a/data/assets/app.css.gz b/data/assets/app.css.gz deleted file mode 100644 index 74f10cc..0000000 Binary files a/data/assets/app.css.gz and /dev/null differ diff --git a/data/assets/app.js.gz b/data/assets/app.js.gz deleted file mode 100644 index b9b44cf..0000000 Binary files a/data/assets/app.js.gz and /dev/null differ diff --git a/data/index.html.gz b/data/index.html.gz deleted file mode 100644 index a04c3b1..0000000 Binary files a/data/index.html.gz and /dev/null differ diff --git a/src/network/server.cpp b/src/network/server.cpp index 1ef7f99..2ba617a 100644 --- a/src/network/server.cpp +++ b/src/network/server.cpp @@ -53,6 +53,13 @@ static String contentTypeFromPath(const String& path) { return "application/octet-stream"; } +static String cacheControl(const String& path) { + if (path.endsWith(".css")) return "private, max-age=604800, immutable"; + if (path.endsWith(".js")) return "private, max-age=604800, immutable"; + + return "no-cache, max-age=0"; +} + static void appendColorArray(JsonArray& arr, const CRGB& color) { arr.add(color.r); arr.add(color.g); @@ -397,6 +404,7 @@ void setupServer() { } if (LittleFS.exists(path)) { + request->addHeader("Cache-Control", cacheControl(path)); request->send(LittleFS, path, contentTypeFromPath(path)); return; } diff --git a/data/index.html b/web/index.html similarity index 99% rename from data/index.html rename to web/index.html index acdf564..a10f0e6 100644 --- a/data/index.html +++ b/web/index.html @@ -5,7 +5,7 @@