Cleaned up logic

This commit is contained in:
2022-05-25 15:48:06 -05:00
parent a8c5f0a1f0
commit e4cb23b58c
5 changed files with 74 additions and 28 deletions

View File

@@ -15,6 +15,7 @@ import (
var server_sig = make(chan int, 1)
var server_started = false
var server_process = exec.Command("xvfb-run", "-a", "wine", "/root/.wine/drive_c/vrisingserver/VRisingServer.exe")
func check(err error) {
if err != nil {
@@ -39,7 +40,7 @@ func update(c *gin.Context) {
if err != nil {
c.String(http.StatusBadRequest, err.Error())
} else {
c.String(http.StatusOK, out.String())
c.String(http.StatusOK, "Update Complete")
}
}
@@ -125,11 +126,6 @@ func configure(c *gin.Context) {
}
func doIt() {
server_process := exec.Command("xvfb-run", "-a", "wine", "/root/.wine/drive_c/vrisingserver/VRisingServer.exe")
var out bytes.Buffer
server_process.Stdout = &out
err := server_process.Start()
check(err)
@@ -162,3 +158,11 @@ func stopServer(c *gin.Context) {
c.String(http.StatusOK, "Already Stopped")
}
}
func serverRunning(c *gin.Context) {
if server_started {
c.String(http.StatusOK, "true")
} else {
c.String(http.StatusOK, "false")
}
}