Remove dynamic playlist image (no point + slow to generate)
This commit is contained in:
parent
5bd856e04f
commit
db3d60748a
|
@ -18,13 +18,13 @@ var (
|
|||
|
||||
type ExternalDataClient struct {
|
||||
h *http.Client
|
||||
FortniteSets map[string]*FortniteSet
|
||||
FortniteItems map[string]*FortniteItem
|
||||
FortniteItemsWithDisplayAssets map[string]*FortniteItem
|
||||
FortniteItemsWithFeaturedImage []*FortniteItem
|
||||
TypedFortniteItems map[string][]*FortniteItem
|
||||
TypedFortniteItemsWithDisplayAssets map[string][]*FortniteItem
|
||||
SnowVariantTokens map[string]SnowCosmeticVariantToken
|
||||
FortniteSets map[string]*FortniteSet `json:"sets"`
|
||||
FortniteItems map[string]*FortniteItem `json:"items"`
|
||||
FortniteItemsWithDisplayAssets map[string]*FortniteItem `json:"-"`
|
||||
FortniteItemsWithFeaturedImage []*FortniteItem `json:"-"`
|
||||
TypedFortniteItems map[string][]*FortniteItem `json:"-"`
|
||||
TypedFortniteItemsWithDisplayAssets map[string][]*FortniteItem `json:"-"`
|
||||
SnowVariantTokens map[string]SnowCosmeticVariantToken `json:"-"`
|
||||
}
|
||||
|
||||
func NewExternalDataClient() *ExternalDataClient {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"strconv"
|
||||
|
||||
"github.com/ectrc/snow/aid"
|
||||
"github.com/ectrc/snow/fortnite"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
|
@ -75,10 +73,7 @@ func createPlaylist(mnemonic string, image string) aid.JSON {
|
|||
|
||||
func PostDiscovery(c *fiber.Ctx) error {
|
||||
results := []aid.JSON{}
|
||||
for playlist := range fortnite.PlaylistImages {
|
||||
results = append(results, createPlaylist(playlist, "https://" + aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999))))
|
||||
}
|
||||
results = append(results, createPlaylist("Playlist_DefaultSolo", "http://bucket.retrac.site/55737fa15677cd57fab9e7f4499d62f89cfde320.png"))
|
||||
results = append(results, createPlaylist("Playlist_DefaultSolo", "https://bucket.retrac.site/55737fa15677cd57fab9e7f4499d62f89cfde320.png"))
|
||||
|
||||
return c.Status(200).JSON(aid.JSON{
|
||||
"Panels": []aid.JSON{
|
||||
|
@ -156,13 +151,13 @@ func GetContentPages(c *fiber.Ctx) error {
|
|||
seasonString := strconv.Itoa(aid.Config.Fortnite.Season)
|
||||
|
||||
playlists := []aid.JSON{}
|
||||
for playlist := range fortnite.PlaylistImages {
|
||||
playlists = append(playlists, aid.JSON{
|
||||
"image": "http://" +aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)),
|
||||
"playlist_name": playlist,
|
||||
"hidden": false,
|
||||
})
|
||||
}
|
||||
// for playlist := range fortnite.PlaylistImages {
|
||||
// playlists = append(playlists, aid.JSON{
|
||||
// "image": "http://" +aid.Config.API.Host + aid.Config.API.Port + "/snow/image/" + playlist + ".png?cache="+strconv.Itoa(rand.Intn(9999)),
|
||||
// "playlist_name": playlist,
|
||||
// "hidden": false,
|
||||
// })
|
||||
// }
|
||||
|
||||
backgrounds := []aid.JSON{}
|
||||
switch aid.Config.Fortnite.Season {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/ectrc/snow/aid"
|
||||
"github.com/ectrc/snow/fortnite"
|
||||
p "github.com/ectrc/snow/person"
|
||||
|
@ -10,24 +8,16 @@ import (
|
|||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func GetPreloadedCosmetics(c *fiber.Ctx) error {
|
||||
return c.JSON(fortnite.External)
|
||||
func MiddlewareOnlyDebug(c *fiber.Ctx) error {
|
||||
if aid.Config.API.Debug {
|
||||
return c.Next()
|
||||
}
|
||||
|
||||
return c.SendStatus(403)
|
||||
}
|
||||
|
||||
func GetPlaylistImage(c *fiber.Ctx) error {
|
||||
playlist := c.Params("playlist")
|
||||
if playlist == "" {
|
||||
return c.SendStatus(404)
|
||||
}
|
||||
playlist = strings.Split(playlist, ".")[0]
|
||||
|
||||
image, ok := fortnite.PlaylistImages[playlist]
|
||||
if !ok {
|
||||
return c.SendStatus(404)
|
||||
}
|
||||
|
||||
c.Set("Content-Type", "image/png")
|
||||
return c.Send(image)
|
||||
func GetPreloadedCosmetics(c *fiber.Ctx) error {
|
||||
return c.JSON(fortnite.External)
|
||||
}
|
||||
|
||||
func GetPlayerLocker(c *fiber.Ctx) error {
|
||||
|
@ -68,4 +58,4 @@ func GetSnowConfig(c *fiber.Ctx) error {
|
|||
"basic": aid.Config,
|
||||
"amazon": storage.Repo.Amazon,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user