feat: add verification; add auth - change password and logout

This commit is contained in:
firedotguy
2026-01-30 16:12:05 +03:00
parent aa20199ebe
commit 1a606da55f
6 changed files with 61 additions and 9 deletions

10
itd/routes/auth.py Normal file
View File

@@ -0,0 +1,10 @@
from itd.request import auth_fetch
def refresh_token(cookies: str):
return auth_fetch(cookies, 'post', 'v1/auth/refresh')['accessToken']
def change_password(cookies: str, token: str, old: str, new: str):
return auth_fetch(cookies, 'post', 'v1/auth/change-password', {'newPassword': new, 'oldPassword': old}, token)
def logout(cookies: str):
return auth_fetch(cookies, 'post', 'v1/auth/logout')

View File

@@ -35,3 +35,4 @@ def get_followers(token: str, username: str, limit: int = 30, page: int = 1):
def get_following(token: str, username: str, limit: int = 30, page: int = 1):
return fetch(token, 'get', f'users/{username}/following', {'limit': limit, 'page': page})

View File

@@ -0,0 +1,8 @@
from itd.request import fetch
def verificate(token: str, file_url: str):
# {"success":true,"request":{"id":"fc54e54f-8586-4d8c-809e-df93161f99da","userId":"9096a85b-c319-483e-8940-6921be427ad0","videoUrl":"https://943701f000610900cbe86b72234e451d.bckt.ru/videos/354f28a6-9ac7-48a6-879a-a454062b1d6b.mp4","status":"pending","rejectionReason":null,"reviewedBy":null,"reviewedAt":null,"createdAt":"2026-01-30T12:58:14.228Z","updatedAt":"2026-01-30T12:58:14.228Z"}}
return fetch(token, 'post', 'verification/submit', {'videoUrl': file_url})
def get_verification_status(token: str):
return fetch(token, 'get', 'verification/status')