Compare commits

..

1 Commits

Author SHA1 Message Date
f8634f715f create domains 2022-10-31 22:50:13 +03:00
23 changed files with 150 additions and 1042 deletions

View File

@ -1,37 +0,0 @@
package sharedauth
import "time"
type InstallIdRegisterReq struct {
InstallId InstallId
}
type InstallId string
func (id InstallId) Validate() bool {
//TODO: More checks
return id != ""
}
type RedirResp struct {
RedirectUrl string
}
type LauncherSession struct {
// Username string
// DiscordId string
SessionToken string
InstallId string
Expiry time.Time
}
type ProfileResp struct {
Username string
}
type ValidateReq struct {
LauncherToken string
}
type ValidateResp struct {
}

View File

@ -1,43 +0,0 @@
package domain
// type Domains []SkirdaDomain
// func (domains Domains) Set(newDomains []SkirdaDomain) {
// domains = append([]SkirdaDomain{}, newDomains...)
// }
//func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) {
// for _, domain := range domains {
// game, _ := domain.FindGameByID(gameId)
// if game.GetSkirdaGameId() == gameId {
// return game, nil
// }
// }
//
// return nil, errors.New("")
//}
//func (domains Domains) GetGames() SkirdaGames {
// allGames := SkirdaGames{}
// for _, domain := range domains {
// allGames = append(allGames, domain.SkirdaGames...)
// }
// return allGames
//}
// func (domains Domains) GetSessions() SkirdaSessions {
// plainSessions := SkirdaSessions{}
// for _, domain := range domains {
// plainSessions = append(plainSessions, SkirdaSessions...)
// }
// return plainSessions
// }
// func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) {
// for _, domain := range domains {
// if domain.DomainId == domainId {
// return domain, nil
// }
// }
// return SkirdaDomain{}, errors.New("not any domain founded")
// }

View File

@ -1,33 +0,0 @@
package domain
// const gameType = "minecraft"
type MinecraftGame struct {
SkirdaGameId string
Assets GameUIAssets
Versions []string
}
func (game MinecraftGame) GetSkirdaGameId() string {
return game.SkirdaGameId
}
func (game MinecraftGame) GetUIAssets() GameUIAssets {
return game.Assets
}
func (game MinecraftGame) GetLaunchArgs() []string {
return []string{"", ""}
}
func (game MinecraftGame) GetType() string {
return "minecraft"
}
func (game MinecraftGame) GetArguments() Arguments {
return Arguments{}
}
func (game MinecraftGame) GetVersions() []string {
return game.Versions
}

View File

@ -1,43 +0,0 @@
package domain
import "errors"
type SkirdaGame interface {
GetSkirdaGameId() string
GetUIAssets() GameUIAssets
GetLaunchArgs() []string
GetType() string
GetArguments() Arguments
}
type GameUIAssets struct {
// GameID string `json:"gameId"`
Title string `json:"title"`
Icon string `json:"icon"`
Description string `json:"description"`
}
type SkirdaGames []SkirdaGame
func (games SkirdaGames) AddGames(game []SkirdaGame) {
games = append(games, game...)
}
func (games SkirdaGames) FindGameByID(gameId string) (SkirdaGame, error) {
for _, game := range games {
if game.GetSkirdaGameId() == gameId {
return game, nil
}
}
return nil, errors.New("")
}
type Argument struct {
Body string
Value string
}
type Arguments struct {
Required []Argument
Optional []Argument
}

View File

