Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/server.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/web/controller/server.go b/web/controller/server.go
index 2dd40a0a..673a96d8 100644
--- a/web/controller/server.go
+++ b/web/controller/server.go
@@ -34,6 +34,8 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
g.Use(a.checkLogin)
g.POST("/status", a.status)
g.POST("/getXrayVersion", a.getXrayVersion)
+ g.POST("/stopXrayService", a.stopXrayService)
+ g.POST("/restartXrayService", a.restartXrayService)
g.POST("/installXray/:version", a.installXray)
}
@@ -83,3 +85,23 @@ func (a *ServerController) installXray(c *gin.Context) {
err := a.serverService.UpdateXray(version)
jsonMsg(c, I18n(c, "install")+" xray", err)
}
+
+func (a *ServerController) stopXrayService(c *gin.Context) {
+ a.lastGetStatusTime = time.Now()
+ err := a.serverService.StopXrayService()
+ if err != nil {
+ jsonMsg(c, "", err)
+ return
+ }
+ jsonMsg(c, "Xray stoped",err)
+
+}
+func (a *ServerController) restartXrayService(c *gin.Context) {
+ err := a.serverService.RestartXrayService()
+ if err != nil {
+ jsonMsg(c, "", err)
+ return
+ }
+ jsonMsg(c, "Xray restarted",err)
+
+} \ No newline at end of file