diff --git a/handlers/snow.go b/handlers/snow.go index 5e1f684..7a4876e 100644 --- a/handlers/snow.go +++ b/handlers/snow.go @@ -49,4 +49,15 @@ func GetPlayer(c *fiber.Ctx) error { "displayName": person.DisplayName, "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) } \ No newline at end of file diff --git a/main.go b/main.go index 5db7156..37137a7 100644 --- a/main.go +++ b/main.go @@ -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)