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 };
}
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 += `<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) {
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);
}

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 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);