From e8adbe46538af366b5254723bd938ed77a4fd96c Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Sat, 12 Nov 2022 02:56:43 +0300 Subject: [PATCH] add sessions interface --- distribution/sessionTypes.go | 11 +++++++---- distribution/sessionUtils.go | 13 +++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/distribution/sessionTypes.go b/distribution/sessionTypes.go index 0857735..6d9ff63 100644 --- a/distribution/sessionTypes.go +++ b/distribution/sessionTypes.go @@ -17,8 +17,11 @@ type Sessions struct { } type JSSessionInterface struct { - GameID string `json:"gameId"` - SessionId string `json:"sessionId"` - Expires time.Time `json:"expires"` - Assets GameInterfaceAssets `json:"assets"` + GameID string `json:"gameId"` + SessionId string `json:"sessionId"` + Expires time.Time `json:"expires"` + Title string `json:"title"` + Icon string `json:"icon"` + Description string `json:"description"` + Backgrounds []string `json:"backgrounds"` } diff --git a/distribution/sessionUtils.go b/distribution/sessionUtils.go index 4249517..63cccbb 100644 --- a/distribution/sessionUtils.go +++ b/distribution/sessionUtils.go @@ -26,6 +26,19 @@ func FindSessionByID(sessionId string, sessions []Session) Session { } } +func GetJSSessionInterface(s Session) JSSessionInterface { + newInterface := JSSessionInterface{ //TODO: If session icon empty - use game icon + GameID: s.GameId, + SessionId: s.SessionId, + Expires: time.Time{}, + Title: s.Assets.Title, + Icon: s.Assets.Icon, + Description: s.Assets.Description, + Backgrounds: []string{}, //TODO: Complete + } + return newInterface +} + var FakeSessions = Sessions{ //TODO: Move to front Sessions: []Session{ {