Files
recflare/apps/discovery/README.md
T
devin 178d3b5b0e support for 202507 endpoints (#37)
* [auth][api] accept the 20250424.01 client

* [2025] unstable

* 20250718.0

* correct one this time

* stubs

* more stubs

* more stubs

* [lists] add worker

* [ai] route stubs

* [api] player photo setting

* [econ] add roomEconConfig route

* [infra] update worker generators

* [worker] add cards/moderation/platformnotification workers

* [lists] updates to some endpoints

* [clubs] stub out announcement endpoint, for now

* [econ] stub out season endpoints for now

* [chat] apps/chat stub out party endpoint not sure the shape yet

* [api] stub out statsig and lockeditems

* [doc] new services

* [lists] stub the bulk endpoint

* [datacollection] add placeholder service until we can kill it

* [api] set gifting to lvl5

* update lock

* [cdn] enable cache

* [match] matchmake v2

* [lists] stub some lists

* [ai] stubs

* [rooms] new subroom save endpoint

* [econ] add bulk purchase endpoint

* [discovery] update featured creator to 1 for fun

* [api] add photo settings flag

* [chat] fixup chat permissions (sorta)

* [auth] restrictions endpoint

* [rooms] contributed endpoint

* [api] fix outfit endpoint

* [discovery] attempt to fix store

* [chat] privacy endpoints

* [api] cheered images

* [rooms] add xp endpoint (disbaled)

* [rooms] add xp endpoint (disabled)

* update images-db for cheers

* [rooms] add autocomplete endpoint

* [cdn/img] increase cache ttl for statics

* [api] bulk route for images

* [accounts] add banner image

* [api] add misc missing endpoints

* [discovery] remove AI tab

* [platformnotifications] stub some endpoints

* [lists] add some more lists

* [rooms] additional endpoints

* [chat] stub a few privacy endpoints

* [econ] stub some endpoints

* misc db fixes

* [api] tweak shape for images v6

* [rooms] dont show trending RROs
2026-08-21 15:15:55 -04:00

63 lines
2.6 KiB
Markdown

# discovery
Discovery Worker served on the `discovery` subdomain (`discovery.recflare.net`) — a Hono
app that tells the client which carousels each of its discovery pages shows, and in what
order.
`GET /sections/pagesource/{type}` serves one page's sections verbatim from
`static/<type>.json`. `{type}` IS the filename — it is passed through unchanged and matched
exactly, case included — so the page sources that exist are whichever files are published:
`WatchHome`, `PlayHighlight`, `CommunityBoard`, `PlayMenuTabs`, `PlayCategories`,
`StoreFeatured`, `StoreClothing`, `StoreConsumables` and `bulk` at the time of writing.
Adding one is dropping in a file; nothing in `src/` enumerates them.
That works because `static/` is uploaded as Workers static assets rather than bundled into
the script (a bundled `import` can't do it — the bundler has to see every path at build
time), and the handler reads them through the ASSETS binding. `run_worker_first` is set so
the runtime never serves a layout directly at `/WatchHome.json`: the files are reachable
only through the documented route. Names that could climb out of `static/` are refused
before they reach the binding, and the asset response is passed through whole, so
`If-None-Match` gets a 304 for free.
The body is a bare ARRAY of sections with camelCase fields (`id`, `sectionType`,
`sectionSubType`, `source`, `sourceMetadata`, `displayMetadata`), the last two nullable and
`displayMetadata` an embedded JSON _string_ the client parses itself. This replaces the
`Discovery.DiscoveryPageContent.*` game configs (see
`apps/api/static/gameconfigs-v1-all.json`), which the client reads instead when
`Discovery.UseNewDiscoveryServerAPI` is off — note they are NOT the same shape: the configs
wrap the list in `{ pageSource, sections }` with PascalCase fields.
A section only _names_ a feed — `source`/`sourceMetadata`, e.g. `Hot`, `Recent`,
`PlaylistById` + an id, `CarouselEndpoint` + a slug — which the client resolves against the
`rooms`/`api` workers itself. Nothing here is player-specific, so the routes are
unauthenticated and every client gets the same layout.
## API documentation
`GET /openapi.json` serves a spec generated from `describeRoute` blocks that sit alongside
each handler, with the schemas in `src/openapi.ts`. It's also aggregated into the docs page
www serves at `/docs`.
**The spec is descriptive, not enforced** — same rationale as the other workers: a
reverse-engineered protocol, lenient handlers, no runtime validation.
## Development
### Run in dev mode
```sh
pnpm dev
```
### Run tests
```sh
pnpm test
```
### Deploy
```sh
pnpm turbo deploy
```