mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-04-24 07:27:31 -05:00
Add OpenHost to QR2 Login for use in groups api
This commit is contained in:
parent
c0f54e554a
commit
2b91d5c103
|
|
@ -377,7 +377,7 @@ func (g *GameSpySession) login(command common.GameSpyCommand) {
|
|||
g.ModuleName += "/" + common.CalcFriendCodeString(g.User.ProfileId, g.User.GsbrCode[:4])
|
||||
|
||||
// Notify QR2 of the login
|
||||
qr2.Login(g.User.ProfileId, gamecd, ingamesn, cfc, g.User.GsbrCode[:4], g.RemoteAddr, g.NeedsExploit, g.DeviceAuthenticated, g.User.Restricted)
|
||||
qr2.Login(g.User.ProfileId, gamecd, ingamesn, cfc, g.User.GsbrCode[:4], g.RemoteAddr, g.NeedsExploit, g.DeviceAuthenticated, g.User.Restricted, g.User.OpenHost)
|
||||
|
||||
replyUserId := g.User.UserId
|
||||
if g.UnitCode == UnitCodeDS {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import (
|
|||
"wwfc/common"
|
||||
"wwfc/database"
|
||||
"wwfc/logging"
|
||||
"wwfc/qr2"
|
||||
|
||||
"github.com/logrusorgru/aurora/v3"
|
||||
)
|
||||
|
|
@ -89,6 +90,8 @@ func (g *GameSpySession) updateProfile(command common.GameSpyCommand) {
|
|||
} else if g.User.OpenHost && !enabled {
|
||||
g.openHostDisabled()
|
||||
}
|
||||
|
||||
qr2.SetLoginOpenHost(g.User.ProfileId, enabled)
|
||||
}
|
||||
|
||||
g.User.UpdateProfile(pool, ctx, command.OtherValues)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ type PlayerInfo struct {
|
|||
VersusELO string `json:"ev,omitempty"`
|
||||
BattleELO string `json:"eb,omitempty"`
|
||||
Mii []MiiInfo `json:"mii,omitempty"`
|
||||
OpenHost string `json:"openhost,omitempty"`
|
||||
}
|
||||
|
||||
type GroupInfo struct {
|
||||
|
|
@ -109,6 +110,7 @@ func getGroupsRaw(gameNames []string, groupNames []string) []GroupInfo {
|
|||
|
||||
if login := session.login; login != nil {
|
||||
mapData["+ingamesn"] = login.InGameName
|
||||
mapData["+openhost"] = strconv.FormatBool(login.OpenHost)
|
||||
} else {
|
||||
mapData["+ingamesn"] = ""
|
||||
}
|
||||
|
|
@ -160,6 +162,7 @@ func GetGroups(gameNames []string, groupNames []string, sorted bool) []GroupInfo
|
|||
Count: rawPlayer["+localplayers"],
|
||||
ProfileID: rawPlayer["dwc_pid"],
|
||||
InGameName: rawPlayer["+ingamesn"],
|
||||
OpenHost: rawPlayer["+openhost"],
|
||||
}
|
||||
|
||||
pid, err := strconv.ParseUint(rawPlayer["dwc_pid"], 10, 32)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import (
|
|||
"encoding/gob"
|
||||
"os"
|
||||
"strconv"
|
||||
"wwfc/logging"
|
||||
|
||||
"github.com/logrusorgru/aurora/v3"
|
||||
)
|
||||
|
||||
type LoginInfo struct {
|
||||
|
|
@ -16,12 +19,13 @@ type LoginInfo struct {
|
|||
NeedsExploit bool
|
||||
DeviceAuthenticated bool
|
||||
Restricted bool
|
||||
OpenHost bool
|
||||
session *Session
|
||||
}
|
||||
|
||||
var logins = map[uint32]*LoginInfo{}
|
||||
|
||||
func Login(profileID uint32, gameCode string, inGameName string, consoleFriendCode uint64, fcGame string, publicIP string, needsExploit bool, deviceAuthenticated bool, restricted bool) {
|
||||
func Login(profileID uint32, gameCode string, inGameName string, consoleFriendCode uint64, fcGame string, publicIP string, needsExploit bool, deviceAuthenticated bool, restricted bool, openHost bool) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
|
|
@ -35,6 +39,7 @@ func Login(profileID uint32, gameCode string, inGameName string, consoleFriendCo
|
|||
NeedsExploit: needsExploit,
|
||||
DeviceAuthenticated: deviceAuthenticated,
|
||||
Restricted: restricted,
|
||||
OpenHost: openHost,
|
||||
session: nil,
|
||||
}
|
||||
}
|
||||
|
|
@ -51,6 +56,17 @@ func SetDeviceAuthenticated(profileID uint32) {
|
|||
}
|
||||
}
|
||||
|
||||
func SetLoginOpenHost(profileID uint32, openHost bool) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
if login, exists := logins[profileID]; exists {
|
||||
login.OpenHost = openHost
|
||||
}
|
||||
|
||||
logging.Info("QR2", "Updated open host value for login on profileID", aurora.Cyan(profileID), "to", aurora.Cyan(strconv.FormatBool(openHost)))
|
||||
}
|
||||
|
||||
func Logout(profileID uint32) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user