-
Notifications
You must be signed in to change notification settings - Fork 2
Nightly2main 2025/10/10 #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ad98c69
fix: ensure run_bepinex.sh is removed only on Linux if it exists
mitoskalandiel c5b682b
This is attempt 2 to fix path traversal issues within steamcmd-helper…
mitoskalandiel 515a631
Merge pull request #109 from SteamServerUI/fix-rm_bepinex_win
JacksonTheMaster 8f467a5
Merge pull request #110 from SteamServerUI/fix-zipslips-round2
mitoskalandiel 760d805
Commit Server IP override
akirilov 1c350aa
Fix hardcoded IP
akirilov bb1ad40
refactored IsServerRunning checks to use a global setting instead of …
JacksonTheMaster bb2bd34
added an endpoint to get the server status
JacksonTheMaster ca16e0d
Apply suggestions from code review
akirilov cf95a31
adds the ability to add apikey- users with a 3 year token expiration …
JacksonTheMaster 13ef650
reflect runState in http code as well
JacksonTheMaster 5ef10ec
added a dedicated endpoint to request an APIKey
JacksonTheMaster c63caeb
Moving server advertiser to a separate goroutine in the backend init
akirilov 7b56418
Update logger for advertiser
akirilov 04a97c7
Remove unnecessary waits
akirilov 95afab3
Make the advertisement server a const
akirilov 57d0389
improve APIKey handling: support dynamic expiration duration (POST) a…
JacksonTheMaster e39b3bc
Merge Feat server advertisement (PR #112) from feat-server-advertisement
JacksonTheMaster 9b0d914
Merge branch 'nightly' into feat-monitoring-apikeys
JacksonTheMaster 38213fb
Merge pull request #114 from feat-monitoring-apikeys
JacksonTheMaster 69f66aa
Fix race condition in SSE handling
93977dc
Updated SSCM.dll - See SSCM project for details
akirilov 730a626
Updated SSCM.dll to optimize thread usage
akirilov d25a88d
Merge pull request #119 from SteamServerUI/fix-20250150-sscm-crash
mitoskalandiel d318caa
Merge pull request #117 from semoro/fix-sse-race
JacksonTheMaster 6b86786
Refactor Stationeers server ping endpoint var to use config getter an…
JacksonTheMaster 0c9fd94
update loader for maintainablity
JacksonTheMaster 7f20a99
re-add installer wait group
JacksonTheMaster c803430
improve advertiser loggin in cmdarg handling
JacksonTheMaster 0c0bcde
Update readme - fixes #124
JacksonTheMaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| package advertiser | ||
|
|
||
| import ( | ||
| "bytes" | ||
| "encoding/json" | ||
| "net/http" | ||
| "runtime" | ||
| "strconv" | ||
| "time" | ||
|
|
||
| "github.com/JacksonTheMaster/StationeersServerUI/v5/src/config" | ||
| "github.com/JacksonTheMaster/StationeersServerUI/v5/src/logger" | ||
| "github.com/JacksonTheMaster/StationeersServerUI/v5/src/managers/detectionmgr" | ||
| "github.com/JacksonTheMaster/StationeersServerUI/v5/src/managers/gamemgr" | ||
| ) | ||
|
|
||
| var StationeersAdvertisementEndpoint = config.GetStationeersServerPingEndpoint() | ||
|
|
||
| type ServerAdMessage struct { | ||
| SessionId int | ||
| Name string | ||
| Password bool | ||
| Version string | ||
| Address string | ||
| Port string | ||
| Players int | ||
| MaxPlayers int | ||
| Type int | ||
| } | ||
|
|
||
| type ServerAdResponse struct { | ||
| SessionId int | ||
| Status string | ||
| } | ||
|
|
||
| func StartAdvertiser() { | ||
| if config.GetServerVisible() { | ||
| logger.Advertiser.Warn("Server advertisement is enabled. Disable it in the config and restart SSUI to use manual advertisement. Skipping for now...") | ||
| return | ||
| } | ||
| go func() { | ||
| sessionId := -1 | ||
| for { | ||
| // Only advertise if we are running | ||
| if gamemgr.InternalIsServerRunning() { | ||
| // Get max players | ||
| maxplayers, err := strconv.Atoi(config.GetServerMaxPlayers()) | ||
| if err != nil { | ||
| logger.Advertiser.Errorf("ServerAdvertiser failed to convert max players number to int: %s", config.GetServerMaxPlayers()) | ||
| return | ||
| } | ||
| // Get connected players | ||
| detector := detectionmgr.GetDetector() | ||
| players := len(detectionmgr.GetPlayers(detector)) | ||
| // Get platform | ||
| platform := 0 | ||
| switch runtime.GOOS { | ||
| case "windows": | ||
| platform = 1 | ||
| case "linux": | ||
| platform = 2 | ||
| } | ||
| adMessage := ServerAdMessage{ | ||
| SessionId: sessionId, | ||
| Name: config.GetServerName(), | ||
| Password: config.GetServerPassword() != "", | ||
| Version: config.GetExtractedGameVersion(), | ||
| Address: config.GetOverrideAdvertisedIp(), | ||
| Port: config.GetGamePort(), | ||
| Players: players, | ||
| MaxPlayers: maxplayers, | ||
| Type: platform, | ||
| } | ||
| body, err := json.Marshal(adMessage) | ||
| if err != nil { | ||
| logger.Advertiser.Errorf("ServerAdvertiser failed to Serialize to JSON from native Go struct type: %v", err) | ||
| return | ||
| } | ||
| // Send advertisement | ||
| resp, err := http.Post(StationeersAdvertisementEndpoint, "application/json", bytes.NewBuffer(body)) | ||
| // Check for errors | ||
| if err != nil { | ||
| logger.Advertiser.Errorf("ServerAdvertiser failed to send request: %v", err) | ||
| return | ||
| } | ||
| defer resp.Body.Close() | ||
| // Check the status | ||
| if resp.StatusCode != 200 { | ||
| logger.Advertiser.Warnf("ServerAdvertiser received non-200 status: %d", resp.StatusCode) | ||
| } | ||
| // Read the response and update our sessionId if needed | ||
| adResponse := ServerAdResponse{} | ||
| err = json.NewDecoder(resp.Body).Decode(&adResponse) | ||
| if err != nil { | ||
| logger.Advertiser.Errorf("Failed to decode response body: %v", err) | ||
| return | ||
| } | ||
| if adResponse.Status != "Success" { | ||
| logger.Advertiser.Warnf("ServerAdvertiser received unexpected status: %s", adResponse.Status) | ||
| } | ||
| sessionId = adResponse.SessionId | ||
| } else { | ||
| // Reset sessionid for the next run | ||
| sessionId = -1 | ||
| } | ||
| // Sleep for 30 seconds to follow the standard advertisement timer | ||
| time.Sleep(30 * time.Second) | ||
| } | ||
| }() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akirilov the advertiser should be a singleton and wait on a channel / have some way of stopping it and possibly reloading it. The current implementation will advertise the wrong / default / previous server state (config settings) instead of reloading on config change.
Eg
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also then be added to loader.ReloadBackend()