Cleaned up logic
This commit is contained in:
16
handlers.go
16
handlers.go
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user