mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-07 01:13:21 +00:00
wip generate a random passphrase cached by slug
This commit is contained in:
@@ -139,12 +139,11 @@ class RoomSerializer(serializers.ModelSerializer):
|
||||
"token": utils.generate_token(
|
||||
room=slug, user=request.user, username=username
|
||||
),
|
||||
"passphrase": utils.get_cached_passphrase(slug)
|
||||
}
|
||||
|
||||
|
||||
output["is_administrable"] = is_admin
|
||||
|
||||
output['passphrase'] = "thisisapassphrase"
|
||||
|
||||
return output
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,21 @@ from django.conf import settings
|
||||
|
||||
from livekit.api import AccessToken, VideoGrants
|
||||
|
||||
from functools import lru_cache
|
||||
import secrets
|
||||
import string
|
||||
|
||||
|
||||
def generate_random_passphrase(length=26):
|
||||
"""Generate a random passphrase using letters and digits"""
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
return ''.join(secrets.choice(alphabet) for _ in range(length))
|
||||
|
||||
@lru_cache()
|
||||
def get_cached_passphrase(room_slug):
|
||||
"""Get or generate a cached passphrase for a room slug"""
|
||||
return generate_random_passphrase()
|
||||
|
||||
|
||||
def generate_color(identity: str) -> str:
|
||||
"""Generates a consistent HSL color based on a given identity string.
|
||||
|
||||
@@ -4,11 +4,11 @@ export type ApiRoom = {
|
||||
slug: string
|
||||
is_public: boolean
|
||||
is_administrable: boolean
|
||||
passphrase: string
|
||||
livekit?: {
|
||||
url: string
|
||||
room: string
|
||||
token: string
|
||||
passphrase: string
|
||||
}
|
||||
configuration?: {
|
||||
[key: string]: string | number | boolean
|
||||
|
||||
@@ -110,7 +110,7 @@ export const Conference = ({
|
||||
}
|
||||
if (e2eeEnabled) {
|
||||
keyProvider
|
||||
.setKey(data.passphrase)
|
||||
.setKey(data.livekit?.passphrase)
|
||||
.then(() => {
|
||||
room.setE2EEEnabled(true).catch((e) => {
|
||||
if (e instanceof DeviceUnsupportedError) {
|
||||
|
||||
Reference in New Issue
Block a user