From f315ed269e244e2bd66ed252924cd9892e05d617 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Sun, 17 May 2026 09:01:04 +0200 Subject: [PATCH] refactor(traffic): drop all-time traffic tracking Removes the AllTime field from Inbound and ClientTraffic and migrates existing DBs by dropping the all_time columns on startup. The counter duplicated up+down without adding signal, and the per-event accumulator ran on every traffic write. Frontend: drop the All-time column from the inbound list and the client-row table, the All-time row from the client info modal, and the All-Time Total Usage tile from the inbounds summary card. The allTimeTraffic/allTimeTrafficUsage i18n keys are removed across every locale. Co-Authored-By: Claude Opus 4.7 --- database/model/model.go | 1 - frontend/src/models/dbinbound.js | 1 - .../src/pages/clients/ClientInfoModal.vue | 7 -- .../src/pages/inbounds/ClientRowTable.vue | 22 ------- frontend/src/pages/inbounds/InboundList.vue | 11 ---- frontend/src/pages/inbounds/InboundsPage.vue | 9 --- frontend/src/pages/inbounds/useInbounds.js | 8 +-- web/service/inbound.go | 66 +++++++------------ web/translation/ar-EG.json | 2 - web/translation/en-US.json | 4 +- web/translation/es-ES.json | 2 - web/translation/fa-IR.json | 2 - web/translation/id-ID.json | 2 - web/translation/ja-JP.json | 2 - web/translation/pt-BR.json | 2 - web/translation/ru-RU.json | 2 - web/translation/tr-TR.json | 2 - web/translation/uk-UA.json | 2 - web/translation/vi-VN.json | 2 - web/translation/zh-CN.json | 2 - web/translation/zh-TW.json | 2 - xray/client_traffic.go | 1 - 22 files changed, 24 insertions(+), 130 deletions(-) diff --git a/database/model/model.go b/database/model/model.go index bc023508..d300c6cf 100644 --- a/database/model/model.go +++ b/database/model/model.go @@ -49,7 +49,6 @@ type Inbound struct { Up int64 `json:"up" form:"up"` // Upload traffic in bytes Down int64 `json:"down" form:"down"` // Download traffic in bytes Total int64 `json:"total" form:"total"` // Total traffic limit in bytes - AllTime int64 `json:"allTime" form:"allTime" gorm:"default:0"` // All-time traffic usage Remark string `json:"remark" form:"remark"` // Human-readable remark Enable bool `json:"enable" form:"enable" gorm:"index:idx_enable_traffic_reset,priority:1"` // Whether the inbound is enabled ExpiryTime int64 `json:"expiryTime" form:"expiryTime"` // Expiration timestamp diff --git a/frontend/src/models/dbinbound.js b/frontend/src/models/dbinbound.js index d7a9483e..7390edb9 100644 --- a/frontend/src/models/dbinbound.js +++ b/frontend/src/models/dbinbound.js @@ -10,7 +10,6 @@ export 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/frontend/src/pages/clients/ClientInfoModal.vue b/frontend/src/pages/clients/ClientInfoModal.vue index 5e9da4ec..d1151fff 100644 --- a/frontend/src/pages/clients/ClientInfoModal.vue +++ b/frontend/src/pages/clients/ClientInfoModal.vue @@ -203,13 +203,6 @@ function close() { - - {{ t('pages.inbounds.allTimeTraffic') || 'All-time' }} - - {{ SizeFormatter.sizeFormat(traffic?.allTime || used) }} - - - {{ t('pages.inbounds.expireDate') || 'Expiry' }} diff --git a/frontend/src/pages/inbounds/ClientRowTable.vue b/frontend/src/pages/inbounds/ClientRowTable.vue index e99953c1..5fdd2067 100644 --- a/frontend/src/pages/inbounds/ClientRowTable.vue +++ b/frontend/src/pages/inbounds/ClientRowTable.vue @@ -86,14 +86,6 @@ function getRem(email) { const r = s.total - s.up - s.down; return r > 0 ? r : 0; } -function getAllTime(email) { - const s = statsFor(email); - if (!s) return 0; - // allTime is the cumulative-historical counter; never let it dip - // below up+down (manual edits / partial migrations can push it under). - const current = (s.up || 0) + (s.down || 0); - return s.allTime > current ? s.allTime : current; -} function isClientDepleted(email) { const s = statsFor(email); if (!s) return false; @@ -286,7 +278,6 @@ function confirmBulkDelete() {
{{ t('pages.inbounds.client') }}
{{ t('pages.inbounds.traffic') }}
{{ t('remained') }}
-
{{ t('pages.inbounds.allTimeTraffic') }}
{{ t('pages.inbounds.expireDate') }}
@@ -388,10 +379,6 @@ function confirmBulkDelete() { -
- {{ SizeFormatter.sizeFormat(getAllTime(client.email)) }} -
-
- - - - - - - -