Add another useful endpoint

This commit is contained in:
Eccentric 2024-02-03 15:08:16 +00:00
parent 7e0a834e97
commit cfd72743f3
2 changed files with 12 additions and 0 deletions

View File

@ -50,3 +50,14 @@ func GetPlayer(c *fiber.Ctx) error {
"discord": person.Discord,
})
}
func GetCachedPlayers(c *fiber.Ctx) error {
persons := p.AllFromCache()
players := make([]p.PersonSnapshot, len(persons))
for i, person := range persons {
players[i] = *person.Snapshot()
}
return c.JSON(players)
}

View File

@ -140,6 +140,7 @@ func main() {
snow := r.Group("/snow")
snow.Get("/sockets", handlers.GetConnectedSockets)
snow.Get("/cache", handlers.GetCachedPlayers)
snow.Get("/cosmetics", handlers.GetPreloadedCosmetics)
snow.Get("/image/:playlist", handlers.GetPlaylistImage)