mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-14 16:46:07 +00:00
fix(client): match clients by email for delete/update, not credentials
Delete/update located the client in an inbound's settings JSON by the record's credential (uuid/password/auth). When that credential drifted from the inbound JSON -- e.g. a rotated UUID left behind, or duplicated by a past partial-update bug -- the lookup failed with "Client Not Found In Inbound For ID: <uuid>" and aborted the whole operation, making the client impossible to remove from the panel. Key every delete/update/detach path on email, the client's stable identity. This survives credential drift and heals duplicate-email entries by removing all of them. - Delete/DeleteByEmail/Detach/DetachByEmailMany -> DelInboundClientByEmail - delInboundClients / bulkDelInboundClients: match settings by email - UpdateInboundClient: locate the entry to replace by email (param clientId -> oldEmail); update all callers to pass the email - bulkAdjustInboundClients: match by email - writeBackClientSubID: pass email; drop unused sourceProtocol param - make per-inbound deletion idempotent via ErrClientNotInInbound - remove now-orphaned DelInboundClient, clientKeyForProtocol and getClientPrimaryKey; scale test deletes by email
This commit is contained in:
@@ -215,10 +215,10 @@ func TestAddDelClientPostgresScale(t *testing.T) {
|
||||
}
|
||||
addDur := time.Since(start)
|
||||
|
||||
delId := clients[n/2].ID
|
||||
delEmail := clients[n/2].Email
|
||||
start = time.Now()
|
||||
if _, err := svc.DelInboundClient(inboundSvc, ib.Id, delId, false); err != nil {
|
||||
t.Fatalf("DelInboundClient: %v", err)
|
||||
if _, err := svc.DelInboundClientByEmail(inboundSvc, ib.Id, delEmail, false); err != nil {
|
||||
t.Fatalf("DelInboundClientByEmail: %v", err)
|
||||
}
|
||||
delDur := time.Since(start)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user