浏览代码

[api] online users

Co-Authored-By: Alireza Ahmadi <[email protected]>
MHSanaei 1 年之前
父节点
当前提交
4d3bea48e1
共有 3 个文件被更改,包括 8 次插入1 次删除
  1. 1 0
      README.md
  2. 6 0
      web/controller/api.go
  3. 1 1
      web/web.go

+ 1 - 0
README.md

@@ -311,6 +311,7 @@ Enter the user ID in input field number 4. The Telegram accounts with this id wi
 | `POST` | `"/resetAllTraffics"`              | Reset traffics of all inbounds              |
 | `POST` | `"/resetAllClientTraffics/:id"`    | Reset traffics of all clients in an inbound |
 | `POST` | `"/delDepletedClients/:id"`        | Delete inbound depleted clients (-1: all)   |
+| `POST` | `"/onlines"`                       | Get Online users ( list of emails )       |
 
 \*- The field `clientId` should be filled by:
 

+ 6 - 0
web/controller/api.go

@@ -38,6 +38,8 @@ func (a *APIController) initRouter(g *gin.RouterGroup) {
 	g.POST("/resetAllClientTraffics/:id", a.resetAllClientTraffics)
 	g.POST("/delDepletedClients/:id", a.delDepletedClients)
 	g.GET("/createbackup", a.createBackup)
+	g.POST("/onlines", a.onlines)
+
 	a.inboundController = NewInboundController(g)
 }
 
@@ -104,3 +106,7 @@ func (a *APIController) delDepletedClients(c *gin.Context) {
 func (a *APIController) createBackup(c *gin.Context) {
 	a.Tgbot.SendBackupToAdmins()
 }
+
+func (a *APIController) onlines(c *gin.Context) {
+	a.inboundController.onlines(c)
+}

+ 1 - 1
web/web.go

@@ -175,7 +175,7 @@ func (s *Server) initRouter() (*gin.Engine, error) {
 	if err != nil {
 		return nil, err
 	}
-	engine.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{basePath + "xui/API/"})))
+	engine.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{basePath + "panel/API/"})))
 	assetsBasePath := basePath + "assets/"
 
 	store := cookie.NewStore(secret)