fix: add Trojan protocol support in create_3xui_client (password instead of uuid)

This commit is contained in:
SashegDev
2026-05-22 05:48:15 +00:00
parent dc92b75387
commit 9a893d5e6d
+21 -9
View File
@@ -947,15 +947,27 @@ def create_3xui_client(username: str, sub_id: str, inbound: dict, traffic_gb: in
logger.info(f"Creating client: email={email}, total_bytes={total_bytes}, inbound={inbound_name}")
from py3xui.client import Client
client = Client(
id=str(uuid.uuid4()),
email=email,
enable=True,
total_gb=total_bytes,
expiry_time=0,
limit_ip=0,
subId=sub_id
)
if inbound.get("protocol") == "trojan":
client = Client(
id="",
password=str(uuid.uuid4()),
email=email,
enable=True,
total_gb=total_bytes,
expiry_time=0,
limit_ip=0,
subId=sub_id
)
else:
client = Client(
id=str(uuid.uuid4()),
email=email,
enable=True,
total_gb=total_bytes,
expiry_time=0,
limit_ip=0,
subId=sub_id
)
try:
existing = api.client.get_by_email(email)