Skip to content

Commit

Permalink
[api] online users
Browse files Browse the repository at this point in the history
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
  • Loading branch information
MHSanaei and alireza0 committed Dec 5, 2023
1 parent d8c509b commit 4d3bea4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 6 additions & 0 deletions web/controller/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d3bea4

Please sign in to comment.