- Script pane: PDF tab beside annotations; "Add script annotation" arms highlight mode on the draft, ✓/✕ to confirm/cancel, auto-scrolls to the active annotation's highlights during playback. Adds Project.script. - Realtime: Django Channels websocket per project broadcasts attributed scene deltas after each save; peers merge them in (keeping local drafts). - Logout link in the editor project-bar. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
867 B
Python
22 lines
867 B
Python
import json
|
|
|
|
from channels.generic.websocket import AsyncWebsocketConsumer
|
|
|
|
|
|
class SceneConsumer(AsyncWebsocketConsumer):
|
|
"""One connection per open project. Joins the project's group and relays
|
|
scene deltas the server broadcasts (see scenes.views.scene). Read-only:
|
|
edits still go through the PUT endpoint, which is the broadcast source."""
|
|
|
|
async def connect(self):
|
|
self.pk = self.scope['url_route']['kwargs']['pk']
|
|
self.group = f'project_{self.pk}'
|
|
await self.channel_layer.group_add(self.group, self.channel_name)
|
|
await self.accept()
|
|
|
|
async def disconnect(self, code):
|
|
await self.channel_layer.group_discard(self.group, self.channel_name)
|
|
|
|
# broadcast handler: {type: "scene.delta", delta: {...}}
|
|
async def scene_delta(self, event):
|
|
await self.send(text_data=json.dumps(event['delta']))
|