From 3087c1b123f426b7c1306ab634fb84e7943e4217 Mon Sep 17 00:00:00 2001 From: Ali Golzar <57574919+aliglzr@users.noreply.github.com> Date: Thu, 28 Aug 2025 02:40:50 +0330 Subject: [PATCH] Add all-time traffic for inbounds and clients (#3387) * feat(db): add allTime field to Inbound and ClientTraffic models * feat(inbound): increment all_time for inbounds and clients on traffic updates calculate correct all_time traffic on migrate command * feat(ui): show all-time traffic column for inbounds and its clients * i18n: add pages.inbounds.allTimeTraffic label across locales * Add All Time Traffic Usage in inbounds page top banner --- database/model/model.go | 1 + web/assets/js/model/dbinbound.js | 1 + web/html/component/aClientTable.html | 4 ++++ web/html/inbounds.html | 34 ++++++++++++++++++++++++---- web/service/inbound.go | 26 +++++++++++++++++++-- web/translation/translate.ar_EG.toml | 2 ++ web/translation/translate.en_US.toml | 2 ++ web/translation/translate.es_ES.toml | 2 ++ web/translation/translate.fa_IR.toml | 2 ++ web/translation/translate.id_ID.toml | 2 ++ web/translation/translate.ja_JP.toml | 2 ++ web/translation/translate.pt_BR.toml | 2 ++ web/translation/translate.ru_RU.toml | 2 ++ web/translation/translate.tr_TR.toml | 2 ++ web/translation/translate.uk_UA.toml | 2 ++ web/translation/translate.vi_VN.toml | 2 ++ web/translation/translate.zh_CN.toml | 2 ++ web/translation/translate.zh_TW.toml | 2 ++ xray/client_traffic.go | 1 + 19 files changed, 86 insertions(+), 7 deletions(-) diff --git a/database/model/model.go b/database/model/model.go index 86ab0487..62cfac41 100644 --- a/database/model/model.go +++ b/database/model/model.go @@ -32,6 +32,7 @@ type Inbound struct { Up int64 `json:"up" form:"up"` Down int64 `json:"down" form:"down"` Total int64 `json:"total" form:"total"` + AllTime int64 `json:"allTime" form:"allTime" gorm:"default:0"` Remark string `json:"remark" form:"remark"` Enable bool `json:"enable" form:"enable"` ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` diff --git a/web/assets/js/model/dbinbound.js b/web/assets/js/model/dbinbound.js index 45301ddd..acb62ce4 100644 --- a/web/assets/js/model/dbinbound.js +++ b/web/assets/js/model/dbinbound.js @@ -6,6 +6,7 @@ class DBInbound { this.up = 0; this.down = 0; this.total = 0; + this.allTime = 0; this.remark = ""; this.enable = true; this.expiryTime = 0; diff --git a/web/html/component/aClientTable.html b/web/html/component/aClientTable.html index 359e6e74..53ec27a3 100644 --- a/web/html/component/aClientTable.html +++ b/web/html/component/aClientTable.html @@ -98,6 +98,10 @@ + +