add locker to web ui

This commit is contained in:
eccentric 2023-12-10 01:55:11 +00:00
parent 288045785c
commit d84540b37b
2 changed files with 25 additions and 7 deletions

View File

@ -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

View File

@ -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,
})
}