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 = "." root = "."
testdata_dir = "testdata" testdata_dir = "testdata"
tmp_dir = "tmp" tmp_dir = "."
[build] [build]
args_bin = [] args_bin = []
bin = "tmp\\main.exe" bin = "main.exe"
cmd = "clear && go build -o ./tmp/main.exe ." cmd = "clear && go build -o ./main.exe ."
delay = 1000 delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"] exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = [] exclude_file = []
@ -40,5 +40,5 @@ tmp_dir = "tmp"
clean_on_exit = false clean_on_exit = false
[screen] [screen]
clear_on_rebuild = false clear_on_rebuild = true
keep_scroll = true keep_scroll = true

View File

@ -3,8 +3,9 @@ package handlers
import ( import (
"strings" "strings"
"github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/person" p "github.com/ectrc/snow/person"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@ -29,6 +30,23 @@ func GetPlaylistImage(c *fiber.Ctx) error {
} }
func GetPlayerLocker(c *fiber.Ctx) error { func GetPlayerLocker(c *fiber.Ctx) error {
person := c.Locals("person").(*person.Person) person := c.Locals("person").(*p.Person)
return c.JSON(person.AthenaProfile.Items)
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,
})
} }