mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-09-20 16:56:35 +08:00
fix(client): refuse a bulk quota reduction that would fall to or below zero
BulkAdjust clamped a client's new traffic limit with max(total+addBytes, 0). Because 0 is the unlimited sentinel, reducing a client's quota by more than it had left silently granted that client unlimited traffic. The sibling expiry branch already refuses an over-reduction; mirror it for quota so the adjustment is skipped with a clear reason instead of crossing the sentinel.
This commit is contained in:
@@ -359,9 +359,15 @@ func (s *ClientService) BulkAdjust(inboundSvc *InboundService, emails []string,
|
||||
skippedReasons[email] = "unlimited traffic"
|
||||
}
|
||||
} else {
|
||||
next := max(rec.TotalGB+addBytes, 0)
|
||||
entry.applyTotal = true
|
||||
entry.newTotal = next
|
||||
next := rec.TotalGB + addBytes
|
||||
if next <= 0 {
|
||||
if _, exists := skippedReasons[email]; !exists {
|
||||
skippedReasons[email] = "reduction exceeds remaining quota"
|
||||
}
|
||||
} else {
|
||||
entry.applyTotal = true
|
||||
entry.newTotal = next
|
||||
}
|
||||
}
|
||||
}
|
||||
if entry.applyExpiry || entry.applyTotal || adjustFlow {
|
||||
|
||||
Reference in New Issue
Block a user