diff --git a/server/src/routes.js b/server/src/routes.js index 360f2a0..e5fa94b 100644 --- a/server/src/routes.js +++ b/server/src/routes.js @@ -14,7 +14,13 @@ const ALLOWED_MIME = new Set(['image/jpeg', 'image/png', 'image/webp']) // GET /api/caption?date=YYYY-MM-DD — draft a one-line caption from that // day's context. Editable client-side before it's ever composited in. +// Explicitly uncacheable: the same date can legitimately draft a +// different caption call to call (goonk's underlying git/spotify state +// changes through the day, and the phrasing itself is randomized), so any +// browser/CDN/reverse-proxy layer caching this by URL would silently +// serve stale activity data. apiRouter.get('/caption', async (req, res) => { + res.setHeader('Cache-Control', 'no-store') const date = /^\d{4}-\d{2}-\d{2}$/.test(req.query.date) ? req.query.date : new Date().toISOString().slice(0, 10) const caption = await draftCaption(date) res.json({ caption })