Use create call instead of join call with loginURL
All checks were successful
Build & Push Docker Image / build (push) Successful in 1m10s

This commit is contained in:
2026-02-26 09:20:41 +01:00
parent a6e400b6b7
commit 1e19aa24dd
2 changed files with 15 additions and 14 deletions

View File

@@ -39,11 +39,11 @@ function getRoomPasswords(uid) {
return { moderatorPW: modPw, attendeePW: attPw }; 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); const { moderatorPW, attendeePW } = getRoomPasswords(room.uid);
// Build welcome message with guest invite link // Build welcome message with guest invite link
let welcome = room.welcome_message || 'Willkommen!'; let welcome = room.welcome_message || 'Welcome to this meeting!';
if (logoutURL) { if (logoutURL) {
const guestLink = `${logoutURL}/join/${room.uid}`; const guestLink = `${logoutURL}/join/${room.uid}`;
welcome += `<br><br>To invite other participants, share this link:<br><a href="${guestLink}">${guestLink}</a>`; welcome += `<br><br>To invite other participants, share this link:<br><a href="${guestLink}">${guestLink}</a>`;
@@ -68,6 +68,9 @@ export async function createMeeting(room, logoutURL) {
if (logoutURL) { if (logoutURL) {
params.logoutURL = logoutURL; params.logoutURL = logoutURL;
} }
if (loginURL) {
params.loginURL = loginURL;
}
if (room.max_participants > 0) { if (room.max_participants > 0) {
params.maxParticipants = room.max_participants.toString(); params.maxParticipants = room.max_participants.toString();
} }
@@ -77,7 +80,7 @@ export async function createMeeting(room, logoutURL) {
return apiCall('create', params); 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 { moderatorPW, attendeePW } = getRoomPasswords(uid);
const params = { const params = {
meetingID: uid, meetingID: uid,
@@ -88,9 +91,6 @@ export async function joinMeeting(uid, name, isModerator = false, avatarURL = nu
if (avatarURL) { if (avatarURL) {
params.avatarURL = avatarURL; params.avatarURL = avatarURL;
} }
if (loginURL) {
params.loginURL = loginURL;
}
return buildUrl('join', params); return buildUrl('join', params);
} }

View File

@@ -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 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);
const joinUrl = await joinMeeting(room.uid, req.user.name, true, avatarURL, appLoginUrl);
res.json({ joinUrl }); res.json({ joinUrl });
} catch (err) { } catch (err) {
console.error('Start meeting error:', 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 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 isModerator = isOwner || !!isShared || room.all_join_moderator;
const avatarURL = getUserAvatarURL(req, req.user); 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);
const joinUrl = await joinMeeting(room.uid, req.user.name, isModerator, avatarURL, appLoginUrl);
res.json({ joinUrl }); res.json({ joinUrl });
} catch (err) { } catch (err) {
console.error('Join meeting error:', 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 meeting not running but anyone_can_start, create it
if (!running && room.anyone_can_start) { 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 // Check moderator code
@@ -488,8 +490,7 @@ router.post('/:uid/guest-join', async (req, res) => {
const baseUrl = `${req.protocol}://${req.get('host')}`; const baseUrl = `${req.protocol}://${req.get('host')}`;
const guestAvatarURL = `${baseUrl}/api/auth/avatar/initials/${encodeURIComponent(name.trim())}`; 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);
const joinUrl = await joinMeeting(room.uid, name.trim(), isModerator, guestAvatarURL, appLoginUrl);
res.json({ joinUrl }); res.json({ joinUrl });
} catch (err) { } catch (err) {
console.error('Guest join error:', err); console.error('Guest join error:', err);