Compare commits
4 Commits
f660511b63
...
v0.10.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ab94de529 | ||
|
|
b3f89593fb | ||
|
|
2a863c51e9 | ||
|
|
a70d923a6a |
@@ -1,5 +1,7 @@
|
||||
package model
|
||||
|
||||
import "github.com/google/uuid"
|
||||
|
||||
type SessionCount struct {
|
||||
Name string `json:"name"`
|
||||
Count int `json:"count"`
|
||||
@@ -27,7 +29,7 @@ type StateHistoryStats struct {
|
||||
}
|
||||
|
||||
type RecentSession struct {
|
||||
ID uint `json:"id"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
Date string `json:"date"`
|
||||
Type string `json:"type"`
|
||||
Track string `json:"track"`
|
||||
|
||||
@@ -187,7 +187,7 @@ func (r *StateHistoryRepository) GetRecentSessions(ctx context.Context, filter *
|
||||
FROM state_histories
|
||||
WHERE server_id = ? AND date_created BETWEEN ? AND ?
|
||||
GROUP BY session_id
|
||||
HAVING COUNT(*) > 1 AND MAX(player_count) > 0
|
||||
HAVING MAX(player_count) > 0
|
||||
ORDER BY date DESC
|
||||
LIMIT 10
|
||||
`
|
||||
|
||||
@@ -35,15 +35,9 @@ func NewSteamService(repository *repository.SteamCredentialsRepository, tfaManag
|
||||
LogOutput: true,
|
||||
}
|
||||
|
||||
// Create a separate executor for SteamCMD that doesn't use PowerShell
|
||||
steamCMDExecutor := &command.CommandExecutor{
|
||||
ExePath: env.GetSteamCMDPath(),
|
||||
LogOutput: true,
|
||||
}
|
||||
|
||||
return &SteamService{
|
||||
executor: baseExecutor,
|
||||
interactiveExecutor: command.NewInteractiveCommandExecutor(steamCMDExecutor, tfaManager),
|
||||
interactiveExecutor: command.NewInteractiveCommandExecutor(baseExecutor, tfaManager),
|
||||
repository: repository,
|
||||
tfaManager: tfaManager,
|
||||
pathValidator: security.NewPathValidator(),
|
||||
@@ -127,27 +121,36 @@ func (s *SteamService) InstallServer(ctx context.Context, installPath string, se
|
||||
return fmt.Errorf("failed to get Steam credentials: %v", err)
|
||||
}
|
||||
|
||||
// Build SteamCMD command (no PowerShell args needed since we call SteamCMD directly)
|
||||
args := []string{
|
||||
// Get SteamCMD path from environment variable
|
||||
steamCMDPath := env.GetSteamCMDPath()
|
||||
|
||||
// Build SteamCMD command arguments
|
||||
steamCMDArgs := []string{
|
||||
"+force_install_dir", absPath,
|
||||
"+login",
|
||||
}
|
||||
|
||||
if creds != nil && creds.Username != "" {
|
||||
args = append(args, creds.Username)
|
||||
steamCMDArgs = append(steamCMDArgs, creds.Username)
|
||||
if creds.Password != "" {
|
||||
args = append(args, creds.Password)
|
||||
steamCMDArgs = append(steamCMDArgs, creds.Password)
|
||||
}
|
||||
} else {
|
||||
args = append(args, "anonymous")
|
||||
steamCMDArgs = append(steamCMDArgs, "anonymous")
|
||||
}
|
||||
|
||||
args = append(args,
|
||||
steamCMDArgs = append(steamCMDArgs,
|
||||
"+app_update", ACCServerAppID,
|
||||
"validate",
|
||||
"+quit",
|
||||
)
|
||||
|
||||
// Build PowerShell arguments to execute SteamCMD directly
|
||||
// This matches the format: powershell -nologo -noprofile c:\steamcmd\steamcmd.exe +args...
|
||||
args := []string{"-nologo", "-noprofile"}
|
||||
args = append(args, steamCMDPath)
|
||||
args = append(args, steamCMDArgs...)
|
||||
|
||||
// Use interactive executor to handle potential 2FA prompts with timeout
|
||||
logging.Info("Installing ACC server to %s...", absPath)
|
||||
|
||||
|
||||
@@ -360,7 +360,7 @@ func (m *MockStateHistoryRepository) GetRecentSessions(ctx context.Context, filt
|
||||
if maxPlayers > 0 {
|
||||
duration := int(maxDate.Sub(minDate).Minutes())
|
||||
recentSessions = append(recentSessions, model.RecentSession{
|
||||
ID: uint(count + 1),
|
||||
ID: entries[0].SessionID,
|
||||
Date: minDate.Format("2006-01-02 15:04:05"),
|
||||
Type: entries[0].Session,
|
||||
Track: entries[0].Track,
|
||||
|
||||
Reference in New Issue
Block a user