From d62722ce537937280c96d2a826f34fa79171dbd9 Mon Sep 17 00:00:00 2001 From: EpicKiwi Date: Thu, 21 Sep 2023 11:15:06 +0200 Subject: [PATCH] Added cache control --- loled.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/loled.js b/loled.js index 76d6c4a..9a938f8 100755 --- a/loled.js +++ b/loled.js @@ -82,12 +82,20 @@ app.use((ctx, next) => { ctx.response.headers.append("Access-Control-Allow-Headers", "*") if(ctx.request.method == "OPTION"){ - ctx.response.status = 200 + ctx.response.status = 204 } else { return next() } }) +app.use((ctx, next) => { + if(ctx.request.url.pathname.startsWith("/_loled")){ + ctx.response.headers.append("Cache-Control", "no-store") + } + + return next() +}) + // Static app.use(async (ctx, next) => { if(ctx.request.url.pathname.startsWith("/_loled"))