@ -1,128 +0,0 @@
package domain
import (
"errors"
)
type SkirdaSession interface {
GetSessionId() string
GetGameId() string
GetUIAssets() SessionUIAssets
GetGameType() string
GetSessionData() string
}
// type SkirdaSession struct {
// SkirdaSessionId string
// SkirdaGameId string
// Assets SessionUIAssets
// }
type SkirdaSessions []SkirdaSession
// GetGameId implements SkirdaSession
func (SkirdaSessions) GetGameId() string {
panic("unimplemented")
}
// GetGameType implements SkirdaSession
func (SkirdaSessions) GetGameType() string {
panic("unimplemented")
}
// GetSessionData implements SkirdaSession
func (SkirdaSessions) GetSessionData() string {
panic("unimplemented")
}
// GetSessionId implements SkirdaSession
func (SkirdaSessions) GetSessionId() string {
panic("unimplemented")
}
// GetUIAssets implements SkirdaSession
func (SkirdaSessions) GetUIAssets() SessionUIAssets {
panic("unimplemented")
}
type SessionUIAssets struct {
// GameID string `json:"gameId"`
Title string `json:"title"`
Icon string `json:"icon"`
Description string `json:"description"`
}
func (sessions SkirdaSessions) FindSessionById(sessionId string) (SkirdaSession, error) {
for _, session := range sessions {
if session.GetSessionId() == sessionId {
return session, nil
}
}
return nil, errors.New("no any sessions founded")
}
func (sessions SkirdaSessions) AddSessions(newSessions []SkirdaSession) {
sessions = append(sessions, newSessions...)
}
type MinecraftSession struct {
SkirdaSessionId string
SkirdaGameId string
Assets SessionUIAssets
Version string
}
func (session MinecraftSession) GetSessionId() string {
return session.SkirdaSessionId
}
func (session MinecraftSession) GetUIAssets() SessionUIAssets {
return session.Assets
}
func (session MinecraftSession) GetGameId() string {
return session.SkirdaGameId
}
func (session MinecraftSession) GetMinecraftVersion() string {
return session.SkirdaGameId
}
func (session MinecraftSession) GetGameType() string {
return "minecraft"
}
func (session MinecraftSession) GetSessionData() string {
return session.Version
}
type SteamSession struct {
SkirdaSessionId string
SkirdaGameId string
Assets SessionUIAssets
// Data SteamSessionData
}
type SteamSessionData struct {
kke string
}
func (session SteamSession) GetSessionId() string {
return session.SkirdaSessionId
}
func (session SteamSession) GetUIAssets() SessionUIAssets {
return session.Assets
}
func (session SteamSession) GetGameId() string {
return session.SkirdaGameId
}
func (session SteamSession) GetGameType() string {
return "steam"
}
func (session SteamSession) GetSessionData() string {
return ""
}

View File

@ -1,29 +0,0 @@
package domain
type SteamGame struct {
SkirdaGameId string
SteamId string
Assets GameUIAssets
Arguments Arguments
// CurrentVersion string
}
func (game SteamGame) GetSkirdaGameId() string {
return game.SkirdaGameId
}
func (game SteamGame) GetUIAssets() GameUIAssets {
return game.Assets
}
func (game SteamGame) GetLaunchArgs() []string {
return []string{"", ""}
}
func (game SteamGame) GetType() string {
return "steam"
}
func (game SteamGame) GetArguments() Arguments {
return game.Arguments
}

View File

