[PR #3407] [MERGED] feat: Simple periodic traffic reset (for Inbounds) – daily | weekly | monthly #5411

Closed
opened 2026-10-31 20:46:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/3407
Author: @egregors
Created: 8/31/2025
Status: ✅ Merged
Merged: 9/16/2025
Merged by: @MHSanaei

Base: main ← Head: periodic-traffic-reset


📝 Commits (10+)

  • cad0074 Add periodic traffic reset feature model and ui with localization support
  • d132ff8 Remove periodic traffic reset fields from client
  • 3407c67 Merge remote-tracking branch 'origin/main' into periodic-traffic-reset
  • 283aa52 fix: add periodicTrafficReset field to inbound data structure
  • 8484945 feat: implement periodic traffic reset job and integrate with cron scheduler
  • 4ff0d56 feat: enhance periodic traffic reset functionality with scheduling and inbound filtering
  • a7f4602 Merge branch 'main' into periodic-traffic-reset
  • c418e99 refactor: rename periodicTrafficReset to trafficReset and add lastTrafficResetTime field
  • 7d75cfc Merge branch 'periodic-traffic-reset' of https://github.com/egregors/3x-ui into periodic-traffic-reset
  • 10d57d9 feat: add periodic client traffic reset job and schedule tasks

📊 Changes

20 files changed (+269 additions, -22 deletions)

View changed files

📝 database/model/model.go (+12 -10)
📝 web/assets/js/model/dbinbound.js (+2 -0)
📝 web/html/form/inbound.html (+24 -0)
📝 web/html/inbounds.html (+12 -0)
➕ web/job/periodic_traffic_reset_job.go (+44 -0)
📝 web/service/inbound.go (+44 -11)
📝 web/translation/translate.ar_EG.toml (+9 -0)
📝 web/translation/translate.en_US.toml (+9 -0)
📝 web/translation/translate.es_ES.toml (+9 -0)
📝 web/translation/translate.fa_IR.toml (+10 -1)
📝 web/translation/translate.id_ID.toml (+9 -0)
📝 web/translation/translate.ja_JP.toml (+9 -0)
📝 web/translation/translate.pt_BR.toml (+9 -0)
📝 web/translation/translate.ru_RU.toml (+9 -0)
📝 web/translation/translate.tr_TR.toml (+9 -0)
📝 web/translation/translate.uk_UA.toml (+9 -0)
📝 web/translation/translate.vi_VN.toml (+9 -0)
📝 web/translation/translate.zh_CN.toml (+9 -0)
📝 web/translation/translate.zh_TW.toml (+9 -0)
📝 web/web.go (+13 -0)

📄 Description

What is the pull request?

This PR adds a possibility to set periodic traffic reset option in order to reset traffic counter every day | week | month.
The implementation is pretty straightforward, but in general able to be extended for more periods variants.
Traffic reset right now supports only for Inbounds.

My motivation is my own use cases and this issue

What I have done:

  • add new field into Inbounds model + index
  • add new field into UI add | edit Inbounds (check screenshot out), by default – never
  • add job (every day | week | month) to check if we need to reset traffic counter
  • localizations

Which part of the application is affected by the change?

  • Frontend
  • Backend

Type of Changes

  • Bug fix
  • New feature
  • Refactoring
  • Other

Screenshots

grafik

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/3407 **Author:** [@egregors](https://github.com/egregors) **Created:** 8/31/2025 **Status:** ✅ Merged **Merged:** 9/16/2025 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `periodic-traffic-reset` --- ### 📝 Commits (10+) - [`cad0074`](https://github.com/MHSanaei/3x-ui/commit/cad007455796c4afcb1e1e3b4e5800cccafe890c) Add periodic traffic reset feature model and ui with localization support - [`d132ff8`](https://github.com/MHSanaei/3x-ui/commit/d132ff8839d1bab2ac2a22fadf57cdf9ed666f72) Remove periodic traffic reset fields from client - [`3407c67`](https://github.com/MHSanaei/3x-ui/commit/3407c67a68e1c07bb51773943fc124b48cc7d72b) Merge remote-tracking branch 'origin/main' into periodic-traffic-reset - [`283aa52`](https://github.com/MHSanaei/3x-ui/commit/283aa528ebeef52df5603e4383ea6d2689d2575f) fix: add periodicTrafficReset field to inbound data structure - [`8484945`](https://github.com/MHSanaei/3x-ui/commit/8484945bb22b1236e01f6369bb1e153696f11c59) feat: implement periodic traffic reset job and integrate with cron scheduler - [`4ff0d56`](https://github.com/MHSanaei/3x-ui/commit/4ff0d56e8a9d604ab3cd99fc3595957f7aca0112) feat: enhance periodic traffic reset functionality with scheduling and inbound filtering - [`a7f4602`](https://github.com/MHSanaei/3x-ui/commit/a7f460213d024043cb0ca6c0e22d730843b9337b) Merge branch 'main' into periodic-traffic-reset - [`c418e99`](https://github.com/MHSanaei/3x-ui/commit/c418e992ca551cc3d82745e6bf35a73b8ebf394e) refactor: rename periodicTrafficReset to trafficReset and add lastTrafficResetTime field - [`7d75cfc`](https://github.com/MHSanaei/3x-ui/commit/7d75cfc947cdb6ed727182453eaecc03e9039af8) Merge branch 'periodic-traffic-reset' of https://github.com/egregors/3x-ui into periodic-traffic-reset - [`10d57d9`](https://github.com/MHSanaei/3x-ui/commit/10d57d9502266925cf622483cfdbf5134bc7c2ec) feat: add periodic client traffic reset job and schedule tasks ### 📊 Changes **20 files changed** (+269 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `database/model/model.go` (+12 -10) 📝 `web/assets/js/model/dbinbound.js` (+2 -0) 📝 `web/html/form/inbound.html` (+24 -0) 📝 `web/html/inbounds.html` (+12 -0) ➕ `web/job/periodic_traffic_reset_job.go` (+44 -0) 📝 `web/service/inbound.go` (+44 -11) 📝 `web/translation/translate.ar_EG.toml` (+9 -0) 📝 `web/translation/translate.en_US.toml` (+9 -0) 📝 `web/translation/translate.es_ES.toml` (+9 -0) 📝 `web/translation/translate.fa_IR.toml` (+10 -1) 📝 `web/translation/translate.id_ID.toml` (+9 -0) 📝 `web/translation/translate.ja_JP.toml` (+9 -0) 📝 `web/translation/translate.pt_BR.toml` (+9 -0) 📝 `web/translation/translate.ru_RU.toml` (+9 -0) 📝 `web/translation/translate.tr_TR.toml` (+9 -0) 📝 `web/translation/translate.uk_UA.toml` (+9 -0) 📝 `web/translation/translate.vi_VN.toml` (+9 -0) 📝 `web/translation/translate.zh_CN.toml` (+9 -0) 📝 `web/translation/translate.zh_TW.toml` (+9 -0) 📝 `web/web.go` (+13 -0) </details> ### 📄 Description ## What is the pull request? This PR adds a possibility to set periodic traffic reset option in order to reset traffic counter every day | week | month. The implementation is pretty straightforward, but in general able to be extended for more periods variants. Traffic reset right now supports only for Inbounds. My motivation is my own use cases and [this issue](https://github.com/MHSanaei/3x-ui/issues/3127) What I have done: - add new field into Inbounds model + index - add new field into UI add | edit Inbounds (check screenshot out), by default – `never` - add job (every day | week | month) to check if we need to reset traffic counter - localizations ## Which part of the application is affected by the change? - [x] Frontend - [x] Backend ## Type of Changes - [ ] Bug fix - [x] New feature - [ ] Refactoring - [ ] Other ## Screenshots <img width="745" height="734" alt="grafik" src="https://github.com/user-attachments/assets/41acb802-ca85-4375-b9b9-718cb3b3f033" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 20:46:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5411
No description provided.