diff --git a/handlers/discovery.go b/handlers/discovery.go new file mode 100644 index 0000000..18a22a9 --- /dev/null +++ b/handlers/discovery.go @@ -0,0 +1,148 @@ +package handlers + +import ( + "github.com/ectrc/snow/aid" + "github.com/gofiber/fiber/v2" +) + +func createContentPanel(title string, id string) aid.JSON { + return aid.JSON{ + "NumPages": 1, + "AnalyticsId": id, + "PanelType": "AnalyticsList", + "AnalyticsListName": title, + "CuratedListOfLinkCodes": []aid.JSON{}, + "ModelName": "", + "PageSize": 7, + "PlatformBlacklist": []aid.JSON{}, + "PanelName": id, + "MetricInterval": "", + "SkippedEntriesCount": 0, + "SkippedEntriesPercent": 0, + "SplicedEntries": []aid.JSON{}, + "PlatformWhitelist": []aid.JSON{}, + "EntrySkippingMethod": "None", + "PanelDisplayName": aid.JSON{ + "Category": "Game", + "NativeCulture": "", + "Namespace": "CreativeDiscoverySurface_Frontend", + "LocalizedStrings": []aid.JSON{{ + "key": "en", + "value": title, + }}, + "bIsMinimalPatch": false, + "NativeString": title, + "Key": "", + }, + "PlayHistoryType": "RecentlyPlayed", + "bLowestToHighest": false, + "PanelLinkCodeBlacklist": []aid.JSON{}, + "PanelLinkCodeWhitelist": []aid.JSON{}, + "FeatureTags": []aid.JSON{}, + "MetricName": "", + } +} + +func createPlaylist(mnemonic string, image string) aid.JSON { + return aid.JSON{ + "linkData": aid.JSON{ + "namespace": "fn", + "mnemonic": mnemonic, + "linkType": "BR:Playlist", + "active": true, + "disabled": false, + "version": 1, + "moderationStatus": "Unmoderated", + "accountId": "epic", + "creatorName": "Epic", + "descriptionTags": []string{}, + "metadata": aid.JSON{ + "image_url": image, + "matchmaking": aid.JSON{ + "override_playlist": mnemonic, + }, + }, + }, + "lastVisited": nil, + "linkCode": mnemonic, + "isFavorite": false, + } +} + +func PostDiscovery(c *fiber.Ctx) error { + return c.Status(200).JSON(aid.JSON{ + "Panels": []aid.JSON{ + { + "PanelName": "1", + "Pages": []aid.JSON{{ + "results": []aid.JSON{ + createPlaylist("playlist_defaultsolo", "https://cdn2.unrealengine.com/solo-1920x1080-1920x1080-bc0a5455ce20.jpg"), + createPlaylist("playlist_defaultduo", "https://cdn2.unrealengine.com/duos-1920x1080-1920x1080-5a411fe07b21.jpg"), + createPlaylist("playlist_trios", "https://cdn2.unrealengine.com/trios-1920x1080-1920x1080-d5054bb9691a.jpg"), + createPlaylist("playlist_defaultsquad", "https://cdn2.unrealengine.com/squads-1920x1080-1920x1080-095c0732502e.jpg"), + }, + "hasMore": false, + }}, + }, + }, + "TestCohorts": []string{ + "playlists", + }, + "ModeSets": aid.JSON{}, + }) +} + +func PostAssets(c *fiber.Ctx) error { + var body struct { + DAD_CosmeticItemUserOptions int `json:"DAD_CosmeticItemUserOptions"` + FortCreativeDiscoverySurface int `json:"FortCreativeDiscoverySurface"` + FortPlaylistAthena int `json:"FortPlaylistAthena"` + } + + err := c.BodyParser(&body) + if err != nil { + return c.Status(400).JSON(aid.JSON{"error":err.Error()}) + } + + testCohort := aid.JSON{ + "AnalyticsId": "0", + "CohortSelector": "PlayerDeterministic", + "PlatformBlacklist": []aid.JSON{}, + "ContentPanels": []aid.JSON{ + createContentPanel("Featured", "1"), + }, + "PlatformWhitelist": []aid.JSON{}, + "SelectionChance": 0.1, + "TestName": "playlists", + } + + return c.Status(200).JSON(aid.JSON{ + "FortCreativeDiscoverySurface": aid.JSON{ + "meta": aid.JSON{ + "promotion": 1, + }, + "assets": aid.JSON{ + "CreativeDiscoverySurface_Frontend": aid.JSON{ + "meta": aid.JSON{ + "revision": 1, + "headRevision": 1, + "promotion": 1, + "revisedAt": "0000-00-00T00:00:00.000Z", + "promotedAt": "0000-00-00T00:00:00.000Z", + }, + "assetData": aid.JSON{ + "AnalyticsId": "t412", + "TestCohorts": []aid.JSON{ + testCohort, + }, + "GlobalLinkCodeBlacklist": []aid.JSON{}, + "SurfaceName": "CreativeDiscoverySurface_Frontend", + "TestName": "20.10_4/11/2022_hero_combat_popularConsole", + "primaryAssetId": "FortCreativeDiscoverySurface:CreativeDiscoverySurface_Frontend", + "GlobalLinkCodeWhitelist": []aid.JSON{}, + }, + }, + }, + }, + }) +} \ No newline at end of file diff --git a/handlers/storage.go b/handlers/storage.go index c522c80..d519888 100644 --- a/handlers/storage.go +++ b/handlers/storage.go @@ -53,9 +53,9 @@ bIsAthenaGlobalChatEnabled=false [/Script/FortniteGame.FortGameInstance] !FrontEndPlaylistData=ClearArray +FrontEndPlaylistData=(PlaylistName=Playlist_DefaultSolo, PlaylistAccess=(bEnabled=True, bIsDefaultPlaylist=True, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=0, bDisplayAsLimitedTime=False, DisplayPriority=0)) -+FrontEndPlaylistData=(PlaylistName=Playlist_DefaultDuo, PlaylistAccess=(bEnabled=False, bIsDefaultPlaylist=True, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=0, bDisplayAsLimitedTime=False, DisplayPriority=1)) -+FrontEndPlaylistData=(PlaylistName=Playlist_DefaultSquad, PlaylistAccess=(bEnabled=False, bIsDefaultPlaylist=True, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=0, bDisplayAsLimitedTime=False, DisplayPriority=2)) -+FrontEndPlaylistData=(PlaylistName=Playlist_Fill_Squads, PlaylistAccess=(bEnabled=False, bIsDefaultPlaylist=False, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=1, bDisplayAsLimitedTime=False, DisplayPriority=0)) ++FrontEndPlaylistData=(PlaylistName=Playlist_DefaultDuo, PlaylistAccess=(bEnabled=True, bIsDefaultPlaylist=True, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=0, bDisplayAsLimitedTime=False, DisplayPriority=1)) ++FrontEndPlaylistData=(PlaylistName=Playlist_DefaultSquad, PlaylistAccess=(bEnabled=True, bIsDefaultPlaylist=True, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=0, bDisplayAsLimitedTime=False, DisplayPriority=2)) ++FrontEndPlaylistData=(PlaylistName=Playlist_Fill_Squads, PlaylistAccess=(bEnabled=True, bIsDefaultPlaylist=False, bVisibleWhenDisabled=True, bDisplayAsNew=False, CategoryIndex=1, bDisplayAsLimitedTime=False, DisplayPriority=0)) +FrontEndPlaylistData=(PlaylistName=Playlist_Blitz_Solo, PlaylistAccess=(bEnabled=True, bIsDefaultPlaylist=False, bVisibleWhenDisabled=True, bDisplayAsNew=True, CategoryIndex=1, bDisplayAsLimitedTime=True, DisplayPriority=1)) `), "DefaultRuntimeOptions.ini": []byte(` diff --git a/main.go b/main.go index 59a9da0..7d4c4c9 100644 --- a/main.go +++ b/main.go @@ -51,6 +51,7 @@ func main() { r.Get("/waitingroom/api/waitingroom", handlers.GetWaitingRoomStatus) r.Get("/region", handlers.GetRegion) r.Put("/profile/play_region", handlers.AnyNoContent) + r.Post("/api/v1/assets/Fortnite/:versionId/:assetName", handlers.PostAssets) account := r.Group("/account/api") account.Get("/public/account", handlers.GetPublicAccounts) @@ -89,6 +90,7 @@ func main() { game.Get("/enabled_features", handlers.GetGameEnabledFeatures) game.Post("/tryPlayOnPlatform/account/:accountId", handlers.PostGamePlatform) game.Post("/grant_access/:accountId", handlers.PostGameAccess) + game.Post("/creative/discovery/surface/:accountId", handlers.PostDiscovery) game.Post("/profileToken/verify/:accountId", handlers.AnyNoContent) profile := game.Group("/profile/:accountId")