Compare commits
No commits in common. "2fa939604953b21bb82e1d10343f30a8054700a4" and "e8adbe46538af366b5254723bd938ed77a4fd96c" have entirely different histories.
2fa9396049
...
e8adbe4653
@ -1,9 +1,5 @@
|
|||||||
package distribution
|
package distribution
|
||||||
|
|
||||||
import (
|
|
||||||
domainModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/domain"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Distributiuon struct {
|
type Distributiuon struct {
|
||||||
Domains []domainModels.Domain
|
Domains []Domain
|
||||||
}
|
}
|
||||||
|
11
distribution/domainModels.go
Normal file
11
distribution/domainModels.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package distribution
|
||||||
|
|
||||||
|
type Domain struct {
|
||||||
|
DiscordGroupID string
|
||||||
|
Games Games
|
||||||
|
Sessions Sessions
|
||||||
|
}
|
||||||
|
|
||||||
|
type Domains struct {
|
||||||
|
Domains []Domain
|
||||||
|
}
|
13
distribution/domainUtils.go
Normal file
13
distribution/domainUtils.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package distribution
|
||||||
|
|
||||||
|
var fakeDomains = Domains{ //TODO: Move to back
|
||||||
|
Domains: []Domain{defaultDomain},
|
||||||
|
}
|
||||||
|
|
||||||
|
var defaultDomain = Domain{
|
||||||
|
DiscordGroupID: "0",
|
||||||
|
Games: Games{
|
||||||
|
SteamGames: SteamFakeGamesList,
|
||||||
|
},
|
||||||
|
Sessions: FakeSessions,
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package gamesModels
|
package distribution
|
||||||
|
|
||||||
var garrysmodGame = SteamGame{ //TODO: Move to front
|
var garrysmodGame = SteamGame{ //TODO: Move to front
|
||||||
GameId: "garrysmod",
|
GameId: "garrysmod",
|
@ -1,7 +1,7 @@
|
|||||||
package gamesModels
|
package distribution
|
||||||
|
|
||||||
type SteamGame struct {
|
type SteamGame struct {
|
||||||
GameId string //TODO: To UUID
|
GameId string
|
||||||
SteamId string
|
SteamId string
|
||||||
Args []Argument
|
Args []Argument
|
||||||
OptionalArgs []Argument
|
OptionalArgs []Argument
|
||||||
@ -9,10 +9,6 @@ type SteamGame struct {
|
|||||||
Platforms map[string]bool
|
Platforms map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type LocalGame struct {
|
|
||||||
GameId string
|
|
||||||
}
|
|
||||||
|
|
||||||
type GameInterfaceAssets struct {
|
type GameInterfaceAssets struct {
|
||||||
Title string
|
Title string
|
||||||
Icon string
|
Icon string
|
@ -1,14 +1,12 @@
|
|||||||
package gameUtils
|
package distribution
|
||||||
|
|
||||||
import gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
func FindGameByID(id string, list Games) SteamGame {
|
||||||
|
|
||||||
func FindGameByID(id string, list gamesModels.Games) gamesModels.SteamGame {
|
|
||||||
for _, game := range list.SteamGames {
|
for _, game := range list.SteamGames {
|
||||||
if game.GameId == id {
|
if game.GameId == id {
|
||||||
return game
|
return game
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var temp gamesModels.SteamGame = gamesModels.SteamGame{}
|
var temp SteamGame = SteamGame{}
|
||||||
return temp
|
return temp
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,8 +20,8 @@ func FindGameByID(id string, list gamesModels.Games) gamesModels.SteamGame {
|
|||||||
// return game
|
// return game
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func GetJSGameInterface(game gamesModels.SteamGame) gamesModels.JSGameInterface {
|
func GetJSGameInterface(game SteamGame) JSGameInterface {
|
||||||
newInterface := gamesModels.JSGameInterface{
|
newInterface := JSGameInterface{
|
||||||
GameID: game.GameId,
|
GameID: game.GameId,
|
||||||
Title: game.Assets.Title,
|
Title: game.Assets.Title,
|
||||||
Icon: game.Assets.Icon,
|
Icon: game.Assets.Icon,
|
||||||
@ -32,6 +30,6 @@ func GetJSGameInterface(game gamesModels.SteamGame) gamesModels.JSGameInterface
|
|||||||
return newInterface
|
return newInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
func ArgToStr(a gamesModels.Argument) string {
|
func ArgToStr(a Argument) string {
|
||||||
return a.Body + " " + a.Value
|
return a.Body + " " + a.Value
|
||||||
}
|
}
|
@ -1,17 +1,15 @@
|
|||||||
package sessionsModels
|
package distribution
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
SessionId string
|
SessionId string
|
||||||
GameId string
|
GameId string
|
||||||
Assets gamesModels.GameInterfaceAssets
|
Assets GameInterfaceAssets
|
||||||
Expires time.Time
|
Expires time.Time
|
||||||
Arguments []gamesModels.Argument
|
Arguments []Argument
|
||||||
}
|
}
|
||||||
|
|
||||||
type Sessions struct {
|
type Sessions struct {
|
@ -1,36 +1,33 @@
|
|||||||
package sessionUtils
|
package distribution
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
|
||||||
sessionsModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/sessions"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ConvertServerSessionsToJSON(s sessionsModels.Session) []byte {
|
func ConvertServerSessionsToJSON(s Session) []byte {
|
||||||
s_json, err := json.Marshal(s)
|
s_json, err := json.Marshal(s)
|
||||||
_ = err //TODO: Check Errors
|
_ = err //TODO: Check Errors
|
||||||
return s_json
|
return s_json
|
||||||
}
|
}
|
||||||
|
|
||||||
func FindSessionByID(sessionId string, sessions []sessionsModels.Session) sessionsModels.Session {
|
func FindSessionByID(sessionId string, sessions []Session) Session {
|
||||||
for _, session := range sessions {
|
for _, session := range sessions {
|
||||||
if session.SessionId == sessionId {
|
if session.SessionId == sessionId {
|
||||||
return session
|
return session
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sessionsModels.Session{ //TODO: Return Errors
|
return Session{ //TODO: Return Errors
|
||||||
SessionId: sessionId,
|
SessionId: sessionId,
|
||||||
GameId: "",
|
GameId: "",
|
||||||
Assets: gamesModels.GameInterfaceAssets{},
|
Assets: GameInterfaceAssets{},
|
||||||
Expires: time.Time{},
|
Expires: time.Time{},
|
||||||
Arguments: []gamesModels.Argument{},
|
Arguments: []Argument{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetJSSessionInterface(s sessionsModels.Session) sessionsModels.JSSessionInterface {
|
func GetJSSessionInterface(s Session) JSSessionInterface {
|
||||||
newInterface := sessionsModels.JSSessionInterface{ //TODO: If session icon empty - use game icon
|
newInterface := JSSessionInterface{ //TODO: If session icon empty - use game icon
|
||||||
GameID: s.GameId,
|
GameID: s.GameId,
|
||||||
SessionId: s.SessionId,
|
SessionId: s.SessionId,
|
||||||
Expires: time.Time{},
|
Expires: time.Time{},
|
||||||
@ -42,8 +39,8 @@ func GetJSSessionInterface(s sessionsModels.Session) sessionsModels.JSSessionInt
|
|||||||
return newInterface
|
return newInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
var FakeSessions = sessionsModels.Sessions{ //TODO: Move to front
|
var FakeSessions = Sessions{ //TODO: Move to front
|
||||||
Sessions: []sessionsModels.Session{
|
Sessions: []Session{
|
||||||
{
|
{
|
||||||
GameId: "garrysmod",
|
GameId: "garrysmod",
|
||||||
SessionId: "gmod-test",
|
SessionId: "gmod-test",
|
||||||
@ -52,7 +49,7 @@ var FakeSessions = sessionsModels.Sessions{ //TODO: Move to front
|
|||||||
// Status: "Super fake session",
|
// Status: "Super fake session",
|
||||||
// Version: "",
|
// Version: "",
|
||||||
Expires: time.Time{},
|
Expires: time.Time{},
|
||||||
Arguments: []gamesModels.Argument{
|
Arguments: []Argument{
|
||||||
{
|
{
|
||||||
Body: "+connect",
|
Body: "+connect",
|
||||||
Value: "127.0.0.1:27015",
|
Value: "127.0.0.1:27015",
|
@ -1,16 +0,0 @@
|
|||||||
package distributionModels
|
|
||||||
|
|
||||||
import (
|
|
||||||
gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
|
||||||
sessionsModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/sessions"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Domain struct {
|
|
||||||
DiscordGroupID string
|
|
||||||
Games gamesModels.Games
|
|
||||||
Sessions sessionsModels.Sessions
|
|
||||||
}
|
|
||||||
|
|
||||||
type Domains struct {
|
|
||||||
Domains []Domain
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package sessionsModels
|
|
||||||
|
|
||||||
import (
|
|
||||||
"time"
|
|
||||||
|
|
||||||
gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
|
||||||
)
|
|
||||||
|
|
||||||
var fakeSession1 = Session{
|
|
||||||
SessionId: "FakeSession1",
|
|
||||||
GameId: "fakegameid1",
|
|
||||||
Assets: gamesModels.GameInterfaceAssets{},
|
|
||||||
Expires: time.Time{},
|
|
||||||
Arguments: []gamesModels.Argument{},
|
|
||||||
}
|
|
||||||
var FakeSessions = []Session{fakeSession1}
|
|
@ -1,19 +0,0 @@
|
|||||||
package domainUtils
|
|
||||||
|
|
||||||
import (
|
|
||||||
domainModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/domain"
|
|
||||||
gamesModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/games"
|
|
||||||
// sessionsModels "git.gregbrzezinski.com/Skirda/skirdagoutils/models/sessions"
|
|
||||||
)
|
|
||||||
|
|
||||||
var fakeDomains = domainModels.Domains{ //TODO: Move to back
|
|
||||||
Domains: []domainModels.Domain{defaultDomain},
|
|
||||||
}
|
|
||||||
|
|
||||||
var defaultDomain = domainModels.Domain{
|
|
||||||
DiscordGroupID: "0",
|
|
||||||
Games: gamesModels.Games{
|
|
||||||
SteamGames: gamesModels.SteamFakeGamesList,
|
|
||||||
},
|
|
||||||
// Sessions: sessionsModels.FakeSessions,
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user