From d84540b37bb3816314189d14bc3a11f49573c3b2 Mon Sep 17 00:00:00 2001 From: eccentric Date: Sun, 10 Dec 2023 01:55:11 +0000 Subject: [PATCH] add locker to web ui --- .air.toml | 8 ++++---- handlers/snow.go | 24 +++++++++++++++++++++--- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.air.toml b/.air.toml index f5f8f10..2af3b98 100644 --- a/.air.toml +++ b/.air.toml @@ -1,11 +1,11 @@ root = "." testdata_dir = "testdata" -tmp_dir = "tmp" +tmp_dir = "." [build] args_bin = [] - bin = "tmp\\main.exe" - cmd = "clear && go build -o ./tmp/main.exe ." + bin = "main.exe" + cmd = "clear && go build -o ./main.exe ." delay = 1000 exclude_dir = ["assets", "tmp", "vendor", "testdata"] exclude_file = [] @@ -40,5 +40,5 @@ tmp_dir = "tmp" clean_on_exit = false [screen] - clear_on_rebuild = false + clear_on_rebuild = true keep_scroll = true diff --git a/handlers/snow.go b/handlers/snow.go index 2103226..5e1f684 100644 --- a/handlers/snow.go +++ b/handlers/snow.go @@ -3,8 +3,9 @@ package handlers import ( "strings" + "github.com/ectrc/snow/aid" "github.com/ectrc/snow/fortnite" - "github.com/ectrc/snow/person" + p "github.com/ectrc/snow/person" "github.com/gofiber/fiber/v2" ) @@ -29,6 +30,23 @@ func GetPlaylistImage(c *fiber.Ctx) error { } func GetPlayerLocker(c *fiber.Ctx) error { - person := c.Locals("person").(*person.Person) - return c.JSON(person.AthenaProfile.Items) + person := c.Locals("person").(*p.Person) + + items := make([]p.Item, 0) + person.AthenaProfile.Items.RangeItems(func(key string, value *p.Item) bool { + items = append(items, *value) + return true + }) + + return c.JSON(items) +} + +func GetPlayer(c *fiber.Ctx) error { + person := c.Locals("person").(*p.Person) + + return c.JSON(aid.JSON{ + "id": person.ID, + "displayName": person.DisplayName, + "discord": person.Discord, + }) } \ No newline at end of file