mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-24 21:46:07 +00:00
feat(inbounds): row action to delete all clients of an inbound
Adds POST /panel/api/inbounds/:id/delAllClients that collects every client email from settings.clients[] and runs ClientService.BulkDelete in one pass. Row action lives in the More menu as a danger item, only shown for multi-user inbounds that currently have at least one client; confirmation modal displays the live client count.
This commit is contained in:
@@ -2415,6 +2415,27 @@ func (s *InboundService) ResetInboundTraffic(id int) error {
|
||||
})
|
||||
}
|
||||
|
||||
// EmailsByInbound returns the list of client emails currently configured on
|
||||
// an inbound's settings.clients[]. Used by the "delete all clients" flow on
|
||||
// the inbounds page, which then feeds the list into ClientService.BulkDelete.
|
||||
func (s *InboundService) EmailsByInbound(inboundId int) ([]string, error) {
|
||||
inbound, err := s.GetInbound(inboundId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
clients, err := s.GetClients(inbound)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
emails := make([]string, 0, len(clients))
|
||||
for _, c := range clients {
|
||||
if e := strings.TrimSpace(c.Email); e != "" {
|
||||
emails = append(emails, e)
|
||||
}
|
||||
}
|
||||
return emails, nil
|
||||
}
|
||||
|
||||
func (s *InboundService) DelDepletedClients(id int) (err error) {
|
||||
db := database.GetDB()
|
||||
tx := db.Begin()
|
||||
|
||||
Reference in New Issue
Block a user