misc rooms endpoints, friends

This commit is contained in:
Devin Zuczek
2026-07-08 13:22:06 -04:00
parent 390843c679
commit a1d9fc17f0
22 changed files with 823 additions and 123 deletions
+13
View File
@@ -6,6 +6,7 @@ import {
getImagesByPlayer,
getImagesByRoom,
getPlayerFeed,
getSlideshowImages,
} from '../images-db'
import { authedId, unauthorized } from '../http'
@@ -133,6 +134,18 @@ export const imageRoutes = new Hono<App>({ strict: false })
return c.json(await getPlayerFeed(c.env.DB, playerId, skip, take))
})
// Global slideshow feed — the most recent publicly-listable images (Accessibility
// 0 or 1) across all rooms, newest first, each joined to its creator's username
// and room name. Auth-gated. Returns `{ Images, ValidTill }`, where ValidTill is a
// short (2-minute) cache hint the client refreshes against.
.get('/api/images/v1/slideshow', async (c) => {
const id = await authedId(c)
if (id === null) return unauthorized(c)
const Images = await getSlideshowImages(c.env.DB)
const ValidTill = new Date(Date.now() + 2 * 60 * 1000).toISOString()
return c.json({ Images, ValidTill })
})
// Image metadata by filename. Returns the stored SavedImage record, or 404 when
// there's no metadata row for that name.
.get('/api/images/v6', async (c) => {