From 033f66490344af28c6c918b80dc6eadedda90fbb Mon Sep 17 00:00:00 2001 From: Vladless Date: Wed, 30 Oct 2024 02:35:27 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=BF=D0=B8=D1=81=D0=BA?= =?UTF-8?q?=D0=B8.=20initial=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auth.py | 8 ++++++++ client.py | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/auth.py b/auth.py index 2a49a0e3..207adf6c 100644 --- a/auth.py +++ b/auth.py @@ -60,3 +60,11 @@ async def link(session, server_id: str, client_id: str, email: str): f"&fp=chrome&sni={SERVERS[server_id]['SNI']}&sid={SERVERS[server_id]['SID']}=%2F&flow={flow}#{SERVERS[server_id]['PREFIX']}-{email}" ) return val + +async def link_subscription(email, server_id): + server = SERVERS.get(server_id) + if server: + subscription_url = f"{server['SUBSCRIPTION']}/{email}" + return subscription_url + else: + raise ValueError(f"Server '{server_id}' not found in configuration.") \ No newline at end of file diff --git a/client.py b/client.py index 7ec0808f..04296be1 100644 --- a/client.py +++ b/client.py @@ -18,7 +18,7 @@ async def add_client(session, server_id: str, client_id: str, email: str, tg_id: "expiryTime": expiry_time, "enable": enable, "tgId": tg_id, - "subId": "", + "subId": email, "flow": flow, } @@ -86,7 +86,7 @@ async def extend_client_key(session, server_id: str, tg_id, client_id, email: st "expiryTime": updated_expiry_time, "enable": True, "tgId": tg_id, - "subId": "", + "subId": email, "flow": "xtls-rprx-vision" } ] @@ -130,7 +130,7 @@ async def extend_client_key_admin(session, server_id: str, tg_id, client_id: str "expiryTime": new_expiry_time, "enable": True, "tgId": tg_id, - "subId": "", + "subId": email, "flow": "xtls-rprx-vision" } ]