Skip to content

Commit

Permalink
Adding new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezax5 committed May 5, 2023
1 parent ae7a7c2 commit 928df98
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Panel/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand Down Expand Up @@ -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()]);
Expand Down
26 changes: 26 additions & 0 deletions src/Panel/FranzKafkaYu.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions src/Panel/HexaSoftwareTech.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
36 changes: 34 additions & 2 deletions src/Panel/MHSanaei.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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', []);
}
}
26 changes: 26 additions & 0 deletions src/Panel/NidukaAkalanka.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 928df98

Please sign in to comment.