@ -1,161 +0,0 @@
package domain
import "strconv"
type JavaVersion struct {
VersionNums `json:"version"`
Specifics []JavaVersionSpecifics `json:"specifics"`
}
func (jVer *JavaVersion) GetVersionString() string {
return strconv.Itoa(jVer.Major) + "." + strconv.Itoa(jVer.Minor) + "." + strconv.Itoa(jVer.Patch)
}
type JavaVersionSpecifics struct {
Os string `json:"os"`
Arch string `json:"arch"`
URL string `json:"URL"`
Sha1 string `json:"SHA1"`
}
func (jv *JavaVersion) FindOs(os string, arch string) *JavaVersionSpecifics {
for _, s := range jv.Specifics {
if s.Os == os && s.Arch == arch {
return &s
}
}
return nil
}
type VersionNums struct {
Major int `json:"major"`
Minor int `json:"minor"`
Patch int `json:"patch"`
}
func (v *VersionNums) FillFromString(maj string, min string, patch string) error {
iMaj, err := strconv.Atoi(maj)
if err != nil {
return err
}
iMin := 0
iMin, err = strconv.Atoi(min)
if err != nil {
return err
}
iPatch := 0
iPatch, err = strconv.Atoi(patch)
if err != nil {
return err
}
v.Major = iMaj
v.Minor = iMin
v.Patch = iPatch
return nil
}
type Version struct {
AssetIndex AssetIndex `json:"assetIndex"`
Downloads struct {
Client Artifact `json:"client"`
Server Artifact `json:"server"`
Mods struct {
Required []ModArtifact `json:"required"`
} `json:"mods"`
} `json:"downloads"`
ID string `json:"id"`
Libraries []Lib `json:"libraries"`
//ClientLog LogCfg
MainClass string `json:"mainClass"`
GameArgs []Argument
JVMArgs []Argument
Type string `json:"type"`
JavaVersion JavaVersion `json:"javaVersion"`
}
type AssetIndex struct {
ID string `json:"id"`
TotalSize uint64 `json:"totalSize"`
Artifact
}
// type Argument struct {
// Value string `json:"value"`
// Rules []Rule `json:"rules"`
// }
type JavaVersionClientDistribution struct { //TODO Rename
Component string `json:"component"`
MajorVersion int `json:"majorVersion"`
}
type Rule struct {
Action RuleAct `json:"action" mapstructure:"action"`
// OS information. All fields are regexes.
OS struct {
Name string `json:"name" mapstructure:"name"`
Version string `json:"version" mapstructure:"version"`
Arch string `json:"arch" mapstructure:"arch"`
} `json:"os" mapstructure:"os"`
Features struct {
IsDemoUser *bool `json:"is_demo_user" mapstructure:"is_demo_user"`
HasCustomResolution *bool `json:"has_custom_resolution" mapstructure:"has_custom_resolution"`
} `json:"features" mapstructure:"features"`
}
type RuleAct string
const (
ActAllow RuleAct = "allow"
ActDisallow RuleAct = "disallow"
)
type LibClassifiers struct {
JavaDoc *Artifact `json:"javadoc"`
NativesLinux *Artifact `json:"natives-linux"`
NativesMacOS *Artifact `json:"natives-osx"`
NativesWin *Artifact `json:"natives-windows"`
Sources *Artifact `json:"sources"`
}
type Lib struct {
Downloads struct {
MainJar *Artifact `json:"artifact"`
LibClassifiers `json:"classifiers"`
} `json:"downloads"`
NativeSuffixes struct {
Linux string `json:"linux"`
MacOS string `json:"osx"`
Windows string `json:"windows"`
} `json:"natives"`
Name string `json:"name"`
Rules []Rule `json:"rules"`
ExtractRules struct {
Exclude []string `json:"exclude"`
} `json:"extract"`
}
type Artifact struct {
SHA1 string `json:"sha1"`
Size uint64 `json:"size"`
URL string `json:"url"`
}
type ModArtifact struct {
Artifact
File string
Name string
Version string
}
type VersionMeta struct {
ID string `json:"id"`
Type string `json:"type"`
URL string `json:"url"`
Installed bool
}

View File

@ -0,0 +1,10 @@
package domainutilsgo
import (
"../gameUtils"
)
type Domain struct {
ServerId string
Games []gameUtils.Game
}

39
gameUtils/fakeGames.go Normal file
View File

