diff --git a/src/Panel/Base.php b/src/Panel/Base.php index 1b0c683..9959dab 100644 --- a/src/Panel/Base.php +++ b/src/Panel/Base.php @@ -33,6 +33,7 @@ class Base 'apiMHSanaei_get' => '/xui/API/inbounds/get/{id}', 'apiMHSanaei_resetAllClientTraffics' => '/xui/API/inbounds/resetAllClientTraffics/{id}', 'apiMHSanaei_delDepletedClients' => '/xui/API/inbounds/delDepletedClients/{id}', + 'apiMHSanaei_getClientTraffics' => '/xui/API/inbounds/getClientTraffics/{id}', ]; protected $defaults = [ 'sniffing' => [ @@ -106,7 +107,7 @@ protected function getUrl($path): string if (isset($this->path[$path])) { $urlPath = $this->path[$path]; - $arrPath = ['delInbound', 'inbound', 'updateInbound', 'installXray', 'delClient', 'clientIps', 'clearClientIps', 'apiMHSanaei_get', 'apiMHSanaei_resetAllClientTraffics', 'apiMHSanaei_delDepletedClients']; + $arrPath = ['delInbound', 'inbound', 'updateInbound', 'installXray', 'delClient', 'clientIps', 'clearClientIps', 'apiMHSanaei_get', 'apiMHSanaei_resetAllClientTraffics', 'apiMHSanaei_delDepletedClients', 'apiMHSanaei_getClientTraffics']; $arrPathWithClient = ['resetClientTraffic']; if (in_array($path, $arrPath)) { $urlPath = strtr($this->path[$path], ['{id}' => $this->getId()]); diff --git a/src/Panel/FranzKafkaYu.php b/src/Panel/FranzKafkaYu.php index b0efd5a..e112c95 100644 --- a/src/Panel/FranzKafkaYu.php +++ b/src/Panel/FranzKafkaYu.php @@ -163,6 +163,32 @@ public function editClientTrafficByEmail($id, $email, $gb) return $this->editInbound($enable, $id, $remark, $port, $protocol, $settings, $streamSettings, $total, $up, $down, $sniffing, $expiryTime, $listen); } + public function getClientData($inboundId, $uuid) + { + $list = $this->list(['id' => $inboundId])[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndex($settings['clients'], $uuid); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + + public function getClientDataByEmail($inboundId, $email) + { + $list = $this->list(['id' => $inboundId]); + if ($list == false) { + return false; + } + $list = $list[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndexByEmail($settings['clients'], $email); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + public function editInbound($enable, $id, $remark, $port, $protocol, $settings, $streamSettings, $total = 0, $up = 0, $down = 0, $autoreset = false, $ipalert = false, $iplimit = 0, $sniffing = null, $expiryTime = 0, $listen = '') { $sniffing = $sniffing == null ? $this->defaults['sniffing'] : $sniffing; diff --git a/src/Panel/HexaSoftwareTech.php b/src/Panel/HexaSoftwareTech.php index 035dd2e..c73deb6 100644 --- a/src/Panel/HexaSoftwareTech.php +++ b/src/Panel/HexaSoftwareTech.php @@ -53,6 +53,33 @@ public function addnewClient($id, $uuid, $email, $flow = '', $totalgb = 0, $eT = return $this->editInbound($enable, $id, $remark, $port, $protocol, $settings, $streamSettings, $total, $up, $down, $sniffing, $expiryTime, $listen); } + + public function getClientData($inboundId, $uuid) + { + $list = $this->list(['id' => $inboundId])[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndex($settings['clients'], $uuid); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + + public function getClientDataByEmail($inboundId, $email) + { + $list = $this->list(['id' => $inboundId]); + if ($list == false) { + return false; + } + $list = $list[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndexByEmail($settings['clients'], $email); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + public function editClient($inboundId, $clientUuid, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $limitIp = 0, $fingerprint = 'chrome', $flow = '') { $list = $this->list(['id' => $inboundId])[0]; @@ -114,6 +141,7 @@ public function editClientByEmail($inboundId, $clientEmail, $enableClient, $emai $total = $list['total']; return $this->editInbound($enable, $inboundId, $remark, $port, $protocol, $settings, $streamSettings, $total, $up, $down, $sniffing, $expiryTime, $listen); } + public function editClientTraffic($id, $uuid, $gb) { $list = $this->list(['id' => $id])[0]; diff --git a/src/Panel/MHSanaei.php b/src/Panel/MHSanaei.php index 688ce40..72a8aef 100644 --- a/src/Panel/MHSanaei.php +++ b/src/Panel/MHSanaei.php @@ -73,7 +73,7 @@ public function addnewClient($id, $uuid, $email, $flow = '', $totalgb = 0, $eT = } - public function editClient($inboundId, $clientUuid, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $tgId = '', $subId = '', $limitIp = 0,$fingerprint = 'chrome', $flow = '') + public function editClient($inboundId, $clientUuid, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $tgId = '', $subId = '', $limitIp = 0, $fingerprint = 'chrome', $flow = '') { $list = $this->list(['id' => $inboundId])[0]; $enable = (bool)$list['enable']; @@ -107,7 +107,7 @@ public function editClient($inboundId, $clientUuid, $enableClient, $email, $uuid } - public function editClientByEmail($inboundId, $clientEmail, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $tgId = '', $subId = '', $limitIp = 0,$fingerprint = 'chrome', $flow = '') + public function editClientByEmail($inboundId, $clientEmail, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $tgId = '', $subId = '', $limitIp = 0, $fingerprint = 'chrome', $flow = '') { $list = $this->list(['id' => $inboundId])[0]; $enable = (bool)$list['enable']; @@ -200,6 +200,32 @@ public function clearClientIP($email) return $this->curl('clearClientIps', true); } + public function getClientData($inboundId, $uuid) + { + $list = $this->list(['id' => $inboundId])[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndex($settings['clients'], $uuid); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + + public function getClientDataByEmail($inboundId, $email) + { + $list = $this->list(['id' => $inboundId]); + if ($list == false){ + return false; + } + $list = $list[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndexByEmail($settings['clients'], $email); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + public function disableClientByEmail($id, $email) { $list = $this->list(['id' => $id])[0]; @@ -342,4 +368,10 @@ public function delDepletedClientsApi($id) $this->setId($id); return $this->curl('apiMHSanaei_delDepletedClients', []); } + + public function getClientTraffics($email) + { + $this->setId($email); + return $this->curl('apiMHSanaei_getClientTraffics', []); + } } \ No newline at end of file diff --git a/src/Panel/NidukaAkalanka.php b/src/Panel/NidukaAkalanka.php index 282801c..08b7e17 100644 --- a/src/Panel/NidukaAkalanka.php +++ b/src/Panel/NidukaAkalanka.php @@ -46,6 +46,32 @@ public function addnewClient($id, $uuid, $email, $flow = '', $totalgb = 0, $eT = } + public function getClientData($inboundId, $uuid) + { + $list = $this->list(['id' => $inboundId])[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndex($settings['clients'], $uuid); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + + public function getClientDataByEmail($inboundId, $email) + { + $list = $this->list(['id' => $inboundId]); + if ($list == false) { + return false; + } + $list = $list[0]; + $settings = json_decode($list["settings"], true); + $cIndex = $this->getClientIndexByEmail($settings['clients'], $email); + if ($cIndex === false) + return false; + + return $settings['clients'][$cIndex]; + } + public function editClient($inboundId, $clientUuid, $enableClient, $email, $uuid, $totalGB = 0, $expiryTime = 0, $limitIp = 0, $fingerprint = 'chrome', $flow = '') { $list = $this->list(['id' => $inboundId])[0];