From 2f36a4047c7c32ca17aaea8875bb5c087430b40d Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 10 Sep 2025 16:36:12 +0200 Subject: API: delClientByEmail --- web/controller/inbound.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'web/controller') diff --git a/web/controller/inbound.go b/web/controller/inbound.go index 10a58daa..8d610e7d 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -46,6 +46,7 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) { g.POST("/onlines", a.onlines) g.POST("/lastOnline", a.lastOnline) g.POST("/updateClientTraffic/:email", a.updateClientTraffic) + g.POST("/:id/delClientByEmail/:email", a.delInboundClientByEmail) } func (a *InboundController) getInbounds(c *gin.Context) { @@ -374,3 +375,23 @@ func (a *InboundController) updateClientTraffic(c *gin.Context) { jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil) } + +func (a *InboundController) delInboundClientByEmail(c *gin.Context) { + inboundId, err := strconv.Atoi(c.Param("id")) + if err != nil { + jsonMsg(c, "Invalid inbound ID", err) + return + } + + email := c.Param("email") + needRestart, err := a.inboundService.DelInboundClientByEmail(inboundId, email) + if err != nil { + jsonMsg(c, "Failed to delete client by email", err) + return + } + + jsonMsg(c, "Client deleted successfully", nil) + if needRestart { + a.xrayService.SetToNeedRestart() + } +} -- cgit v1.2.3