snow/handlers/storefront.go

27 lines
708 B
Go
Raw Normal View History

package handlers
import (
"github.com/goccy/go-json"
2023-11-09 18:42:28 +00:00
"github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/person"
2023-11-09 18:42:28 +00:00
"github.com/ectrc/snow/storage"
"github.com/gofiber/fiber/v2"
)
func GetStorefrontCatalog(c *fiber.Ctx) error {
person := c.Locals("person").(*person.Person)
return c.Status(fiber.StatusOK).JSON(fortnite.StaticCatalog.GenerateFortniteCatalog(person))
}
func GetStorefrontKeychain(c *fiber.Ctx) error {
2023-11-09 18:42:28 +00:00
var keychain []string
err := json.Unmarshal(*storage.Asset("keychain.json"), &keychain)
if err != nil {
return c.Status(fiber.StatusInternalServerError).JSON(aid.JSON{"error":err.Error()})
}
return c.Status(fiber.StatusOK).JSON(keychain)
}