Skip to content

مشکل پنل سنایی با api - resolving sanaei api problem #3

@pbi94

Description

@pbi94

سلام. برای حل مشکل api پنل 3xui در نسخه های جدید (1.5.0 تست شده) باید url هایی که با xui شروع میشن رو به panel تغییر داد
مثلا
xui/inbound/addClient -> panel/inbound/addClient

  • برای اضافه کردن یوزر هم مشکلی وجود داره که ارور email already exists میده. برای رفع این مشکل هم راه حلی که به ذهنم رسیده اینه که یک inbound خالی در پنل بسازید بصورت دستی . و عدد andis رو هم در تابع زیر بصورت دستی به شماره inbound موردنظر خودتون تغییر بدید:

public function new(string $email, int $total, int $ex) { $total *= (1024 * 1024 * 1024); $ex *= 1000;

    for ($andis = 0; $andis < 5; $andis++)
    {
        $json_settings = json_decode($this->list()[$andis]["settings"],true);
        
        $count_settings = count($json_settings["clients"]);
        if($count_settings <= 20) {
            $json_settings["clients"][$count_settings] = [
                "id" => $this->genUserId(),
                "flow" => "",
                "email" => $email,
                "limitIp" => 0,
                "totalGB" => $total,
                "expiryTime" => $ex
            ];
            $send["settings"] = json_encode($json_settings);
            $send["id"] = ++$andis;
            $result = $this->request("panel/inbound/addClient",$send);
            return $result;
       }
    }

    return false;    }``

تغییر به:

//andis is number of inbound you want to add client to it
    public function new(string $email, int $total, int $ex,int $andis) 
    {
        $total *= (1024 * 1024 * 1024);
        $ex *= 1000;


        
            $json_settings = json_decode($this->list()[$andis]["settings"],true);
            
            $count_settings = count($json_settings["clients"]);

                $json_settings["clients"][$count_settings-1] = [
                    "id" => $this->genUserId(),
                    "flow" => "",
                    "email" => $email,
                    "limitIp" => 0,
                    "totalGB" => $total,
                    "expiryTime" => $ex
                ];
                $send["settings"] = json_encode($json_settings);
                $send["id"] = ++$andis;
                $result = $this->request("panel/inbound/addClient",$send);
                return $result;


    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions