From 8c71568d1095b31f6dc21e85b2bcdc128ab02ba1 Mon Sep 17 00:00:00 2001 From: SALTWOOD <105980161+SALTWOOD@users.noreply.github.com> Date: Wed, 28 Aug 2024 01:20:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=8A=82=E7=82=B9=E4=B8=93=E5=B1=9E?= =?UTF-8?q?=E9=80=9A=E9=81=93=E4=B8=8B=E8=BD=BD=E4=B8=8D=E5=88=B0=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server.ts b/src/server.ts index 9b73e81..0d892c8 100644 --- a/src/server.ts +++ b/src/server.ts @@ -353,7 +353,10 @@ export class Server { const hash = req.params.hash.toLowerCase(); const file = this.files.find(f => f.hash === hash); if (file) { - res.sendFile(path.join(__dirname, file.path.substring(1))); + res.sendFile(file.path.substring(1), { + root: ".", + maxAge: "30d" + }); } else { res.status(404).send(); }