mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5804] [Feature]: Add a maximum renewal count for client Auto Renew #4033
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4033
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jeef111111 on GitHub (Jul 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5804
Is your feature request related to a problem?
I manage some clients with fixed-term or prepaid plans.
Currently, the client field "Auto Renew (days)" is useful, but once it is enabled, the client keeps renewing indefinitely after expiration. This works for unlimited recurring plans, but it does not fit fixed packages.
For example:
The expected total service period should be:
30 initial days + 3 renewals × 30 days = 120 days total, approximately 4 months.
At the moment, 3X-UI can auto-renew the client repeatedly, but there is no built-in way to stop auto-renewal after a fixed number of renewal cycles.
Describe the solution you'd like
Please add an optional "Max Auto Renew Count" field for each client, next to the existing "Auto Renew (days)" field.
Suggested behavior:
Auto Renew (days) = 0:
Auto Renew (days) > 0 and Max Auto Renew Count is empty or 0:
Auto Renew (days) > 0 and Max Auto Renew Count > 0:
Example:
Expected timeline:
The existing auto-renew behavior should remain the same during each allowed renewal:
The new setting should only limit how many times this process can happen.
Suggested UI:
Suggested backend/API changes:
Alternatives you've considered
I considered manually disabling Auto Renew after several cycles, or setting a final expiry date manually. However, this is error-prone when managing many clients.
External scripts are also possible, but they duplicate logic that already exists in 3X-UI. Since the current Auto Renew logic already handles expiry extension and traffic reset, adding a renewal limit inside the panel would be more reliable and easier to maintain.
Concrete use case
A client buys a fixed 4-month package with monthly quota reset.
Configuration:
Expected result:
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Frontend (UI / panel pages), Backend (API endpoints, login, settings), Statistics / traffic counters, Database / migrations
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jul 5, 2026):
Confirmed: this feature does not exist today. There is no renewal-count tracking anywhere in the codebase.
What "Auto Renew (days)" actually does, confirmed in source:
Client.Reset(an int, in days) —internal/database/model/model.go:615. The UI label "Auto Renew (days)" and its description "(0 = disable)" are ininternal/web/translation/en-US.json:769-770.autoRenewClientsininternal/web/service/inbound_traffic.go:284-442, invoked fromaddTrafficLockedon every traffic-report cycle. It selectsclient_trafficsrows wherereset > 0 and expiry_time > 0 and expiry_time <= now, then for each one: (internal/web/service/inbound_traffic.go:371-374) — this is also the "catch-up" behavior you referenced: if the panel was offline across multiple periods, it keeps adding oneResetperiod at a time until the expiry is back in the future, then resetsUp/Downto 0 and re-enables the client if it was disabled.model.Client, not inmodel.ClientRecord(the DB-backed client row,internal/database/model/model.go:620-645), not inxray.ClientTraffic, and no such column in any migration ininternal/database/db.go. So todayReset > 0is unconditionally indefinite, exactly as described in the issue.I searched open/closed issues for prior requests along these lines and did not find an existing duplicate, so this is being tracked as a new request.
Implementing it as described would touch, at minimum:
model.Client/model.ClientRecord(new columns, e.g. renewal count fields, plus a migration ininternal/database/db.go),autoRenewClientsininternal/web/service/inbound_traffic.go(decrement/check remaining count, including making the catch-up loop consume one count per period as requested),frontend/src/pages/clients/and the corresponding Zod schema/generated types,frontend/src/pages/api-docs/endpoints.ts,internal/web/translation/.This is a reasonable, backward-compatible feature request (0/empty preserves current unlimited behavior), but it requires new implementation work across the backend, DB schema, and frontend — it is not something already available today.
This reply was generated automatically; a maintainer may follow up.