@ -0,0 +1,39 @@
package gameUtils
var garrysmodGame = SteamGame{
GameId: "garrysmod",
SteamId: "4000",
Args: []string{},
Platforms: map[string]bool{"linux": true},
Assets: GameInterfaceAssets{
Title: "Garry's Mod",
Icon: "icon.png",
Description: "",
},
}
var openarena = SteamGame{
GameId: "openarena",
SteamId: "",
//Executable: "/usr/games/openarena",
Args: []string{},
Assets: GameInterfaceAssets{
Title: "Open Arena",
Icon: "icon.png",
Description: "asdadasd",
},
}
var minecraft = SteamGame{
GameId: "minecraft",
SteamId: "",
Args: []string{},
Assets: GameInterfaceAssets{
Title: "Minecraft",
Icon: "icon.png",
Description: "Minecraft Game",
},
Platforms: map[string]bool{},
}
var SteamFakeGamesList = []SteamGame{garrysmodGame, openarena, minecraft}

26
gameUtils/gameTypes.go Normal file
View File

@ -0,0 +1,26 @@
package gameUtils
type SteamGame struct {
GameId string
SteamId string
Args []string
Assets GameInterfaceAssets
Platforms map[string]bool
}
type GameInterfaceAssets struct {
Title string
Icon string
Description string
}
type Games struct {
SteamGames []SteamGame
}
type JSGameInterface struct {
GameID string `json:"gameId"`
Title string `json:"title"`
Icon string `json:"icon"`
Description string `json:"description"`
}

41
gameUtils/gameUtils.go Normal file
View File

@ -0,0 +1,41 @@
package gameUtils
import (
"encoding/json"
)
func FindGameByID(id string, list Games) SteamGame {
for _, game := range list.SteamGames {
if game.GameId == id {
return game
}
}
var temp SteamGame = SteamGame{}
return temp
}
// func findSteamGameByID(id string) SteamGame {
// for _, game := range localGames.St {
// if game.GameId == id {
// return game
// }
// }
// var game SteamGame = SteamGame{}
// return game
// }
func GetJSGameInterface(game SteamGame) JSGameInterface {
newInterface := JSGameInterface{
GameID: game.GameId,
Title: game.Assets.Title,
Icon: game.Assets.Icon,
Description: game.Assets.Description,
}
return newInterface
}
func ConvertServerGamesToJSON(g Games) []byte {
g_json, err := json.Marshal(g)
_ = err //TODO: Check Errors
return g_json
}

View File

@ -1,33 +0,0 @@
package osutils
import (
"github.com/pkg/errors"
"unicode"
)
func UuidValidate(uuid string) error {
if len(uuid) != 36 {
return errors.New("uuid length not valid")
}
for i, r := range uuid {
switch i {
case 8, 13, 18, 23:
if r != '-' {
return errors.New("uuid separator not valid")
}
break
default:
if !isLetter(r) && !unicode.IsDigit(r) {
return errors.Errorf("uuid char on %i not valid", i)
}
}
}
return nil
}
func isLetter(r rune) bool {
l := unicode.ToLower(r)
return (l >= 'a' && l <= 'f')
}

View File

