From 3c933703610314318914ba2e991524635899b257 Mon Sep 17 00:00:00 2001 From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:16:44 +0200 Subject: [PATCH 1/2] fixed backup manager not restoring to correct dir --- src/backupmgr/backuphttp.go | 3 +++ src/backupmgr/restore.go | 7 ++++++- src/config/config.go | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backupmgr/backuphttp.go b/src/backupmgr/backuphttp.go index e2d186a3..4929d886 100644 --- a/src/backupmgr/backuphttp.go +++ b/src/backupmgr/backuphttp.go @@ -6,6 +6,8 @@ import ( "net/http" "strconv" "strings" + + "github.com/JacksonTheMaster/StationeersServerUI/v5/src/logger" ) // HTTPHandler provides HTTP endpoints for backup operations @@ -65,6 +67,7 @@ func (h *HTTPHandler) ListBackupsHandler(w http.ResponseWriter, r *http.Request) // RestoreBackupHandler handles requests to restore a backup func (h *HTTPHandler) RestoreBackupHandler(w http.ResponseWriter, r *http.Request) { + logger.Web.Debug("Received restore request") indexStr := r.URL.Query().Get("index") if indexStr == "" { http.Error(w, "index parameter is required", http.StatusBadRequest) diff --git a/src/backupmgr/restore.go b/src/backupmgr/restore.go index b3bfb9f9..089bea2f 100644 --- a/src/backupmgr/restore.go +++ b/src/backupmgr/restore.go @@ -4,12 +4,16 @@ import ( "fmt" "os" "path/filepath" + + "github.com/JacksonTheMaster/StationeersServerUI/v5/src/config" + "github.com/JacksonTheMaster/StationeersServerUI/v5/src/logger" ) // RestoreBackup restores a backup with the given index func (m *BackupManager) RestoreBackup(index int) error { m.mu.Lock() defer m.mu.Unlock() + logger.Backup.Info("Restoring backup with index " + fmt.Sprintf("%d", index)) files := []struct { backupName string @@ -25,7 +29,7 @@ func (m *BackupManager) RestoreBackup(index int) error { for _, file := range files { backupFile := filepath.Join(m.config.SafeBackupDir, file.backupName) - destFile := filepath.Join(m.config.BackupDir, file.destName) + destFile := filepath.Join("./saves/"+config.WorldName, file.destName) if err := copyFile(backupFile, destFile); err != nil { // Try alternative name @@ -38,6 +42,7 @@ func (m *BackupManager) RestoreBackup(index int) error { } restoredFiles[destFile] = backupFile } + logger.Backup.Debug(fmt.Sprintf("%v", restoredFiles)) return nil } diff --git a/src/config/config.go b/src/config/config.go index 3439a93f..4a7bc5d4 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -11,7 +11,7 @@ import ( var ( // All configuration variables can be found in vars.go - Version = "5.4.33" + Version = "5.4.34" Branch = "release" ) From a44b56d9edc569958b1f0f604472a6f646cc47a6 Mon Sep 17 00:00:00 2001 From: JacksonTheMaster <81807824+JacksonTheMaster@users.noreply.github.com> Date: Fri, 1 Aug 2025 15:18:43 +0200 Subject: [PATCH 2/2] corrected output name in build script --- build/build.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/build.go b/build/build.go index 30e39b47..1f289198 100644 --- a/build/build.go +++ b/build/build.go @@ -62,9 +62,9 @@ func main() { // Prepare the output file name with the new version, branch, and platform var outputName string if config.Branch == "release" { - outputName = fmt.Sprintf("StationeersServerControl%s", newVersion) + outputName = fmt.Sprintf("StationeersServerControlv%s", newVersion) } else { - outputName = fmt.Sprintf("StationeersServerControl%s_%s", newVersion, config.Branch) + outputName = fmt.Sprintf("StationeersServerControlv%s_%s", newVersion, config.Branch) } // Append appropriate extension based on platform