fix: Add cache control headers and improve typing indicator
continuous-integration/drone/push Build is passing

- Add proper cache control headers in static.ts
- HTML files: no-cache to always get fresh version
- Assets: long cache with immutable (content-hashed filenames)
- Improve typing indicator animation (larger dots, faster animation)
This commit is contained in:
Paul Nothaft
2026-01-16 16:53:34 +01:00
parent 5ac64b437b
commit b4e7cce651
2 changed files with 21 additions and 8 deletions
+5 -5
View File
@@ -13,13 +13,13 @@ interface Message {
content: string; content: string;
} }
// Typing indicator with animated dots // Typing indicator with animated dots - v2
function TypingIndicator() { function TypingIndicator() {
return ( return (
<div className="flex items-center gap-1"> <div className="flex items-center gap-1.5">
<div className="w-2 h-2 bg-primary rounded-full animate-bounce" style={{ animationDelay: '0ms' }} /> <div className="w-2.5 h-2.5 bg-primary rounded-full animate-bounce" style={{ animationDelay: '0ms', animationDuration: '0.6s' }} />
<div className="w-2 h-2 bg-primary rounded-full animate-bounce" style={{ animationDelay: '150ms' }} /> <div className="w-2.5 h-2.5 bg-primary rounded-full animate-bounce" style={{ animationDelay: '150ms', animationDuration: '0.6s' }} />
<div className="w-2 h-2 bg-primary rounded-full animate-bounce" style={{ animationDelay: '300ms' }} /> <div className="w-2.5 h-2.5 bg-primary rounded-full animate-bounce" style={{ animationDelay: '300ms', animationDuration: '0.6s' }} />
</div> </div>
); );
} }
+16 -3
View File
@@ -22,11 +22,24 @@ export function serveStatic(app: Express) {
); );
} }
// Serve static files from the public directory (includes attached_assets) // Serve static assets with long cache (they have content hashes in filenames)
app.use(express.static(distPath)); app.use("/assets", express.static(path.join(distPath, "assets"), {
maxAge: '1y',
immutable: true
}));
// fall through to index.html if the file doesn't exist // Serve other static files with no-cache for HTML
app.use(express.static(distPath, {
setHeaders: (res, filePath) => {
if (filePath.endsWith('.html')) {
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
}
}
}));
// fall through to index.html if the file doesn't exist (with no-cache)
app.use("*", (_req, res) => { app.use("*", (_req, res) => {
res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate');
res.sendFile(path.resolve(distPath, "index.html")); res.sendFile(path.resolve(distPath, "index.html"));
}); });
} }