-
Notifications
You must be signed in to change notification settings - Fork 171
fix: QR code URL generation and WebSocket robustness #1527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 1 commit
7c5ed78
4b024f4
7365b9b
ff11cb3
784b7ac
776cc77
44b2b67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |
| from django.utils.translation import gettext_lazy as _ | ||
| from kombu import Queue | ||
| from pycountry import currencies | ||
| from pydantic import Field, HttpUrl | ||
| from pydantic import Field, HttpUrl, model_validator | ||
| from pydantic_settings import BaseSettings as _BaseSettings | ||
| from pydantic_settings import PydanticBaseSettingsSource, SettingsConfigDict, TomlConfigSettingsSource | ||
| from redis.asyncio.retry import Retry | ||
|
|
@@ -128,7 +128,7 @@ class BaseSettings(_BaseSettings): | |
| # Override it to match the domain the website is running on, | ||
| # or you will get "DisallowedHost" error. | ||
| site_url: HttpUrl = 'http://localhost:8000' | ||
| short_url: HttpUrl = 'http://localhost:8000' | ||
| short_url: HttpUrl | None = None | ||
| talk_hostname: str = 'http://localhost:8000' | ||
| sentry_dsn: str = '' | ||
| instance_name: str = 'eventyay' | ||
|
|
@@ -146,6 +146,12 @@ class BaseSettings(_BaseSettings): | |
| zoom_key: str = '' | ||
| zoom_secret: str = '' | ||
| control_secret: str = '' | ||
|
|
||
| @model_validator(mode='after') | ||
| def default_short_url(self) -> 'BaseSettings': | ||
| if self.short_url is None: | ||
| self.short_url = self.site_url | ||
| return self | ||
|
||
| statsd_host: str = '' | ||
| statsd_port: int = 8125 | ||
| statsd_prefix: str = 'eventyay' | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,4 @@ | ||||||||||||||||||||||||
| from django.db.utils import IntegrityError | ||||||||||||||||||||||||
| from eventyay.core.permissions import Permission | ||||||||||||||||||||||||
| from eventyay.base.services.bbb import BBBService | ||||||||||||||||||||||||
| from eventyay.features.live.decorators import command, room_action | ||||||||||||||||||||||||
|
|
@@ -20,15 +21,20 @@ async def room_url(self, body): | |||||||||||||||||||||||
| service = BBBService(self.consumer.event) | ||||||||||||||||||||||||
| if not self.consumer.user.profile.get("display_name"): | ||||||||||||||||||||||||
| raise ConsumerException("bbb.join.missing_profile") | ||||||||||||||||||||||||
| url = await service.get_join_url_for_room( | ||||||||||||||||||||||||
| self.room, | ||||||||||||||||||||||||
| self.consumer.user, | ||||||||||||||||||||||||
| moderator=await self.consumer.event.has_permission_async( | ||||||||||||||||||||||||
| user=self.consumer.user, | ||||||||||||||||||||||||
| permission=Permission.ROOM_BBB_MODERATE, | ||||||||||||||||||||||||
| room=self.room, | ||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| url = await service.get_join_url_for_room( | ||||||||||||||||||||||||
| self.room, | ||||||||||||||||||||||||
| self.consumer.user, | ||||||||||||||||||||||||
| moderator=await self.consumer.event.has_permission_async( | ||||||||||||||||||||||||
| user=self.consumer.user, | ||||||||||||||||||||||||
| permission=Permission.ROOM_BBB_MODERATE, | ||||||||||||||||||||||||
| room=self.room, | ||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| except IntegrityError: | ||||||||||||||||||||||||
| # This happens in dev environment when no BBB server is configured | ||||||||||||||||||||||||
| raise ConsumerException("bbb.failed") | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if not url: | ||||||||||||||||||||||||
| raise ConsumerException("bbb.failed") | ||||||||||||||||||||||||
| await self.consumer.send_success({"url": url}) | ||||||||||||||||||||||||
|
|
@@ -38,10 +44,14 @@ async def call_url(self, body): | |||||||||||||||||||||||
| service = BBBService(self.consumer.event) | ||||||||||||||||||||||||
| if not self.consumer.user.profile.get("display_name"): | ||||||||||||||||||||||||
| raise ConsumerException("bbb.join.missing_profile") | ||||||||||||||||||||||||
| url = await service.get_join_url_for_call_id( | ||||||||||||||||||||||||
| body.get("call"), | ||||||||||||||||||||||||
| self.consumer.user, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||
| url = await service.get_join_url_for_call_id( | ||||||||||||||||||||||||
| body.get("call"), | ||||||||||||||||||||||||
| self.consumer.user, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| except IntegrityError: | ||||||||||||||||||||||||
| raise ConsumerException("bbb.failed") | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
| try: | |
| url = await service.get_join_url_for_call_id( | |
| body.get("call"), | |
| self.consumer.user, | |
| ) | |
| except IntegrityError: | |
| raise ConsumerException("bbb.failed") | |
| url = await service.get_join_url_for_call_id( | |
| body.get("call"), | |
| self.consumer.user, | |
| ) |
Outdated
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra space before 'recordings' causing incorrect indentation. This line should align with the 'except' block above it.
| recordings = [] | |
| recordings = [] |
Outdated
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recordings method is unlikely to raise IntegrityError since it doesn't create or update any BBBCall records - it only queries for recordings. The get_recordings_for_room method already has comprehensive exception handling that returns an empty list on errors. This try-except block appears unnecessary and may give a false sense of error handling.
| try: | |
| recordings = await service.get_recordings_for_room( | |
| self.room, | |
| ) | |
| except IntegrityError: | |
| recordings = [] | |
| recordings = await service.get_recordings_for_room( | |
| self.room, | |
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
model_validatorimport is not used anywhere in this file. According to the PR description, a model validator should be implemented to automatically defaultshort_urltosite_urlwhen not explicitly configured, but no such validator has been added. Either implement the validator or remove this unused import.