From 1e19aa24dd8f6dec688ebfe335d815c68f275d50 Mon Sep 17 00:00:00 2001 From: Michelle Date: Thu, 26 Feb 2026 09:20:41 +0100 Subject: [PATCH] Use create call instead of join call with loginURL --- server/config/bbb.js | 12 ++++++------ server/routes/rooms.js | 17 +++++++++-------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/server/config/bbb.js b/server/config/bbb.js index 78234b0..2110a66 100644 --- a/server/config/bbb.js +++ b/server/config/bbb.js @@ -39,11 +39,11 @@ function getRoomPasswords(uid) { return { moderatorPW: modPw, attendeePW: attPw }; } -export async function createMeeting(room, logoutURL) { +export async function createMeeting(room, logoutURL, loginURL = null) { const { moderatorPW, attendeePW } = getRoomPasswords(room.uid); // Build welcome message with guest invite link - let welcome = room.welcome_message || 'Willkommen!'; + let welcome = room.welcome_message || 'Welcome to this meeting!'; if (logoutURL) { const guestLink = `${logoutURL}/join/${room.uid}`; welcome += `

To invite other participants, share this link:
${guestLink}`; @@ -68,6 +68,9 @@ export async function createMeeting(room, logoutURL) { if (logoutURL) { params.logoutURL = logoutURL; } + if (loginURL) { + params.loginURL = loginURL; + } if (room.max_participants > 0) { params.maxParticipants = room.max_participants.toString(); } @@ -77,7 +80,7 @@ export async function createMeeting(room, logoutURL) { return apiCall('create', params); } -export async function joinMeeting(uid, name, isModerator = false, avatarURL = null, loginURL = null) { +export async function joinMeeting(uid, name, isModerator = false, avatarURL = null) { const { moderatorPW, attendeePW } = getRoomPasswords(uid); const params = { meetingID: uid, @@ -88,9 +91,6 @@ export async function joinMeeting(uid, name, isModerator = false, avatarURL = nu if (avatarURL) { params.avatarURL = avatarURL; } - if (loginURL) { - params.loginURL = loginURL; - } return buildUrl('join', params); } diff --git a/server/routes/rooms.js b/server/routes/rooms.js index 080b514..7891150 100644 --- a/server/routes/rooms.js +++ b/server/routes/rooms.js @@ -341,10 +341,11 @@ router.post('/:uid/start', authenticateToken, async (req, res) => { } } - await createMeeting(room, `${req.protocol}://${req.get('host')}`); + const baseUrl = `${req.protocol}://${req.get('host')}`; + const loginURL = `${baseUrl}/join/${room.uid}`; + await createMeeting(room, baseUrl, loginURL); const avatarURL = getUserAvatarURL(req, req.user); - const appLoginUrl = `${req.protocol}://${req.get('host')}/join/${room.uid}`; - const joinUrl = await joinMeeting(room.uid, req.user.name, true, avatarURL, appLoginUrl); + const joinUrl = await joinMeeting(room.uid, req.user.name, true, avatarURL); res.json({ joinUrl }); } catch (err) { console.error('Start meeting error:', err); @@ -378,8 +379,7 @@ router.post('/:uid/join', authenticateToken, async (req, res) => { const isShared = !isOwner && await db.get('SELECT id FROM room_shares WHERE room_id = ? AND user_id = ?', [room.id, req.user.id]); const isModerator = isOwner || !!isShared || room.all_join_moderator; const avatarURL = getUserAvatarURL(req, req.user); - const appLoginUrl = `${req.protocol}://${req.get('host')}/join/${room.uid}`; - const joinUrl = await joinMeeting(room.uid, req.user.name, isModerator, avatarURL, appLoginUrl); + const joinUrl = await joinMeeting(room.uid, req.user.name, isModerator, avatarURL); res.json({ joinUrl }); } catch (err) { console.error('Join meeting error:', err); @@ -477,7 +477,9 @@ router.post('/:uid/guest-join', async (req, res) => { // If meeting not running but anyone_can_start, create it if (!running && room.anyone_can_start) { - await createMeeting(room, `${req.protocol}://${req.get('host')}`); + const baseUrl = `${req.protocol}://${req.get('host')}`; + const loginURL = `${baseUrl}/join/${room.uid}`; + await createMeeting(room, baseUrl, loginURL); } // Check moderator code @@ -488,8 +490,7 @@ router.post('/:uid/guest-join', async (req, res) => { const baseUrl = `${req.protocol}://${req.get('host')}`; const guestAvatarURL = `${baseUrl}/api/auth/avatar/initials/${encodeURIComponent(name.trim())}`; - const appLoginUrl = `${baseUrl}/join/${room.uid}`; - const joinUrl = await joinMeeting(room.uid, name.trim(), isModerator, guestAvatarURL, appLoginUrl); + const joinUrl = await joinMeeting(room.uid, name.trim(), isModerator, guestAvatarURL); res.json({ joinUrl }); } catch (err) { console.error('Guest join error:', err);