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:
authorMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-03-24 16:44:26 +0300
committerMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-03-24 16:44:26 +0300
commit9c0718bc44037d6415bcf3bcb300de62c67ad782 (patch)
treec5abba4c47baa60a3e5c1274b211e92bde7090ae /web/controller
parent826c7264b5cbea4e4149645bef220fd3c6a010e7 (diff)
Revert "Add version and log"
This reverts commit 826c7264b5cbea4e4149645bef220fd3c6a010e7.
Diffstat (limited to 'web/controller')
-rw-r--r--web/controller/server.go21
1 files changed, 16 insertions, 5 deletions
diff --git a/web/controller/server.go b/web/controller/server.go
index 673a96d8..7b7239d5 100644
--- a/web/controller/server.go
+++ b/web/controller/server.go
@@ -1,10 +1,11 @@
package controller
import (
- "github.com/gin-gonic/gin"
"time"
"x-ui/web/global"
"x-ui/web/service"
+
+ "github.com/gin-gonic/gin"
)
type ServerController struct {
@@ -37,6 +38,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) {
g.POST("/stopXrayService", a.stopXrayService)
g.POST("/restartXrayService", a.restartXrayService)
g.POST("/installXray/:version", a.installXray)
+ g.POST("/logs", a.getLogs)
}
func (a *ServerController) refreshStatus() {
@@ -87,13 +89,13 @@ func (a *ServerController) installXray(c *gin.Context) {
}
func (a *ServerController) stopXrayService(c *gin.Context) {
- a.lastGetStatusTime = time.Now()
+ a.lastGetStatusTime = time.Now()
err := a.serverService.StopXrayService()
if err != nil {
jsonMsg(c, "", err)
return
}
- jsonMsg(c, "Xray stoped",err)
+ jsonMsg(c, "Xray stoped", err)
}
func (a *ServerController) restartXrayService(c *gin.Context) {
@@ -102,6 +104,15 @@ func (a *ServerController) restartXrayService(c *gin.Context) {
jsonMsg(c, "", err)
return
}
- jsonMsg(c, "Xray restarted",err)
+ jsonMsg(c, "Xray restarted", err)
+
+}
-} \ No newline at end of file
+func (a *ServerController) getLogs(c *gin.Context) {
+ logs, err := a.serverService.GetLogs()
+ if err != nil {
+ jsonMsg(c, I18n(c, "getLogs"), err)
+ return
+ }
+ jsonObj(c, logs, nil)
+}