mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6106] [Feature]: Support calendar-based monthly Auto Renew for clients #4220
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#4220
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 @JacktheRanger on GitHub (Jul 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6106
Is your feature request related to a problem?
Client Auto Renew currently accepts only a fixed interval in days. A value such as 30 creates a rolling 30-day cycle anchored to the client's expiry time, so it drifts relative to calendar-month billing cycles because months have 28, 29, 30, or 31 days.
Related to #6071 and #3462. #6071 adds a configurable day-of-month for inbound traffic resets, but it does not change the per-client Auto Renew schedule or advance client expiry dates on a calendar boundary.
Describe the solution you'd like
Add a calendar-based renewal mode to each client's Auto Renew setting while keeping the current interval-days mode for backward compatibility.
Suggested behavior:
Interval (days)orCalendar monthly.Calendar monthly, configure a renewal day from 1 to 31 and use the panel's configured time zone.Alternatives you've considered
Traffic Reset = Monthly: this resets traffic counters, but it does not provide calendar-based per-client expiry renewal.Concrete use case
A server or provider plan resets its monthly allowance on the first day of each calendar month at 00:00 UTC. Clients are assigned monthly traffic quotas and should start a fresh quota/expiry window on that same boundary.
With Auto Renew set to 30 days, a client renewed on August 1 would renew on August 31, then September 30, and continue drifting away from the provider's billing cycle. A calendar-month mode with renewal day 1 and the panel time zone set to UTC would keep the client lifecycle aligned.
Mockups, screenshots, or examples
Example client form:
This complements #6071: that PR schedules inbound traffic resets by day of month, while this request applies calendar scheduling to each client's Auto Renew lifecycle.
Which parts of the panel would this affect?
Frontend (UI / panel pages), Backend (API endpoints, login, settings), Statistics / traffic counters, Database / migrations, Multi-node (sub-nodes)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jul 26, 2026):
Confirmed against the source: client Auto Renew is purely interval-based today, and there is no calendar-month mode.
What the code does now:
reset, an integer number of days (internal/database/model/model.go:821, UI labelAuto Renew (days)ininternal/web/translation/en-US.json:776).autoRenewClients(internal/web/service/inbound_traffic.go:290), called fromAddTraffic(line 56), which runs on the@every 5straffic poll (cadenceXrayTraffic,internal/web/web.go:289).internal/web/service/inbound_traffic.go:377-380. 86400000 ms is one fixed day, so nothing in this path is calendar-aware.Two of the behaviors on your list already exist in interval mode and would carry over to a calendar mode:
reset > 0 and expiry_time > 0 and expiry_time <= ?(line 302), and the loop leaves expiry in the future, so the row is not picked up again.A panel time zone also already exists and is honored by the scheduler: the
timeLocationsetting (defaultLocal,internal/web/service/setting.go:69, read byGetTimeLocationat line 699) is passed to the cron scheduler ascron.WithLocation(loc)(internal/web/web.go:494-495). Setting it toUTCin panel settings is what your example would need.Your assessment of the alternatives is accurate. Inbound
Traffic Reset = monthlyis registered as@monthly(internal/web/web.go:353) andResetAllClientTrafficssetsenable = true, up = 0, down = 0(internal/web/service/client_traffic.go:166-168) but never writesexpiry_time, so a client that is past its expiry is disabled again on the next poll bydisableInvalidClients(depleted clause atinternal/web/service/inbound_traffic.go:757). That is a counter reset, not a lifecycle renewal.Two scope points worth recording for whoever picks this up:
autoRenewClientsdeliberately renews only clients with at least one local inbound (i.node_id IS NULL, line 307); node-hosted clients renew on the node's own panel and are merged back throughnodeClientRenewed(internal/web/service/inbound_node.go:804). Any new mode/day fields would have to travel in the node sync payload, or master and node would compute different boundaries.resetis a single integer column, so a mode plus a day-of-month needs a migration ininternal/database/db.go, regenerated API schemas, and the new i18n keys added to all 13 files ininternal/web/translation/.This is not a duplicate of #3462 or PR #6071 — both target counter resets on a day of month, while this targets per-client expiry advancement — so it stays open as a separate request. #5804 touches the same
resetfield and may be worth designing alongside it. Labeled as a new feature; scheduling is the maintainer's call, and I cannot commit to whether or when it will be implemented.This reply was generated automatically. A maintainer may follow up.
@babaproyqgmuroe-arch commented on GitHub (Aug 15, 2026):
Auto Renew mode: [Interval (days) | Calendar monthly]
Renewal day: [1]
Time zone: Panel time zone (UTC)