@ -1,122 +0,0 @@
package osutils
import (
"crypto/sha1"
"encoding/hex"
"io"
"io/fs"
"io/ioutil"
"log"
"os"
"path"
"path/filepath"
"strings"
)
func IsDirectory(path string) (bool, error) {
fileInfo, err := os.Stat(path)
if err != nil {
return false, err
}
return fileInfo.IsDir(), err
}
func RecursiceWalk(pathToWalk string) ([]string, error) {
paths := []string{}
err := filepath.Walk(pathToWalk,
func(path string, info os.FileInfo, err error) error {
if err != nil {
println(err)
return err
}
// fmt.Println(path[len(path)-4:])
libBool, err := IsDirectory(path)
if err != nil {
println("error in checking lib or dir")
}
if !libBool {
// println(path)
paths = append(paths, path)
}
return nil
})
if err != nil {
log.Println(err)
}
return paths, nil
}
func ListDir(path string) ([]fs.FileInfo, error) {
files, err := ioutil.ReadDir(path)
if err != nil {
return []fs.FileInfo{}, err
}
return files, nil
}
func GetParentDir(filePath string) (string, error) {
cuttedPath := strings.Split(filePath, "/")
cuttedPath = cuttedPath[:len(cuttedPath)-1]
finalPath := path.Join("/", path.Join(cuttedPath...))
return finalPath, nil
}
type FileValidationInfo struct {
Path string
fs.FileInfo
SHA1 string
}
func ValidateFile(filePath string) (*FileValidationInfo, error) {
info := FileValidationInfo{
Path: filePath,
FileInfo: nil,
SHA1: "",
}
info.Path = filePath
stat, err := os.Stat(filePath)
if err != nil {
return &info, err
}
info.FileInfo = stat
hash, err := GetFileHash(filePath)
if err != nil {
return &info, err
}
info.SHA1 = hash
return &info, nil
}
func GetFileHash(filePath string) (string, error) {
//Initialize variable returnMD5String now in case an error has to be returned
var returnSHA1String string
//Open the filepath passed by the argument and check for any error
file, err := os.Open(filePath)
if err != nil {
return "", err
}
//Tell the program to call the following function when the current function returns
defer file.Close()
//Open a new SHA1 hash interface to write to
hash := sha1.New()
//Copy the file in the hash interface and check for any error
if _, err := io.Copy(hash, file); err != nil {
return returnSHA1String, err
}
//Get the 20 bytes hash
hashInBytes := hash.Sum(nil)[:20]
//Convert the bytes to a string
returnSHA1String = hex.EncodeToString(hashInBytes)
return returnSHA1String, nil
}

View File

@ -1,48 +0,0 @@
package osutils
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
)
func WriteStructAsJSON(data interface{}, JsonPath string) error {
file, _ := json.MarshalIndent(data, "", " ")
directory, err := GetParentDir(JsonPath)
if err != nil {
return err
}
err = os.MkdirAll(directory+"/", os.ModePerm)
if err != nil {
return err
}
err = ioutil.WriteFile(JsonPath, file, 0644)
if err != nil {
return err
}
return nil
}
func ReadJsonFromDisk(target interface{}, filePath string) error {
// Open our jsonFile
jsonFile, err := os.Open(filePath)
// if we os.Open returns an error then handle it
if err != nil {
fmt.Println(err)
return err
}
// fmt.Println("Successfully Opened users.json")
// defer the closing of our jsonFile so that we can parse it later on
defer jsonFile.Close()
// read our opened xmlFile as a byte array.
byteValue, _ := ioutil.ReadAll(jsonFile)
// we unmarshal our byteArray which contains our
// jsonFile's content into 'users' which we defined above
json.Unmarshal(byteValue, &target)
return nil
}

View File

@ -1,75 +0,0 @@
package javaentities
// type JavaVersion struct {
// Component string
// Type string
// Name string
// Major int
// Minor int
// Patch int
// }
// type JavaMetas struct {
// JavaVersions []JavaMeta `json:"javaVersions"`
// }
// func (jm JavaMetas) FindSpecificJavaOsByMajor(version JavaVersion) (SpecificJavaVersion, error) {
// for _, v := range jm.JavaVersions {
// if version.Major == v.Version.Major {
// jv, err := v.getOsJava()
// if err != nil {
// continue
// }
// return jv, nil
// }
// }
// return SpecificJavaVersion{}, errors.New("cant find os url")
// }
// func (jm JavaMetas) FindSpecificJava(MajorVersion string)
// type JavaMeta struct {
// Version struct {
// Major int `json:"major"`
// Minor int `json:"minor"`
// Patch int `json:"patch"`
// } `json:"version"`
// Name string
// Specifics `json:"specifics"`
// }
// type SpecificJavaVersion struct {
// Os string `json:"os"`
// Arch string `json:"arch"`
// URL string `json:"URL"`
// Sha1 string `json:"SHA1"`
// }
// type Specifics []SpecificJavaVersion
// func (s Specifics) getOsJava() (SpecificJavaVersion, error) {
// for _, v := range s {
// if v.Os == runtime.GOOS {
// return v, nil
// }
// }
// return SpecificJavaVersion{}, errors.New("not java for current os")
// }
// func (v *JavaVersion) CheckNotExists(launcherPath string) bool {
// javaBinPath := path.Join(launcherPath, ".redist", "java", v.GetString())
// _, err := os.Stat(javaBinPath)
// return err != nil
// }
// func (v *JavaVersion) GetString() string {
// var stringBuilder strings.Builder
// stringBuilder.WriteString(strconv.Itoa(v.Major))
// stringBuilder.WriteRune('.')
// stringBuilder.WriteString(strconv.Itoa(v.Minor))
// stringBuilder.WriteRune('.')
// stringBuilder.WriteString(strconv.Itoa(v.Patch))
// return stringBuilder.String()
// }

