snow/handlers/storefront.go

30 lines
707 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"
2023-11-09 18:42:28 +00:00
"github.com/ectrc/snow/storage"
"github.com/gofiber/fiber/v2"
)
func GetStorefrontCatalog(c *fiber.Ctx) error {
storefront := aid.JSON{
"refreshIntervalHrs": 24,
"dailyPurchaseHrs": 24,
"expiration": aid.TimeEndOfDay(),
"storefronts": []aid.JSON{},
2023-11-09 18:42:28 +00:00
}
return c.Status(fiber.StatusOK).JSON(storefront)
}
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)
}