2022-04-14 15:33:53 +03:00
|
|
|
import logging
|
|
|
|
from app.classes.web.base_api_handler import BaseApiHandler
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class ApiUsersUserPfpHandler(BaseApiHandler):
|
|
|
|
def get(self, user_id):
|
|
|
|
auth_data = self.authenticate_user()
|
|
|
|
if not auth_data:
|
|
|
|
return
|
|
|
|
|
|
|
|
if user_id == "@me":
|
|
|
|
user = auth_data[4]
|
|
|
|
else:
|
2022-05-05 03:32:09 +03:00
|
|
|
user = self.controller.users.get_user_by_id(user_id)
|
2022-04-14 15:33:53 +03:00
|
|
|
|
|
|
|
logger.debug(
|
|
|
|
f'User {auth_data[4]["user_id"]} is fetching the pfp for user {user_id}'
|
|
|
|
)
|
|
|
|
|
2022-09-12 15:34:47 -04:00
|
|
|
self.finish_json(200, {"status": "ok", "data": user["pfp"]})
|
|
|
|
return
|