View File

@ -0,0 +1,23 @@
package sessionUtils
import (
"time"
)
type Session struct {
GameId string
Icon string
Title string
Status string
Version string
Expires time.Time
}
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"`
}

View File

@ -0,0 +1,11 @@
package sessionUtils
import (
"encoding/json"
)
func ConvertServerSessionsToJSON(s Session) []byte {
s_json, err := json.Marshal(s)
_ = err //TODO: Check Errors
return s_json
}

View File

@ -1,158 +0,0 @@
package sharedDistribution
type SkirdaGame interface {
// SkirdaGameId string
GetSkirdaGameId() string
GetInterfaceAsset(gameId string) JSGameInterface
GetLaunchArgs() []string
// Launch(gameId string) error
}
type SkirdaGames struct {
Steam []SteamGame
Minecraft MinecraftGame //TODO: To slice
}
func (games SkirdaGames) GetGameTypeById(skirdaGameId string) (string, error) {
if games.Minecraft.GetSkirdaGameId() == skirdaGameId {
return "minecraft", nil
}
for _, game := range games.Steam {
if game.GetSkirdaGameId() == skirdaGameId {
return "steam", nil
}
}
return "", nil //TODO: Right error return
}
func (games SkirdaGames) Test(skirdaGameId string) (interface{}, error) {
return games.Minecraft, nil
}
func (games SkirdaGames) GetInterfaceAssets() []JSGameInterface {
assets := []JSGameInterface{}
assets = append(assets, games.Minecraft.GetInterfaceAsset())
for _, game := range games.Steam {
assets = append(assets, game.GetInterfaceAsset())
}
return assets
}
func (games SteamGame) Test(skirdaGameId string) (interface{}, error) {
return SteamGame{}, nil
}
func (game SteamGame) GetSkirdaGameId() string {
return game.SkirdaGameId
}
func (game MinecraftGame) GetSkirdaGameId() string {
return game.SkirdaGameId
}
func (game MinecraftGame) GetMinecraftVersion() string {
return game.CurrentVersion
}
func (games SkirdaGames) GetLaunchCmd(skirdaGameId string, os string) (string, []string, error) {
gameType, err := games.GetGameTypeById(skirdaGameId)
if err != nil {
return "", nil, nil
}
switch gameType {
case "minecraft":
switch os {
case "windows":
return "notepad", []string{""}, nil
default:
return "", []string{}, nil
}
default:
return "", nil, nil
}
}
// func (games SkirdaGames) FindGameByID(gameId string) (SkirdaGame, error) {
// for _, game := range games {
// if game.GetSkirdaGameId() == gameId {
// return game, nil
// }
// }
// kek := SkirdaGame
// return game, nil //TODO: Right error return
// }
// func (game MinecraftGame) GetLaunchArgs() (string, []string, error) {
// switch os := runtime.GOOS; os {
// case "windows":
// return "java", []string{"-version"}, nil
// default:
// return "", []string{}, nil
// }
// }
func (game SteamGame) GetInterfaceAsset() JSGameInterface {
return JSGameInterface{
GameID: game.SkirdaGameId,
Title: game.Assets.Title,
Icon: game.Assets.Icon,
Description: game.Assets.Description,
}
}
func (game MinecraftGame) GetInterfaceAsset() JSGameInterface {
return JSGameInterface{
GameID: game.SkirdaGameId,
Title: game.Assets.Title,
Icon: game.Assets.Icon,
Description: game.Assets.Description,
}
}
type MinecraftGame struct {
SkirdaGameId string
Assets GameInterfaceAssets
CurrentVersion string
}
type SteamGame struct {
SkirdaGameId string
SteamId string
Args []Argument
OptionalArgs []Argument
//TODO: Settings??
Assets GameInterfaceAssets
Platforms map[string]bool
}
type LocalGame struct {
GameId string
}
type GameInterfaceAssets struct {
Title string
Icon string
Description string
Backgrounds []GameInterfaceBackground
}
type GameInterfaceBackground struct {
File string
}
type JSGameInterface struct {
GameID string `json:"gameId"`
Title string `json:"title"`
Icon string `json:"icon"`
Description string `json:"description"`
}
type Argument struct {
Body string
Value string
}

