Browse Source

fix(course): use absolute avatar url in live session token

Return an absolute URI for the avatar in live session token
metadata so external services (e.g., PlugNMeet) can fetch the
image reliably. Add debug logging to PlugNMeet client POST
requests and info logging for the resolved profile picture URL
to aid troubleshooting.
master
mortezaei 7 months ago
parent
commit
dca5eceb3e
  1. 4
      apps/course/services/plugnmeet.py
  2. 3
      apps/course/views/live_session.py

4
apps/course/services/plugnmeet.py

@ -47,6 +47,10 @@ class PlugNMeetClient:
"API-KEY": self.api_key,
"HASH-SIGNATURE": self._build_signature(body),
}
import logging
logger = logging.getLogger(__name__)
logger.debug(f"[PlugNMeet] POST {path} - Body: {body[:500]}")
try:
response = requests.post(url, data=body.encode("utf-8"), headers=headers, timeout=self.timeout)

3
apps/course/views/live_session.py

@ -219,6 +219,7 @@ class CourseLiveSessionTokenAPIView(GenericAPIView):
user_metadata = {}
profile_pic = self._build_profile_url(request, user)
logger.info(f"[LiveSession Token] Profile pic URL - user_id={user.id} url={profile_pic}")
if profile_pic:
user_metadata['profilePic'] = profile_pic
@ -272,5 +273,5 @@ class CourseLiveSessionTokenAPIView(GenericAPIView):
def _build_profile_url(request, user):
avatar = getattr(user, 'avatar', None)
if avatar and getattr(avatar, 'url', None):
return avatar.url
return request.build_absolute_uri(avatar.url)
return None
Loading…
Cancel
Save