refacto: Remake the interface so it is more 'vintage' looking + Adding a full calendar page

This commit is contained in:
gauvainboiche
2026-10-25 12:01:00 +01:00
parent 2539b6c756
commit f6738972f1
45 changed files with 1433 additions and 361 deletions
+11 -1
View File
@@ -17,9 +17,15 @@ const MIME_TYPES = {
'.json': 'application/json; charset=utf-8',
'.svg': 'image/svg+xml',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.woff2': 'font/woff2',
'.txt': 'text/plain; charset=utf-8',
'.ico': 'image/x-icon',
};
// Binary assets never change without a rename, so they can be cached for a day.
const CACHEABLE_EXTENSIONS = new Set(['.jpg', '.woff2', '.svg']);
function sendJson(res, statusCode, payload) {
const body = JSON.stringify(payload);
res.writeHead(statusCode, {
@@ -78,7 +84,11 @@ function serveStatic(res, rootDir, requestPath) {
return;
}
const ext = path.extname(filePath).toLowerCase();
res.writeHead(200, { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' });
const headers = { 'Content-Type': MIME_TYPES[ext] || 'application/octet-stream' };
if (CACHEABLE_EXTENSIONS.has(ext)) {
headers['Cache-Control'] = 'public, max-age=86400';
}
res.writeHead(200, headers);
res.end(content);
});
}