View File

@ -1,63 +0,0 @@
package sharedDistribution
import (
"time"
)
type SkirdaSessions []SkirdaSession
func (sessions SkirdaSessions) FindSessionById(sessionId string) (SkirdaSession, error) {
for _, session := range sessions {
if session.GetSessionId() == sessionId {
return session, nil
}
}
return sessions[0], nil //TODO: Temp error return
}
func (sessions SkirdaSessions) GetInterfaceAssets() []JSSessionInterface {
assets := []JSSessionInterface{}
for _, session := range sessions {
assets = append(assets, session.GetInterfaceAsset())
}
return assets
}
type SkirdaSession struct {
SkirdaSessionId string
SkirdaGameId string
Args []string
NegativeArgs []string
}
type JSSessionInterface struct {
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"`
}
func (session SkirdaSession) GetSessionId() string {
return session.SkirdaSessionId
}
func (session SkirdaSession) GetGameId() string {
return session.SkirdaGameId
}
func (session SkirdaSession) GetInterfaceAsset() JSSessionInterface {
// gameId := SkirdaGame.GetSkirdaGameId()
return JSSessionInterface{
GameID: "",
SessionId: "",
Expires: time.Time{},
Title: "Test Session",
Icon: "",
Description: "",
Backgrounds: []string{},
}
}

View File

@ -1,46 +0,0 @@
package sharedauth
import (
"time"
)
type InstallIdRegisterReq struct {
InstallId InstallId
}
type InstallId string
func (id InstallId) Validate() bool {
//TODO: More checks
return id != ""
}
type RedirResp struct {
RedirectUrl string `json:"redirecturl"`
RequestId string `json:"requestid"`
}
type LauncherSession struct {
// Username string
// DiscordId string
SessionToken string
InstallId string
Expiry time.Time
}
type ProfileResp struct {
Username string
}
type ValidateReq struct {
LauncherToken string
}
type ValidateResp struct {
}
type SkirdaUserResp struct {
SkirdaUserId string `json:"skirdauser_id"`
Username string `json:"username"`
Token string `json:"token"`
}

View File

@ -1,9 +0,0 @@
package skirdaobjects
import "skirdaGoLauncher/games/localgame"
type SkirdaDomainApi struct {
SkirdaDomainId string `json:"skirdaDomainId"`
Games []localgame.LocalSkirdaGame2 `json:"games"`
Events []SkirdaEventApi `json:"events"`
}

View File

@ -1,7 +0,0 @@
package skirdaobjects
type SkirdaEventApi struct {
SkirdaEventId string `json:"skirdaevent_id"`
SkirdaGameId string `json:"skirdagame_id"`
Title string `json:"title"`
}

View File

@ -1,7 +0,0 @@
package skirdaobjects
// type SkirdaGameApi struct {
// SkirdaGameId string `json:"skirdagame_id"`
// Title string `json:"title"`
// Type string `json:"type"`
// }