From 99d855c4d47bde0802af87e722ca4ae06bdd0b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Fri, 5 Apr 2024 21:03:54 +0200 Subject: [PATCH] snapshot cache --- index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 7a4ac31..85517c0 100644 --- a/index.ts +++ b/index.ts @@ -136,11 +136,10 @@ async function setupSnapshotServer( if (magic) { const hash = createHash("md5").update(magic).digest("hex"); const index = parseInt(hash.substring(0, 8), 16) % files.length; - // Cache until the next hour rolls over res.sendFile(files[index], { headers: { "Cache-Control": `public, max-age=${ - 3600 - new Date().getMinutes() * 60 + 3600 - new Date().getMinutes() * 60 - new Date().getSeconds() }`, }, root: currentDir,