Added Status
This commit is contained in:
@@ -4,3 +4,4 @@ This tool allows for the simple configuration, backup, and starting of a V Risin
|
|||||||
- [x] Backup Saves
|
- [x] Backup Saves
|
||||||
- [x] Update
|
- [x] Update
|
||||||
- [x] Upload Config Files
|
- [x] Upload Config Files
|
||||||
|
- [x] Check if Server Runnning
|
||||||
18
handlers.go
18
handlers.go
@@ -120,3 +120,21 @@ func configure(c *gin.Context) {
|
|||||||
check(err)
|
check(err)
|
||||||
c.Data(http.StatusOK, "text/html", updated_page)
|
c.Data(http.StatusOK, "text/html", updated_page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isRunning(c *gin.Context) {
|
||||||
|
cmd := exec.Command("ps", "aux")
|
||||||
|
var out bytes.Buffer
|
||||||
|
cmd.Stdout = &out
|
||||||
|
|
||||||
|
err := cmd.Run()
|
||||||
|
check(err)
|
||||||
|
|
||||||
|
haystack := out.String()
|
||||||
|
var ret string
|
||||||
|
if strings.Contains(haystack, "VRisingServer.exe") {
|
||||||
|
ret = "true"
|
||||||
|
} else {
|
||||||
|
ret = "false"
|
||||||
|
}
|
||||||
|
c.String(http.StatusOK, ret, nil)
|
||||||
|
}
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -15,7 +15,6 @@ import (
|
|||||||
var indexHTML embed.FS
|
var indexHTML embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
//For General File Storage
|
//For General File Storage
|
||||||
os.MkdirAll("data", 0755)
|
os.MkdirAll("data", 0755)
|
||||||
|
|
||||||
@@ -23,6 +22,7 @@ func main() {
|
|||||||
|
|
||||||
r.GET("/", index)
|
r.GET("/", index)
|
||||||
r.GET("/api/update", update)
|
r.GET("/api/update", update)
|
||||||
|
r.GET("/api/status", isRunning)
|
||||||
r.GET("/backup.zip", backup)
|
r.GET("/backup.zip", backup)
|
||||||
r.POST("/configure", configure)
|
r.POST("/configure", configure)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user