Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ src/secrets.h

# macOS
.DS_Store

node_modules/
.vite/
dist/
Binary file removed data/assets/app.css.gz
Binary file not shown.
Binary file removed data/assets/app.js.gz
Binary file not shown.
Binary file removed data/index.html.gz
Binary file not shown.
8 changes: 8 additions & 0 deletions src/network/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -397,6 +404,7 @@ void setupServer() {
}

if (LittleFS.exists(path)) {
request->addHeader("Cache-Control", cacheControl(path));
request->send(LittleFS, path, contentTypeFromPath(path));
return;
}
Expand Down
4 changes: 2 additions & 2 deletions data/index.html → web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LUME</title>
<link rel="stylesheet" href="/assets/app.css">
<link rel="stylesheet" href="src/app.css">
</head>
<body>
<div class="container">
Expand Down Expand Up @@ -493,6 +493,6 @@ <h3 style="font-size: 16px; font-weight: 500; margin-bottom: 12px;">🤖 AI Assi

<div class="toast" id="toast"></div>

<script src="/assets/app.js"></script>
<script type="module" src="src/app.js"></script>
</body>
</html>
Loading