Skip to content

Commit

Permalink
Подписки. initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladless committed Oct 29, 2024
1 parent 8e08a3c commit 61527de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
6 changes: 3 additions & 3 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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"
}
]
Expand Down Expand Up @@ -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"
}
]
Expand Down

0 comments on commit 61527de

Please sign in to comment.