From 7bcd8de007a5cc8a474d609b7c3ed4afa84e93f3 Mon Sep 17 00:00:00 2001 From: mercury Date: Wed, 29 Jan 2025 11:04:06 +0400 Subject: [PATCH] vless: reset stats user --- app/bot.php | 22 ++++++++++++++++++++++ version | 2 ++ 2 files changed, 24 insertions(+) diff --git a/app/bot.php b/app/bot.php index b896082..5f084ea 100644 --- a/app/bot.php +++ b/app/bot.php @@ -378,6 +378,9 @@ class Bot case preg_match('~^/renameXrUser (\d+)$~', $this->input['callback'], $m): $this->renameXrUser($m[1]); break; + case preg_match('~^/resetXrUser (\d+)$~', $this->input['callback'], $m): + $this->resetXrUser($m[1]); + break; case preg_match('~^/v2ray$~', $this->input['callback'], $m): $this->v2ray(); break; @@ -5312,6 +5315,17 @@ DNS-over-HTTPS with IP: $this->userXr($i); } + public function resetXrUser($i) + { + $c = $this->getXray(); + $c['inbounds'][0]['settings']['clients'][$i]['global'] = [ + 'download' => 0, + 'upload' => 0, + ]; + $this->restartXray($c); + $this->userXr($i); + } + public function listXr($i) { $c = $this->getPacConf(); @@ -6030,6 +6044,14 @@ DNS-over-HTTPS with IP: 'callback_data' => "/qrXray {$i}_2", ], ]; + $download = $this->getBytes($c['global']['download'] + $c['session']['download']); + $upload = $this->getBytes($c['global']['upload'] + $c['session']['upload']); + $data[] = [ + [ + 'text' => $this->i18n('reset stats') . ": ↓$download ↑$upload", + 'callback_data' => "/resetXrUser $i", + ], + ]; $data[] = [ [ 'text' => $this->i18n('rename'), diff --git a/version b/version index 96ad46f..16f9132 100644 --- a/version +++ b/version @@ -1,3 +1,5 @@ +29.01.2025 v2.7 +- vless: сброс статистики юзера 24.01.2025 v2.6 - правки меню - vless:добавлена возможность маршрутизировать список ip-сетей