(frontend) support custom room names inspired by Jitsi

Following numerous user requests, add support for personalized room names
alongside our existing generated IDs. This pattern, inherited from Jitsi Meet,
allows teams to create memorable, persistent meeting spaces like "daily-standup"
or "teamalpha" instead of relying only on auto-generated IDs.

Note: This change introduces a permanent update to room URL patterns.
Once custom room links are shared, we will need to maintain support for both
formats to avoid breaking existing shared URLs.
This commit is contained in:
lebaudantoine
2025-01-21 17:45:00 +01:00
parent 96c18fc627
commit 7529126ca3
@@ -1,4 +1,22 @@
export const roomIdPattern = '[a-z]{3}-[a-z]{4}-[a-z]{3}'
/**
* Pattern for system-generated room IDs
* Format: xxx-xxxx-xxx (e.g., abc-defg-hij)
* This pattern is used when rooms are automatically created by the system,
* ensuring consistent and predictable room IDs for randomly generated rooms.
*/
export const generatedRoomPattern = '[a-z]{3}-[a-z]{4}-[a-z]{3}'
/**
* Pattern for user-defined custom room IDs
* Format: Minimum 5 lowercase alphanumeric characters
* This pattern allows users to create memorable, personalized room names
* while maintaining basic validation rules (e.g., myroom123, teamspace, project2024)
*/
export const personalizedRoomPattern = '[a-z0-9]{5,}'
// Combined pattern that accepts both system-generated and personalized room IDs
// This allows flexibility in room creation while maintaining consistent validation
export const roomIdPattern = `(?:${generatedRoomPattern}|${personalizedRoomPattern})`
export const isRoomValid = (roomIdOrUrl: string) =>
new RegExp(`^${roomIdPattern}$`).test(roomIdOrUrl) ||