matrix-art

An image gallery for Matrix
git clone git://archive.git.mtrnord.blog/MTRNord/matrix-art.git
Log | Files | Refs | README | LICENSE

commit 514e0f5d60ef40f64a855dc6e76b9bcea9f7bed0
parent d583ced6ae5351948891a1e57f2449443501800a
Author: MTRNord <mtrnord1@gmail.com>
Date:   Fri, 31 Dec 2021 16:07:17 +0100

Add caching

Diffstat:
Mpages/post/[id].tsx | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/pages/post/[id].tsx b/pages/post/[id].tsx @@ -216,13 +216,18 @@ class Post extends Component<Props, State> { Post.contextType = ClientContext; export const getServerSideProps: GetServerSideProps = async (context) => { - const { query } = context; + const { query, res } = context; const event_id = decodeURIComponent(query.id as string); + res.setHeader( + 'Cache-Control', + 'public, s-maxage=10, stale-while-revalidate=59' + ); if (event_id && event_id.startsWith("$")) { try { const data = await get_data(); + return { props: { directory_data: data, event_id: event_id