From 76eb86a425f70d4025df8b2203c9a2ae80172dd7 Mon Sep 17 00:00:00 2001
From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com>
Date: Tue, 23 Sep 2025 03:54:00 +0200
Subject: [PATCH 1/4] this commit is a firstpass which addresses
htps://github.com/SteamServerUI/StationeersServerUI/pull/94#discussion_r2368759050
by reworking the SaveInfo field into two seperate fields. Initial testing
confirms desired functionality, though way more testing for backwards
compatibility and general functionality (also in preterrain) is required to
harden this. The localization also needs to be updated.
---
.../onboard_bundled/twoboxform/twoboxform.js | 14 ++-----
UIMod/onboard_bundled/ui/config.html | 14 ++++---
src/config/config.go | 40 ++++++++++++-------
src/config/getters.go | 14 ++++---
src/config/setters.go | 16 ++++++++
src/config/vars.go | 4 +-
src/core/loader/helpers.go | 6 +--
src/managers/backupmgr/backupinterface.go | 2 +-
src/managers/gamemgr/args.go | 9 +++--
src/web/TwoBoxForm.go | 40 ++++++++++++-------
src/web/configpage.go | 7 +++-
src/web/templatevars.go | 6 +++
12 files changed, 111 insertions(+), 61 deletions(-)
diff --git a/UIMod/onboard_bundled/twoboxform/twoboxform.js b/UIMod/onboard_bundled/twoboxform/twoboxform.js
index 57f2feb1..b8050c3e 100644
--- a/UIMod/onboard_bundled/twoboxform/twoboxform.js
+++ b/UIMod/onboard_bundled/twoboxform/twoboxform.js
@@ -136,28 +136,20 @@ document.addEventListener('DOMContentLoaded', () => {
[configField]: booleanToConfig(document.getElementById('primary-field').value)
});
- } else if (configField === "SaveInfo") {
- const primaryValue = document.getElementById('primary-field').value.trim();
- // If the world name contains a space, it's invalid
- if (primaryValue.includes(' ')) {
- showNotification('The world name cannot contain spaces!', 'error');
- hidePreloader();
- return; // Prevent submission
- }
+ } else if (configField === "WorldID") {
const secondaryValue = document.getElementById('secondary-field').value.trim();
if (secondaryValue === '' || secondaryValue === document.getElementById('secondary-field').placeholder) {
showNotification('Please select a world type!', 'error');
hidePreloader();
return; // Prevent submission
}
- const joinedValue = `${primaryValue} ${secondaryValue}`;
body = JSON.stringify({
- [configField]: joinedValue
+ [configField]: secondaryValue
});
} else if (configField === "gameBranch") {
const secondaryValue = document.getElementById('secondary-field').value.trim();
if (secondaryValue === '' || secondaryValue === document.getElementById('secondary-field').placeholder) {
- showNotification('Please select a world type!', 'error');
+ showNotification('Please select a branch!', 'error');
hidePreloader();
return; // Prevent submission
}
diff --git a/UIMod/onboard_bundled/ui/config.html b/UIMod/onboard_bundled/ui/config.html
index 64938633..9c82fe6c 100644
--- a/UIMod/onboard_bundled/ui/config.html
+++ b/UIMod/onboard_bundled/ui/config.html
@@ -76,11 +76,15 @@
{{.UIText_BasicServerSettings}}
+
+
diff --git a/src/config/config.go b/src/config/config.go
index f5c35304..a1c97c25 100644
--- a/src/config/config.go
+++ b/src/config/config.go
@@ -29,7 +29,9 @@ type JsonConfig struct {
GameBranch string `json:"gameBranch"`
GamePort string `json:"GamePort"`
ServerName string `json:"ServerName"`
- SaveInfo string `json:"SaveInfo"`
+ SaveInfo string `json:"SaveInfo"` // deprecated, kept for backwards compatibility
+ SaveName string `json:"SaveName"` // replaces SaveInfo
+ WorldID string `json:"WorldID"` // replaces SaveInfo
ServerMaxPlayers string `json:"ServerMaxPlayers"`
ServerPassword string `json:"ServerPassword"`
ServerAuthSecret string `json:"ServerAuthSecret"`
@@ -167,7 +169,9 @@ func applyConfig(cfg *JsonConfig) {
StartCondition = getString(cfg.StartCondition, "START_CONDITION", "")
StartLocation = getString(cfg.StartLocation, "START_LOCATION", "")
ServerName = getString(cfg.ServerName, "SERVER_NAME", "Stationeers Server UI")
- SaveInfo = getString(cfg.SaveInfo, "SAVE_INFO", "Vulcan Vulcan")
+ SaveInfo = getString(cfg.SaveInfo, "SAVE_INFO", "")
+ SaveName = getString(cfg.SaveName, "SAVE_NAME", "MyMapName")
+ WorldID = getString(cfg.WorldID, "WORLD_ID", "Lunar")
ServerMaxPlayers = getString(cfg.ServerMaxPlayers, "SERVER_MAX_PLAYERS", "6")
ServerPassword = getString(cfg.ServerPassword, "SERVER_PASSWORD", "")
ServerAuthSecret = getString(cfg.ServerAuthSecret, "SERVER_AUTH_SECRET", "")
@@ -202,7 +206,7 @@ func applyConfig(cfg *JsonConfig) {
ServerVisible = serverVisibleVal
cfg.ServerVisible = &serverVisibleVal
- useSteamP2PVal := getBool(cfg.UseSteamP2P, "USE_STEAM_P2P", true)
+ useSteamP2PVal := getBool(cfg.UseSteamP2P, "USE_STEAM_P2P", false)
UseSteamP2P = useSteamP2PVal
cfg.UseSteamP2P = &useSteamP2PVal
@@ -261,31 +265,37 @@ func applyConfig(cfg *JsonConfig) {
AutoStartServerOnStartup = autoStartServerOnStartupVal
cfg.AutoStartServerOnStartup = &autoStartServerOnStartupVal
- // Process SaveInfo
- parts := strings.Split(SaveInfo, " ")
- if len(parts) > 0 {
- WorldName = parts[0]
- }
- if len(parts) > 1 {
- BackupWorldName = parts[1]
+ // Process SaveInfo to maintain backwards compatibility with pre-5.6.6 SaveInfo field (deprecated)
+ if SaveInfo != "" {
+ parts := strings.Split(SaveInfo, " ")
+ if len(parts) > 0 {
+ SaveName = parts[0]
+ fmt.Println("SaveName: " + SaveName)
+ }
+ if len(parts) > 1 {
+ WorldID = parts[1]
+ fmt.Println("WorldID: " + WorldID)
+ }
}
// Set backup paths for old or new style saves
if IsNewTerrainAndSaveSystem {
// use new new style autosave folder
- ConfiguredBackupDir = filepath.Join("./saves/", WorldName, "autosave")
+ ConfiguredBackupDir = filepath.Join("./saves/", SaveName, "autosave")
} else {
// use old style Backups folder
- ConfiguredBackupDir = filepath.Join("./saves/", WorldName, "Backup")
+ ConfiguredBackupDir = filepath.Join("./saves/", SaveName, "Backup")
}
// use Safebackups folder either way.
- ConfiguredSafeBackupDir = filepath.Join("./saves/", WorldName, "Safebackups")
+ ConfiguredSafeBackupDir = filepath.Join("./saves/", SaveName, "Safebackups")
+
+ safeSaveConfig()
}
// use safeSaveConfig EXCLUSIVELY though setter functions
// M U S T be called while holding a lock on ConfigMu!
func safeSaveConfig() error {
-
+ fmt.Println("safeSaveConfig")
cfg := JsonConfig{
DiscordToken: DiscordToken,
ControlChannelID: ControlChannelID,
@@ -312,6 +322,8 @@ func safeSaveConfig() error {
StartLocation: StartLocation,
ServerName: ServerName,
SaveInfo: SaveInfo,
+ SaveName: SaveName,
+ WorldID: WorldID,
ServerMaxPlayers: ServerMaxPlayers,
ServerPassword: ServerPassword,
ServerAuthSecret: ServerAuthSecret,
diff --git a/src/config/getters.go b/src/config/getters.go
index e1683922..27067b83 100644
--- a/src/config/getters.go
+++ b/src/config/getters.go
@@ -145,22 +145,24 @@ func GetServerName() string {
return ServerName
}
-func GetSaveInfo() string {
+// special getter for backwards compatibility with SaveInfo
+func GetLegacySaveInfo() string {
ConfigMu.RLock()
defer ConfigMu.RUnlock()
- return SaveInfo
+ saveinfo := SaveName + ";" + WorldID
+ return saveinfo
}
-func GetWorldName() string {
+func GetSaveName() string {
ConfigMu.RLock()
defer ConfigMu.RUnlock()
- return WorldName
+ return SaveName
}
-func GetBackupWorldName() string {
+func GetWorldID() string {
ConfigMu.RLock()
defer ConfigMu.RUnlock()
- return BackupWorldName
+ return WorldID
}
func GetServerMaxPlayers() string {
diff --git a/src/config/setters.go b/src/config/setters.go
index 9928d5cc..58627abb 100644
--- a/src/config/setters.go
+++ b/src/config/setters.go
@@ -70,6 +70,22 @@ func SetNoSanityCheck(value bool) error {
return nil
}
+func SetSaveName(value string) error {
+ ConfigMu.Lock()
+ defer ConfigMu.Unlock()
+
+ SaveName = value
+ return nil
+}
+
+func SetWorldID(value string) error {
+ ConfigMu.Lock()
+ defer ConfigMu.Unlock()
+
+ WorldID = value
+ return nil
+}
+
// ALL SETTERS BELOW THIS LINE ARE UNUSED AT THE MOMENT
// ALL SETTERS BELOW THIS LINE ARE UNUSED AT THE MOMENT
// ALL SETTERS BELOW THIS LINE ARE UNUSED AT THE MOMENT
diff --git a/src/config/vars.go b/src/config/vars.go
index edcb3c1d..a2f3a507 100644
--- a/src/config/vars.go
+++ b/src/config/vars.go
@@ -32,9 +32,9 @@ var (
AdditionalParams string
UPNPEnabled bool
StartLocalHost bool
- WorldName string
- BackupWorldName string
SaveInfo string
+ SaveName string
+ WorldID string
SaveInterval string
AutoPauseServer bool
AutoSave bool
diff --git a/src/core/loader/helpers.go b/src/core/loader/helpers.go
index 2c636319..fccb5e1b 100644
--- a/src/core/loader/helpers.go
+++ b/src/core/loader/helpers.go
@@ -50,8 +50,8 @@ func PrintConfigDetails(logLevel ...string) {
server := map[string]string{
"GameBranch": config.GetGameBranch(),
"ServerName": config.GetServerName(),
- "WorldName": config.GetWorldName(),
- "BackupWorldName": config.GetBackupWorldName(),
+ "WorldName": config.GetSaveName(),
+ "BackupWorldName": config.GetWorldID(),
"ServerMaxPlayers": config.GetServerMaxPlayers(),
"GamePort": config.GetGamePort(),
"UpdatePort": config.GetUpdatePort(),
@@ -69,7 +69,7 @@ func PrintConfigDetails(logLevel ...string) {
"Difficulty": config.GetDifficulty(),
"StartCondition": config.GetStartCondition(),
"StartLocation": config.GetStartLocation(),
- "SaveInfo": config.GetSaveInfo(),
+ "SaveInfo": config.GetLegacySaveInfo(),
"IsNewTerrainAndSaveSystem": fmt.Sprintf("%v", config.GetIsNewTerrainAndSaveSystem()),
}
printSection("Server Configuration", server)
diff --git a/src/managers/backupmgr/backupinterface.go b/src/managers/backupmgr/backupinterface.go
index d2c99036..af8d857f 100644
--- a/src/managers/backupmgr/backupinterface.go
+++ b/src/managers/backupmgr/backupinterface.go
@@ -47,7 +47,7 @@ func RegisterHTTPHandler(handler *HTTPHandler) {
func GetBackupConfig() BackupConfig {
return BackupConfig{
- WorldName: config.GetWorldName(),
+ WorldName: config.GetSaveName(),
BackupDir: config.GetConfiguredBackupDir(),
SafeBackupDir: config.GetConfiguredSafeBackupDir(),
WaitTime: 30 * time.Second, // not sure why we are not using config.BackupWaitTime here, but ill not touch it in this commit (config rework)
diff --git a/src/managers/gamemgr/args.go b/src/managers/gamemgr/args.go
index 8b0bff6f..3ccba137 100644
--- a/src/managers/gamemgr/args.go
+++ b/src/managers/gamemgr/args.go
@@ -30,8 +30,8 @@ func buildCommandArgs() []string {
-startlocation (Optional, defaults to "DefaultStartLocation" if not provided.)
*/
{Flag: "-file", RequiresValue: false},
- {Flag: "start", Value: config.GetWorldName(), RequiresValue: true},
- {Flag: config.GetBackupWorldName(), RequiresValue: false},
+ {Flag: "start", Value: config.GetSaveName(), RequiresValue: true},
+ {Flag: config.GetWorldID(), RequiresValue: false},
{Flag: config.GetDifficulty(), RequiresValue: false, Condition: func() bool { return config.GetDifficulty() != "" }},
{Flag: config.GetStartCondition(), RequiresValue: false, Condition: func() bool { return config.GetStartCondition() != "" }},
{Flag: config.GetStartLocation(), RequiresValue: false, Condition: func() bool { return config.GetStartLocation() != "" }},
@@ -58,7 +58,7 @@ func buildCommandArgs() []string {
argOrder = []Arg{
{Flag: "-nographics", RequiresValue: false},
{Flag: "-batchmode", RequiresValue: false},
- {Flag: "-LOAD", Value: config.GetSaveInfo(), RequiresValue: true, NoQuote: true}, // LOAD has special handling because the gameserver expects 2 parameters
+ {Flag: "-LOAD", Value: config.GetLegacySaveInfo(), RequiresValue: true, NoQuote: true}, // LOAD has special handling because the gameserver expects 2 parameters
{Flag: "-logFile", Value: "./debug.log", Condition: func() bool { return runtime.GOOS == "linux" }, RequiresValue: true},
{Flag: "-settings", RequiresValue: false},
{Flag: "StartLocalHost", Value: strconv.FormatBool(config.GetStartLocalHost()), RequiresValue: true},
@@ -89,8 +89,9 @@ func buildCommandArgs() []string {
args = append(args, arg.Flag)
+ // handling of Legacy SaveInfo: Split on semicolon and add each part as a separate arg. This is a hack to continue to support the old saveinfo format for preterrain servers.
if arg.Flag == "-LOAD" && arg.Value != "" {
- parts := strings.SplitN(arg.Value, " ", 2)
+ parts := strings.SplitN(arg.Value, ";", 2)
for _, part := range parts {
if part != "" {
args = append(args, part)
diff --git a/src/web/TwoBoxForm.go b/src/web/TwoBoxForm.go
index 76695b3e..55073b07 100644
--- a/src/web/TwoBoxForm.go
+++ b/src/web/TwoBoxForm.go
@@ -171,22 +171,34 @@ func ServeTwoBoxFormTemplate(w http.ResponseWriter, r *http.Request) {
SubmitButtonText: localization.GetString("UIText_ServerName_SubmitButton"),
SkipButtonText: localization.GetString("UIText_ServerName_SkipButton"),
ConfigField: "ServerName",
- NextStep: "save_identifier",
+ NextStep: "save_name",
},
- "save_identifier": {
- ID: "save_identifier",
- Title: localization.GetString("UIText_SaveIdentifier_Title"),
- HeaderTitle: localization.GetString("UIText_SaveIdentifier_HeaderTitle"),
- StepMessage: localization.GetString("UIText_SaveIdentifier_StepMessage"),
- PrimaryPlaceholderText: localization.GetString("UIText_SaveIdentifier_PrimaryPlaceholder"),
- PrimaryLabel: localization.GetString("UIText_SaveIdentifier_PrimaryLabel"),
- SecondaryLabel: localization.GetString("UIText_SaveIdentifier_SecondaryLabel"),
+ "save_name": {
+ ID: "save_name",
+ Title: localization.GetString("UIText_SaveName_Title"),
+ HeaderTitle: localization.GetString("UIText_SaveName_HeaderTitle"),
+ StepMessage: localization.GetString("UIText_SaveName_StepMessage"),
+ PrimaryPlaceholderText: localization.GetString("UIText_SaveName_PrimaryPlaceholder"),
+ PrimaryLabel: localization.GetString("UIText_SaveName_PrimaryLabel"),
+ SecondaryLabel: "",
+ SecondaryLabelType: "hidden",
+ SubmitButtonText: localization.GetString("UIText_SaveName_SubmitButton"),
+ SkipButtonText: localization.GetString("UIText_SaveName_SkipButton"),
+ ConfigField: "SaveName",
+ NextStep: "world_id",
+ },
+ "world_id": {
+ ID: "world_id",
+ Title: localization.GetString("UIText_WorldID_Title"),
+ HeaderTitle: localization.GetString("UIText_WorldID_HeaderTitle"),
+ StepMessage: localization.GetString("UIText_WorldID_StepMessage"),
+ SecondaryLabel: localization.GetString("UIText_WorldID_SecondaryLabel"),
SecondaryLabelType: "dropdown",
- SecondaryPlaceholderText: localization.GetString("UIText_SaveIdentifier_SecondaryPlaceholder"),
+ SecondaryPlaceholderText: localization.GetString("UIText_WorldID_SecondaryPlaceholder"),
SecondaryOptions: worldOptions,
- SubmitButtonText: localization.GetString("UIText_SaveIdentifier_SubmitButton"),
- SkipButtonText: localization.GetString("UIText_SaveIdentifier_SkipButton"),
- ConfigField: "SaveInfo",
+ SubmitButtonText: localization.GetString("UIText_WorldID_SubmitButton"),
+ SkipButtonText: localization.GetString("UIText_WorldID_SkipButton"),
+ ConfigField: "WorldID",
NextStep: "max_players",
},
"max_players": {
@@ -366,7 +378,7 @@ func ServeTwoBoxFormTemplate(w http.ResponseWriter, r *http.Request) {
data.Step = "welcome"
}
stepOrder := []string{
- "welcome", "pls_read", "game_branch", "newterrain_and_savesystem", "server_name", "save_identifier", "max_players",
+ "welcome", "pls_read", "game_branch", "newterrain_and_savesystem", "server_name", "save_name", "world_id", "max_players",
"server_password",
"discord_enabled", "discord_token", "control_panel_channel", "save_channel",
"log_channel", "connection_list_channel", "status_channel", "control_channel",
diff --git a/src/web/configpage.go b/src/web/configpage.go
index 41853a2b..1a90205a 100644
--- a/src/web/configpage.go
+++ b/src/web/configpage.go
@@ -127,7 +127,8 @@ func ServeConfigPage(w http.ResponseWriter, r *http.Request) {
StartCondition: config.GetStartCondition(),
StartLocation: config.GetStartLocation(),
ServerName: config.GetServerName(),
- SaveInfo: config.GetSaveInfo(),
+ SaveInfo: config.GetLegacySaveInfo(),
+ WorldID: config.GetWorldID(),
ServerMaxPlayers: config.GetServerMaxPlayers(),
ServerPassword: config.GetServerPassword(),
ServerAuthSecret: config.GetServerAuthSecret(),
@@ -185,6 +186,10 @@ func ServeConfigPage(w http.ResponseWriter, r *http.Request) {
UIText_SaveFileName: localization.GetString("UIText_SaveFileName"),
UIText_SaveFileNameInfo: localization.GetString("UIText_SaveFileNameInfo"),
UIText_SaveFileNameUseWizzardButtonText: localization.GetString("UIText_SaveFileNameUseWizzardButtonText"),
+ UIText_SaveName: localization.GetString("UIText_SaveName"),
+ UIText_SaveNameInfo: localization.GetString("UIText_SaveNameInfo"),
+ UIText_WorldID: localization.GetString("UIText_WorldID"),
+ UIText_WorldIDInfo: localization.GetString("UIText_WorldIDInfo"),
UIText_MaxPlayers: localization.GetString("UIText_MaxPlayers"),
UIText_MaxPlayersInfo: localization.GetString("UIText_MaxPlayersInfo"),
UIText_ServerPassword: localization.GetString("UIText_ServerPassword"),
diff --git a/src/web/templatevars.go b/src/web/templatevars.go
index f0281fff..20f21394 100644
--- a/src/web/templatevars.go
+++ b/src/web/templatevars.go
@@ -41,6 +41,8 @@ type ConfigTemplateData struct {
StartLocation string
ServerName string
SaveInfo string
+ SaveName string
+ WorldID string
ServerMaxPlayers string
ServerPassword string
ServerAuthSecret string
@@ -97,6 +99,10 @@ type ConfigTemplateData struct {
UIText_SaveFileName string
UIText_SaveFileNameInfo string
UIText_SaveFileNameUseWizzardButtonText string
+ UIText_SaveName string
+ UIText_SaveNameInfo string
+ UIText_WorldID string
+ UIText_WorldIDInfo string
UIText_MaxPlayers string
UIText_MaxPlayersInfo string
UIText_ServerPassword string
From 0197a9b50edb649bd870ad64b42187cdb808eb8c Mon Sep 17 00:00:00 2001
From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com>
Date: Wed, 24 Sep 2025 02:28:11 +0200
Subject: [PATCH 2/4] added missing SaveName template var to config page
---
src/web/configpage.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/web/configpage.go b/src/web/configpage.go
index 1a90205a..90340314 100644
--- a/src/web/configpage.go
+++ b/src/web/configpage.go
@@ -127,6 +127,7 @@ func ServeConfigPage(w http.ResponseWriter, r *http.Request) {
StartCondition: config.GetStartCondition(),
StartLocation: config.GetStartLocation(),
ServerName: config.GetServerName(),
+ SaveName: config.GetSaveName(),
SaveInfo: config.GetLegacySaveInfo(),
WorldID: config.GetWorldID(),
ServerMaxPlayers: config.GetServerMaxPlayers(),
From c48568b5b23415fce495bf59fb55de1a22e09412 Mon Sep 17 00:00:00 2001
From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com>
Date: Wed, 24 Sep 2025 15:58:03 +0200
Subject: [PATCH 3/4] fully migrate the old SaveInfo field into new vars if
applicable and don't save SaveInfo back to config.json.
---
src/config/config.go | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/config/config.go b/src/config/config.go
index a1c97c25..5b1900fa 100644
--- a/src/config/config.go
+++ b/src/config/config.go
@@ -29,9 +29,9 @@ type JsonConfig struct {
GameBranch string `json:"gameBranch"`
GamePort string `json:"GamePort"`
ServerName string `json:"ServerName"`
- SaveInfo string `json:"SaveInfo"` // deprecated, kept for backwards compatibility
- SaveName string `json:"SaveName"` // replaces SaveInfo
- WorldID string `json:"WorldID"` // replaces SaveInfo
+ SaveInfo string `json:"SaveInfo,omitempty"` // deprecated, kept for backwards compatibility
+ SaveName string `json:"SaveName"` // replaces SaveInfo
+ WorldID string `json:"WorldID"` // replaces SaveInfo
ServerMaxPlayers string `json:"ServerMaxPlayers"`
ServerPassword string `json:"ServerPassword"`
ServerAuthSecret string `json:"ServerAuthSecret"`
@@ -169,7 +169,7 @@ func applyConfig(cfg *JsonConfig) {
StartCondition = getString(cfg.StartCondition, "START_CONDITION", "")
StartLocation = getString(cfg.StartLocation, "START_LOCATION", "")
ServerName = getString(cfg.ServerName, "SERVER_NAME", "Stationeers Server UI")
- SaveInfo = getString(cfg.SaveInfo, "SAVE_INFO", "")
+ SaveInfo = getString(cfg.SaveInfo, "SAVE_INFO", "") // deprecated, kept for backwards compatibility - if set, this gets migrated to SaveName and WorldID and the field is not written back to config.json
SaveName = getString(cfg.SaveName, "SAVE_NAME", "MyMapName")
WorldID = getString(cfg.WorldID, "WORLD_ID", "Lunar")
ServerMaxPlayers = getString(cfg.ServerMaxPlayers, "SERVER_MAX_PLAYERS", "6")
@@ -266,7 +266,7 @@ func applyConfig(cfg *JsonConfig) {
cfg.AutoStartServerOnStartup = &autoStartServerOnStartupVal
// Process SaveInfo to maintain backwards compatibility with pre-5.6.6 SaveInfo field (deprecated)
- if SaveInfo != "" {
+ if SaveInfo != "" && SaveName == "" && WorldID == "" {
parts := strings.Split(SaveInfo, " ")
if len(parts) > 0 {
SaveName = parts[0]
@@ -276,6 +276,7 @@ func applyConfig(cfg *JsonConfig) {
WorldID = parts[1]
fmt.Println("WorldID: " + WorldID)
}
+ cfg.SaveInfo = ""
}
// Set backup paths for old or new style saves
@@ -295,7 +296,6 @@ func applyConfig(cfg *JsonConfig) {
// use safeSaveConfig EXCLUSIVELY though setter functions
// M U S T be called while holding a lock on ConfigMu!
func safeSaveConfig() error {
- fmt.Println("safeSaveConfig")
cfg := JsonConfig{
DiscordToken: DiscordToken,
ControlChannelID: ControlChannelID,
@@ -321,7 +321,6 @@ func safeSaveConfig() error {
StartCondition: StartCondition,
StartLocation: StartLocation,
ServerName: ServerName,
- SaveInfo: SaveInfo,
SaveName: SaveName,
WorldID: WorldID,
ServerMaxPlayers: ServerMaxPlayers,
From 0249e458a62470d5f8b5ad7b06726d992f817348 Mon Sep 17 00:00:00 2001
From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com>
Date: Wed, 24 Sep 2025 16:13:02 +0200
Subject: [PATCH 4/4] remove unused vars from config page
---
src/web/configpage.go | 122 +++++++++++++++++++---------------------
src/web/templatevars.go | 122 +++++++++++++++++++---------------------
2 files changed, 118 insertions(+), 126 deletions(-)
diff --git a/src/web/configpage.go b/src/web/configpage.go
index 90340314..b711a1cd 100644
--- a/src/web/configpage.go
+++ b/src/web/configpage.go
@@ -128,7 +128,6 @@ func ServeConfigPage(w http.ResponseWriter, r *http.Request) {
StartLocation: config.GetStartLocation(),
ServerName: config.GetServerName(),
SaveName: config.GetSaveName(),
- SaveInfo: config.GetLegacySaveInfo(),
WorldID: config.GetWorldID(),
ServerMaxPlayers: config.GetServerMaxPlayers(),
ServerPassword: config.GetServerPassword(),
@@ -182,68 +181,65 @@ func ServeConfigPage(w http.ResponseWriter, r *http.Request) {
UIText_TerrainSettings: localization.GetString("UIText_TerrainSettings"),
UIText_BasicServerSettings: localization.GetString("UIText_BasicServerSettings"),
- UIText_ServerName: localization.GetString("UIText_ServerName"),
- UIText_ServerNameInfo: localization.GetString("UIText_ServerNameInfo"),
- UIText_SaveFileName: localization.GetString("UIText_SaveFileName"),
- UIText_SaveFileNameInfo: localization.GetString("UIText_SaveFileNameInfo"),
- UIText_SaveFileNameUseWizzardButtonText: localization.GetString("UIText_SaveFileNameUseWizzardButtonText"),
- UIText_SaveName: localization.GetString("UIText_SaveName"),
- UIText_SaveNameInfo: localization.GetString("UIText_SaveNameInfo"),
- UIText_WorldID: localization.GetString("UIText_WorldID"),
- UIText_WorldIDInfo: localization.GetString("UIText_WorldIDInfo"),
- UIText_MaxPlayers: localization.GetString("UIText_MaxPlayers"),
- UIText_MaxPlayersInfo: localization.GetString("UIText_MaxPlayersInfo"),
- UIText_ServerPassword: localization.GetString("UIText_ServerPassword"),
- UIText_ServerPasswordInfo: localization.GetString("UIText_ServerPasswordInfo"),
- UIText_AdminPassword: localization.GetString("UIText_AdminPassword"),
- UIText_AdminPasswordInfo: localization.GetString("UIText_AdminPasswordInfo"),
- UIText_AutoSave: localization.GetString("UIText_AutoSave"),
- UIText_AutoSaveInfo: localization.GetString("UIText_AutoSaveInfo"),
- UIText_SaveInterval: localization.GetString("UIText_SaveInterval"),
- UIText_SaveIntervalInfo: localization.GetString("UIText_SaveIntervalInfo"),
- UIText_AutoPauseServer: localization.GetString("UIText_AutoPauseServer"),
- UIText_AutoPauseServerInfo: localization.GetString("UIText_AutoPauseServerInfo"),
- UIText_NetworkConfiguration: localization.GetString("UIText_NetworkConfiguration"),
- UIText_GamePort: localization.GetString("UIText_GamePort"),
- UIText_GamePortInfo: localization.GetString("UIText_GamePortInfo"),
- UIText_UpdatePort: localization.GetString("UIText_UpdatePort"),
- UIText_UpdatePortInfo: localization.GetString("UIText_UpdatePortInfo"),
- UIText_UPNPEnabled: localization.GetString("UIText_UPNPEnabled"),
- UIText_UPNPEnabledInfo: localization.GetString("UIText_UPNPEnabledInfo"),
- UIText_LocalIpAddress: localization.GetString("UIText_LocalIpAddress"),
- UIText_LocalIpAddressInfo: localization.GetString("UIText_LocalIpAddressInfo"),
- UIText_StartLocalHost: localization.GetString("UIText_StartLocalHost"),
- UIText_StartLocalHostInfo: localization.GetString("UIText_StartLocalHostInfo"),
- UIText_ServerVisible: localization.GetString("UIText_ServerVisible"),
- UIText_ServerVisibleInfo: localization.GetString("UIText_ServerVisibleInfo"),
- UIText_UseSteamP2P: localization.GetString("UIText_UseSteamP2P"),
- UIText_UseSteamP2PInfo: localization.GetString("UIText_UseSteamP2PInfo"),
- UIText_AdvancedConfiguration: localization.GetString("UIText_AdvancedConfiguration"),
- UIText_ServerAuthSecret: localization.GetString("UIText_ServerAuthSecret"),
- UIText_ServerAuthSecretInfo: localization.GetString("UIText_ServerAuthSecretInfo"),
- UIText_ServerExePath: localization.GetString("UIText_ServerExePath"),
- UIText_ServerExePathInfo: localization.GetString("UIText_ServerExePathInfo"),
- UIText_ServerExePathInfo2: localization.GetString("UIText_ServerExePathInfo2"),
- UIText_AdditionalParams: localization.GetString("UIText_AdditionalParams"),
- UIText_AdditionalParamsInfo: localization.GetString("UIText_AdditionalParamsInfo"),
- UIText_AutoRestartServerTimer: localization.GetString("UIText_AutoRestartServerTimer"),
- UIText_AutoRestartServerTimerInfo: localization.GetString("UIText_AutoRestartServerTimerInfo"),
- UIText_GameBranch: localization.GetString("UIText_GameBranch"),
- UIText_GameBranchInfo: localization.GetString("UIText_GameBranchInfo"),
- UIText_TerrainSettingsHeader: localization.GetString("UIText_TerrainSettingsHeader"),
- UIText_TerrainWarning: localization.GetString("UIText_TerrainWarning"),
- UIText_UseNewTerrainAndSave: localization.GetString("UIText_UseNewTerrainAndSave"),
- UIText_UseNewTerrainAndSaveInfo: localization.GetString("UIText_UseNewTerrainAndSaveInfo"),
- UIText_Difficulty: localization.GetString("UIText_Difficulty"),
- UIText_DifficultyInfo: localization.GetString("UIText_DifficultyInfo"),
- UIText_StartCondition: localization.GetString("UIText_StartCondition"),
- UIText_StartConditionInfo: localization.GetString("UIText_StartConditionInfo"),
- UIText_StartLocation: localization.GetString("UIText_StartLocation"),
- UIText_StartLocationInfo: localization.GetString("UIText_StartLocationInfo"),
- UIText_AutoStartServerOnStartup: localization.GetString("UIText_AutoStartServerOnStartup"),
- UIText_AutoStartServerOnStartupInfo: localization.GetString("UIText_AutoStartServerOnStartupInfo"),
- UIText_AllowAutoGameServerUpdates: localization.GetString("UIText_AllowAutoGameServerUpdates"),
- UIText_AllowAutoGameServerUpdatesInfo: localization.GetString("UIText_AllowAutoGameServerUpdatesInfo"),
+ UIText_ServerName: localization.GetString("UIText_ServerName"),
+ UIText_ServerNameInfo: localization.GetString("UIText_ServerNameInfo"),
+ UIText_SaveName: localization.GetString("UIText_SaveName"),
+ UIText_SaveNameInfo: localization.GetString("UIText_SaveNameInfo"),
+ UIText_WorldID: localization.GetString("UIText_WorldID"),
+ UIText_WorldIDInfo: localization.GetString("UIText_WorldIDInfo"),
+ UIText_MaxPlayers: localization.GetString("UIText_MaxPlayers"),
+ UIText_MaxPlayersInfo: localization.GetString("UIText_MaxPlayersInfo"),
+ UIText_ServerPassword: localization.GetString("UIText_ServerPassword"),
+ UIText_ServerPasswordInfo: localization.GetString("UIText_ServerPasswordInfo"),
+ UIText_AdminPassword: localization.GetString("UIText_AdminPassword"),
+ UIText_AdminPasswordInfo: localization.GetString("UIText_AdminPasswordInfo"),
+ UIText_AutoSave: localization.GetString("UIText_AutoSave"),
+ UIText_AutoSaveInfo: localization.GetString("UIText_AutoSaveInfo"),
+ UIText_SaveInterval: localization.GetString("UIText_SaveInterval"),
+ UIText_SaveIntervalInfo: localization.GetString("UIText_SaveIntervalInfo"),
+ UIText_AutoPauseServer: localization.GetString("UIText_AutoPauseServer"),
+ UIText_AutoPauseServerInfo: localization.GetString("UIText_AutoPauseServerInfo"),
+ UIText_NetworkConfiguration: localization.GetString("UIText_NetworkConfiguration"),
+ UIText_GamePort: localization.GetString("UIText_GamePort"),
+ UIText_GamePortInfo: localization.GetString("UIText_GamePortInfo"),
+ UIText_UpdatePort: localization.GetString("UIText_UpdatePort"),
+ UIText_UpdatePortInfo: localization.GetString("UIText_UpdatePortInfo"),
+ UIText_UPNPEnabled: localization.GetString("UIText_UPNPEnabled"),
+ UIText_UPNPEnabledInfo: localization.GetString("UIText_UPNPEnabledInfo"),
+ UIText_LocalIpAddress: localization.GetString("UIText_LocalIpAddress"),
+ UIText_LocalIpAddressInfo: localization.GetString("UIText_LocalIpAddressInfo"),
+ UIText_StartLocalHost: localization.GetString("UIText_StartLocalHost"),
+ UIText_StartLocalHostInfo: localization.GetString("UIText_StartLocalHostInfo"),
+ UIText_ServerVisible: localization.GetString("UIText_ServerVisible"),
+ UIText_ServerVisibleInfo: localization.GetString("UIText_ServerVisibleInfo"),
+ UIText_UseSteamP2P: localization.GetString("UIText_UseSteamP2P"),
+ UIText_UseSteamP2PInfo: localization.GetString("UIText_UseSteamP2PInfo"),
+ UIText_AdvancedConfiguration: localization.GetString("UIText_AdvancedConfiguration"),
+ UIText_ServerAuthSecret: localization.GetString("UIText_ServerAuthSecret"),
+ UIText_ServerAuthSecretInfo: localization.GetString("UIText_ServerAuthSecretInfo"),
+ UIText_ServerExePath: localization.GetString("UIText_ServerExePath"),
+ UIText_ServerExePathInfo: localization.GetString("UIText_ServerExePathInfo"),
+ UIText_ServerExePathInfo2: localization.GetString("UIText_ServerExePathInfo2"),
+ UIText_AdditionalParams: localization.GetString("UIText_AdditionalParams"),
+ UIText_AdditionalParamsInfo: localization.GetString("UIText_AdditionalParamsInfo"),
+ UIText_AutoRestartServerTimer: localization.GetString("UIText_AutoRestartServerTimer"),
+ UIText_AutoRestartServerTimerInfo: localization.GetString("UIText_AutoRestartServerTimerInfo"),
+ UIText_GameBranch: localization.GetString("UIText_GameBranch"),
+ UIText_GameBranchInfo: localization.GetString("UIText_GameBranchInfo"),
+ UIText_TerrainSettingsHeader: localization.GetString("UIText_TerrainSettingsHeader"),
+ UIText_TerrainWarning: localization.GetString("UIText_TerrainWarning"),
+ UIText_UseNewTerrainAndSave: localization.GetString("UIText_UseNewTerrainAndSave"),
+ UIText_UseNewTerrainAndSaveInfo: localization.GetString("UIText_UseNewTerrainAndSaveInfo"),
+ UIText_Difficulty: localization.GetString("UIText_Difficulty"),
+ UIText_DifficultyInfo: localization.GetString("UIText_DifficultyInfo"),
+ UIText_StartCondition: localization.GetString("UIText_StartCondition"),
+ UIText_StartConditionInfo: localization.GetString("UIText_StartConditionInfo"),
+ UIText_StartLocation: localization.GetString("UIText_StartLocation"),
+ UIText_StartLocationInfo: localization.GetString("UIText_StartLocationInfo"),
+ UIText_AutoStartServerOnStartup: localization.GetString("UIText_AutoStartServerOnStartup"),
+ UIText_AutoStartServerOnStartupInfo: localization.GetString("UIText_AutoStartServerOnStartupInfo"),
+ UIText_AllowAutoGameServerUpdates: localization.GetString("UIText_AllowAutoGameServerUpdates"),
+ UIText_AllowAutoGameServerUpdatesInfo: localization.GetString("UIText_AllowAutoGameServerUpdatesInfo"),
UIText_DiscordIntegrationTitle: localization.GetString("UIText_DiscordIntegrationTitle"),
UIText_DiscordBotToken: localization.GetString("UIText_DiscordBotToken"),
diff --git a/src/web/templatevars.go b/src/web/templatevars.go
index 20f21394..6a36f2f2 100644
--- a/src/web/templatevars.go
+++ b/src/web/templatevars.go
@@ -40,7 +40,6 @@ type ConfigTemplateData struct {
StartCondition string
StartLocation string
ServerName string
- SaveInfo string
SaveName string
WorldID string
ServerMaxPlayers string
@@ -94,68 +93,65 @@ type ConfigTemplateData struct {
UIText_TerrainSettings string
UIText_BasicServerSettings string
- UIText_ServerName string
- UIText_ServerNameInfo string
- UIText_SaveFileName string
- UIText_SaveFileNameInfo string
- UIText_SaveFileNameUseWizzardButtonText string
- UIText_SaveName string
- UIText_SaveNameInfo string
- UIText_WorldID string
- UIText_WorldIDInfo string
- UIText_MaxPlayers string
- UIText_MaxPlayersInfo string
- UIText_ServerPassword string
- UIText_ServerPasswordInfo string
- UIText_AdminPassword string
- UIText_AdminPasswordInfo string
- UIText_AutoSave string
- UIText_AutoSaveInfo string
- UIText_SaveInterval string
- UIText_SaveIntervalInfo string
- UIText_AutoPauseServer string
- UIText_AutoPauseServerInfo string
- UIText_NetworkConfiguration string
- UIText_GamePort string
- UIText_GamePortInfo string
- UIText_UpdatePort string
- UIText_UpdatePortInfo string
- UIText_UPNPEnabled string
- UIText_UPNPEnabledInfo string
- UIText_LocalIpAddress string
- UIText_LocalIpAddressInfo string
- UIText_StartLocalHost string
- UIText_StartLocalHostInfo string
- UIText_ServerVisible string
- UIText_ServerVisibleInfo string
- UIText_UseSteamP2P string
- UIText_UseSteamP2PInfo string
- UIText_AdvancedConfiguration string
- UIText_ServerAuthSecret string
- UIText_ServerAuthSecretInfo string
- UIText_ServerExePath string
- UIText_ServerExePathInfo string
- UIText_ServerExePathInfo2 string
- UIText_AdditionalParams string
- UIText_AdditionalParamsInfo string
- UIText_AutoRestartServerTimer string
- UIText_AutoRestartServerTimerInfo string
- UIText_GameBranch string
- UIText_GameBranchInfo string
- UIText_TerrainSettingsHeader string
- UIText_TerrainWarning string
- UIText_UseNewTerrainAndSave string
- UIText_UseNewTerrainAndSaveInfo string
- UIText_Difficulty string
- UIText_DifficultyInfo string
- UIText_StartCondition string
- UIText_StartConditionInfo string
- UIText_StartLocation string
- UIText_StartLocationInfo string
- UIText_AutoStartServerOnStartup string
- UIText_AutoStartServerOnStartupInfo string
- UIText_AllowAutoGameServerUpdates string
- UIText_AllowAutoGameServerUpdatesInfo string
+ UIText_ServerName string
+ UIText_ServerNameInfo string
+ UIText_SaveName string
+ UIText_SaveNameInfo string
+ UIText_WorldID string
+ UIText_WorldIDInfo string
+ UIText_MaxPlayers string
+ UIText_MaxPlayersInfo string
+ UIText_ServerPassword string
+ UIText_ServerPasswordInfo string
+ UIText_AdminPassword string
+ UIText_AdminPasswordInfo string
+ UIText_AutoSave string
+ UIText_AutoSaveInfo string
+ UIText_SaveInterval string
+ UIText_SaveIntervalInfo string
+ UIText_AutoPauseServer string
+ UIText_AutoPauseServerInfo string
+ UIText_NetworkConfiguration string
+ UIText_GamePort string
+ UIText_GamePortInfo string
+ UIText_UpdatePort string
+ UIText_UpdatePortInfo string
+ UIText_UPNPEnabled string
+ UIText_UPNPEnabledInfo string
+ UIText_LocalIpAddress string
+ UIText_LocalIpAddressInfo string
+ UIText_StartLocalHost string
+ UIText_StartLocalHostInfo string
+ UIText_ServerVisible string
+ UIText_ServerVisibleInfo string
+ UIText_UseSteamP2P string
+ UIText_UseSteamP2PInfo string
+ UIText_AdvancedConfiguration string
+ UIText_ServerAuthSecret string
+ UIText_ServerAuthSecretInfo string
+ UIText_ServerExePath string
+ UIText_ServerExePathInfo string
+ UIText_ServerExePathInfo2 string
+ UIText_AdditionalParams string
+ UIText_AdditionalParamsInfo string
+ UIText_AutoRestartServerTimer string
+ UIText_AutoRestartServerTimerInfo string
+ UIText_GameBranch string
+ UIText_GameBranchInfo string
+ UIText_TerrainSettingsHeader string
+ UIText_TerrainWarning string
+ UIText_UseNewTerrainAndSave string
+ UIText_UseNewTerrainAndSaveInfo string
+ UIText_Difficulty string
+ UIText_DifficultyInfo string
+ UIText_StartCondition string
+ UIText_StartConditionInfo string
+ UIText_StartLocation string
+ UIText_StartLocationInfo string
+ UIText_AutoStartServerOnStartup string
+ UIText_AutoStartServerOnStartupInfo string
+ UIText_AllowAutoGameServerUpdates string
+ UIText_AllowAutoGameServerUpdatesInfo string
UIText_DiscordIntegrationTitle string
UIText_DiscordBotToken string