Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

🚸(frontend) generate shorter room IDs making URLs easier to share

lebaudantoined8c8ac0811da
diff --git a/src/frontend/src/features/rooms/utils/generateRoomId.ts b/src/frontend/src/features/rooms/utils/generateRoomId.ts
index f8be43bb..dc84dcf1 100644
--- a/src/frontend/src/features/rooms/utils/generateRoomId.ts
+++ b/src/frontend/src/features/rooms/utils/generateRoomId.ts
@@ -1,5 +1,27 @@
-import { slugify } from '@/utils/slugify'
+
+const getRandomChar = () => {
+ // Google Meet uses only letters in a room identifier
+ const characters = 'abcdefghijklmnopqrstuvwxyz';
+ const charactersLength = characters.length;
+ return characters.charAt(Math.floor(Math.random() * charactersLength))
+}
+
+const generateSegment = (length: number): string => {
+ let segment = '';
+ for (let i = 0; i < length; i++) {
+ segment += getRandomChar();
+ }
+ return segment;
+};
export const generateRoomId = () => {
- return slugify(crypto.randomUUID())
+ // Generates a unique room identifier following the Google Meet format
+ const shortLength = 3;
+ const longLength = 4;
+ const parts = [
+ generateSegment(shortLength),
+ generateSegment(longLength),
+ generateSegment(shortLength)
+ ];
+ return parts.join('-');
}