From 9986fb0b9ca43eab93453936d5e0df6111d0b61c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 18 Feb 2024 19:54:56 +0800 Subject: [PATCH] :sparkles: Cached attachments --- pkg/server/startup.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/server/startup.go b/pkg/server/startup.go index 9f1b9e9..5a5e0c4 100644 --- a/pkg/server/startup.go +++ b/pkg/server/startup.go @@ -67,7 +67,10 @@ func NewServer() { api.Get("/users/:accountId/follow", auth, getAccountFollowed) api.Post("/users/:accountId/follow", auth, doFollowAccount) - api.Get("/attachments/o/:fileId", openAttachment) + api.Get("/attachments/o/:fileId", cache.New(cache.Config{ + Expiration: 365 * 24 * time.Hour, + CacheControl: true, + }), openAttachment) api.Post("/attachments", auth, uploadAttachment) api.Get("/posts", listPost)