mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-27 07:58:55 -07:00
[studio] beta studio (#114)
* rrs stuff * studio service yay * rrs whitelist * moree studiooooooo fellowwww * rec room studio room loading yay * fixes yay * fix 2 because idk yayuh * Update cdn.app.ts * ccontent length fix? * Preserve content-length and upgrade metadata Return a real zero-filled byte array for CDN HEAD responses so the runtime preserves Content-Length while still sending no payload. In notify, re-create the Request with its original headers, set OWNER_HEADER from the validated token, and forward that Request to hub.fetch to avoid losing WebSocket upgrade metadata (which could trigger 500s in Durable Objects). These changes ensure the editor's size checks and WebSocket upgrades remain reliable. * fix x524234 * shirt thing? * [auth] remove grant table as we already have audit_log for now * rename table to generic device_grant * cleanup/lint --------- Co-authored-by: Devin Zuczek <devin.zuczek@gmail.com>
This commit is contained in:
@@ -238,6 +238,35 @@ export async function getPlayerIdsInRoom(
|
||||
return results.map((r) => r.accountId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Everyone standing in one subroom of a room right now, across every live instance of
|
||||
* that subroom. The narrower cut of {@link getPlayerIdsInRoom}: a room has several
|
||||
* subrooms, and a player in a different subroom of the same room is not here.
|
||||
*
|
||||
* `subRoomId` is not its own column — presence indexes the room and the instance — so
|
||||
* the subroom is read out of the instance blob. Unexpired presence only, lobby
|
||||
* (null-instance) rows excluded, ordered by account id.
|
||||
*/
|
||||
export async function getPlayerIdsInRoomSubRoom(
|
||||
db: D1Database,
|
||||
roomId: number,
|
||||
subRoomId: number,
|
||||
now = nowSeconds()
|
||||
): Promise<number[]> {
|
||||
const { results } = await db
|
||||
.prepare(
|
||||
`SELECT DISTINCT account_id AS accountId FROM presence
|
||||
WHERE room_id = ?1
|
||||
AND expires_at > ?2
|
||||
AND room_instance_id IS NOT NULL
|
||||
AND CAST(json_extract(data, '$.roomInstance.subRoomId') AS INTEGER) = ?3
|
||||
ORDER BY account_id`
|
||||
)
|
||||
.bind(roomId, now, subRoomId)
|
||||
.all<{ accountId: number }>()
|
||||
return results.map((r) => r.accountId)
|
||||
}
|
||||
|
||||
/**
|
||||
* Everyone online right now, anywhere — the same population {@link countOnlinePlayers}
|
||||
* counts, as ids. Unexpired presence only, one row per account, lobby (null-instance)
|
||||
|
||||
Reference in New Issue
Block a user