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