mirror of
https://github.com/djdevin/recflare.git
synced 2026-09-08 22:51:30 -07:00
clean up some social endpoints, sockets not working yet
This commit is contained in:
@@ -426,6 +426,11 @@ const app = new Hono<App>()
|
||||
return c.body(null, 200)
|
||||
})
|
||||
|
||||
// Fire-and-forget disconnect notification (form body `PlayerId`/`RoomInstanceId`).
|
||||
// The client posts this when it drops a room; we don't act on it — presence is
|
||||
// cleared by logout and otherwise expires on its own TTL — so just ack with 200.
|
||||
.post('/player/notifydisconnect', (c) => c.body(null, 200))
|
||||
|
||||
.get('/player', async (c) => {
|
||||
// Returns each requested player's presence. Reads the `id` query param(s);
|
||||
// with none it serves the static getplayer.json default.
|
||||
|
||||
@@ -150,6 +150,15 @@ describe('public endpoints', () => {
|
||||
expect(await res.json()).toEqual({ errorCode: 0 })
|
||||
})
|
||||
|
||||
test('POST /player/notifydisconnect returns 200', async () => {
|
||||
const res = await exports.default.fetch(`${ORIGIN}/player/notifydisconnect`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
body: 'PlayerId=155&RoomInstanceId=1000001',
|
||||
})
|
||||
expect(res.status).toBe(200)
|
||||
})
|
||||
|
||||
test('GET /player?id=N synthesizes a player payload for that id', async () => {
|
||||
const res = await exports.default.fetch(`${ORIGIN}/player?id=99`)
|
||||
expect(res.status).toBe(200)
|
||||
|
||||
Reference in New Issue
Block a user