Compare commits
2 Commits
e2502298a9
...
e0905ef578
Author | SHA1 | Date | |
---|---|---|---|
e0905ef578 | |||
4319b1e1b3 |
@ -7,10 +7,7 @@ import (
|
||||
type Session struct {
|
||||
SessionId string
|
||||
GameId string
|
||||
Icon string
|
||||
Title string
|
||||
Status string
|
||||
Version string
|
||||
Assets GameInterfaceAssets
|
||||
Expires time.Time
|
||||
Arguments []Argument
|
||||
}
|
||||
@ -20,10 +17,8 @@ type Sessions struct {
|
||||
}
|
||||
|
||||
type JSSessionInterface struct {
|
||||
GameID string `json:"gameId"`
|
||||
Icon string `json:"icon"`
|
||||
Title string `json:"title"`
|
||||
Status string `json:"status"`
|
||||
Version string `json:"version"`
|
||||
Expires time.Time `json:"expires"`
|
||||
GameID string `json:"gameId"`
|
||||
SessionId string `json:"sessionId"`
|
||||
Expires time.Time `json:"expires"`
|
||||
Assets GameInterfaceAssets `json:"assets"`
|
||||
}
|
||||
|
@ -11,16 +11,31 @@ func ConvertServerSessionsToJSON(s Session) []byte {
|
||||
return s_json
|
||||
}
|
||||
|
||||
func FindSessionByID(sessionId string, sessions []Session) Session {
|
||||
for _, session := range sessions {
|
||||
if session.SessionId == sessionId {
|
||||
return session
|
||||
}
|
||||
}
|
||||
return Session{ //TODO: Return Errors
|
||||
SessionId: sessionId,
|
||||
GameId: "",
|
||||
Assets: GameInterfaceAssets{},
|
||||
Expires: time.Time{},
|
||||
Arguments: []Argument{},
|
||||
}
|
||||
}
|
||||
|
||||
var FakeSessions = Sessions{
|
||||
Sessions: []Session{
|
||||
{
|
||||
GameId: "garrysmod",
|
||||
SessionId: "gmod-test",
|
||||
Icon: "",
|
||||
Title: "Regular Skirda Gmod server",
|
||||
Status: "Super fake session",
|
||||
Version: "",
|
||||
Expires: time.Time{},
|
||||
// Icon: "",
|
||||
// Title: "Regular Skirda Gmod server",
|
||||
// Status: "Super fake session",
|
||||
// Version: "",
|
||||
Expires: time.Time{},
|
||||
Arguments: []Argument{
|
||||
{
|
||||
Body: "+connect",
|
||||
@ -29,27 +44,17 @@ var FakeSessions = Sessions{
|
||||
},
|
||||
},
|
||||
{
|
||||
GameId: "half-lide-1",
|
||||
Title: "Half-Life 1 МЯСО",
|
||||
Status: "Retro shit",
|
||||
// GameId: "half-lide-1",
|
||||
// Title: "Half-Life 1 МЯСО",
|
||||
// Status: "Retro shit",
|
||||
Expires: time.Time{},
|
||||
},
|
||||
{
|
||||
GameId: "minecraft",
|
||||
Title: "Test 3",
|
||||
Status: "Testing session",
|
||||
Version: "1.54.7",
|
||||
GameId: "minecraft",
|
||||
// Title: "Test 3",
|
||||
// Status: "Testing session",
|
||||
// Version: "1.54.7",
|
||||
Expires: time.Time{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func FindSessionByID(sessionId string, sessions []Session) Session {
|
||||
for _, session := range sessions {
|
||||
if session.SessionId == sessionId {
|
||||
return session
|
||||
}
|
||||
}
|
||||
var temp Session = Session{}
|
||||
return temp
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user