V Rising Daemon
+ + + +diff --git a/README.md b/README.md
index add917f..ff87c3b 100644
--- a/README.md
+++ b/README.md
@@ -3,4 +3,4 @@ This tool allows for the simple configuration, backup, and starting of a V Risin
- [x] Backup Saves
- [x] Update
-- [] Upload Config Files
\ No newline at end of file
+- [x] Upload Config Files
\ No newline at end of file
diff --git a/handlers.go b/handlers.go
index 8fc5ebc..8e57af7 100644
--- a/handlers.go
+++ b/handlers.go
@@ -41,21 +41,18 @@ func update(c *gin.Context) {
}
func RecursiveZip(pathToZip, destinationPath string) error {
-
- os.MkdirAll("data", 0755)
-
destinationFile, err := os.Create(destinationPath)
if err != nil {
return err
}
myZip := zip.NewWriter(destinationFile)
err = filepath.Walk(pathToZip, func(filePath string, info os.FileInfo, err error) error {
- if info.IsDir() {
- return nil
- }
if err != nil {
return err
}
+ if info.IsDir() {
+ return nil
+ }
relPath := strings.TrimPrefix(filePath, filepath.Dir(pathToZip))
zipFile, err := myZip.Create(relPath)
if err != nil {
@@ -84,10 +81,42 @@ func RecursiveZip(pathToZip, destinationPath string) error {
func backup(c *gin.Context) {
err := RecursiveZip("/root/.wine/drive_c/users/root/AppData/LocalLow/Stunlock Studios/VRisingServer/Saves", "data/backup.zip")
- check(err)
+ if err != nil {
+ c.String(http.StatusBadRequest, err.Error())
+ return
+ }
backup, err := os.ReadFile("data/backup.zip")
- check(err)
+ if err != nil {
+ c.String(http.StatusBadRequest, err.Error())
+ return
+ }
c.Data(http.StatusOK, "application/zip", backup)
}
+
+func configure(c *gin.Context) {
+ file, err := c.FormFile("ServerHostSettings.json")
+ if err == nil {
+ c.SaveUploadedFile(file, "data/ServerHostSettings.json")
+ }
+
+ file, err = c.FormFile("ServerGameSettings.json")
+ if err == nil {
+ c.SaveUploadedFile(file, "data/ServerGameSettings.json")
+ }
+
+ file, err = c.FormFile("adminlist.txt")
+ if err == nil {
+ c.SaveUploadedFile(file, "data/adminlist.txt")
+ }
+
+ file, err = c.FormFile("banlist.txt")
+ if err == nil {
+ c.SaveUploadedFile(file, "data/banlist.txt")
+ }
+
+ updated_page, err := indexHTML.ReadFile("html/updated.html")
+ check(err)
+ c.Data(http.StatusOK, "text/html", updated_page)
+}
diff --git a/html/index.html b/html/index.html
index 4291b18..b07610b 100644
--- a/html/index.html
+++ b/html/index.html
@@ -1,15 +1,513 @@
-
Why Hello There
- - - +V Rising Daemon
+ + + +