From f3dfda066e512ce955950f44d04be59b0ec1b492 Mon Sep 17 00:00:00 2001 From: mellodoot Date: Mon, 2 Oct 2023 14:06:50 +0100 Subject: [PATCH] more server headers and MOTDs --- server/main.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/main.js b/server/main.js index d6dc248..b3e16f0 100644 --- a/server/main.js +++ b/server/main.js @@ -43,9 +43,12 @@ const MOTDS = [ "now fully open-source!", "somehow not the worst communication app!", "\"oh this is like nano but multiplayer\"", + "there's no place like 127.0.0.1", + "it's no emacs, but it'll do", ]; const STATIC_PATH = path.join(process.cwd(), "public"); +const CACHE_MAX_AGE = 86400 // 1 day const BANNER = `Welcome to OpenTerminal! @@ -99,7 +102,11 @@ const server = https.createServer(config, async (req, res) => { return; } const mime_type = MIME_TYPES[file.ext] || MIME_TYPES.default; - res.writeHead(200, { "Content-Type": mime_type }); + res.writeHead(200, { + "Content-Type": mime_type, + "Cache-Control": `max-age=${CACHE_MAX_AGE}`, + "Server": "OpenTerminal", + }); file.stream.pipe(res); // console.log(`${req.method} - ${req.url}`); });