Add another useful endpoint
This commit is contained in:
parent
7e0a834e97
commit
cfd72743f3
|
@ -50,3 +50,14 @@ func GetPlayer(c *fiber.Ctx) error {
|
||||||
"discord": person.Discord,
|
"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)
|
||||||
|
}
|
1
main.go
1
main.go
|
@ -140,6 +140,7 @@ func main() {
|
||||||
|
|
||||||
snow := r.Group("/snow")
|
snow := r.Group("/snow")
|
||||||
snow.Get("/sockets", handlers.GetConnectedSockets)
|
snow.Get("/sockets", handlers.GetConnectedSockets)
|
||||||
|
snow.Get("/cache", handlers.GetCachedPlayers)
|
||||||
snow.Get("/cosmetics", handlers.GetPreloadedCosmetics)
|
snow.Get("/cosmetics", handlers.GetPreloadedCosmetics)
|
||||||
snow.Get("/image/:playlist", handlers.GetPlaylistImage)
|
snow.Get("/image/:playlist", handlers.GetPlaylistImage)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user