more details with federation
Some checks failed
Build & Push Docker Image / build (push) Has been cancelled

This commit is contained in:
2026-02-27 15:51:46 +01:00
parent e5b6c225e9
commit d7d7991ff0
7 changed files with 131 additions and 10 deletions

View File

@@ -80,6 +80,9 @@ router.post('/invite', authenticateToken, async (req, res) => {
from_user: `${req.user.name}@${getFederationDomain()}`,
to_user: to,
room_name: room.name,
room_uid: room.uid,
max_participants: room.max_participants ?? 0,
allow_recording: room.record_meeting ?? 1,
message: message || null,
join_url: joinUrl,
timestamp: new Date().toISOString(),
@@ -126,7 +129,7 @@ router.post('/receive', async (req, res) => {
}
// Extract expected fields from the incoming payload
const { invite_id, from_user, to_user, room_name, message, join_url } = payload;
const { invite_id, from_user, to_user, room_name, room_uid, max_participants, allow_recording, message, join_url } = payload;
if (!invite_id || !from_user || !to_user || !room_name || !join_url) {
return res.status(400).json({ error: 'Incomplete invitation payload' });
@@ -177,6 +180,18 @@ router.post('/receive', async (req, res) => {
[invite_id, from_user, targetUser.id, room_name, message || null, join_url]
);
// Store room_uid, max_participants, allow_recording if those columns already exist
// (we update after initial insert to stay compatible with old schema)
const inv = await db.get('SELECT id FROM federation_invitations WHERE invite_id = ? AND to_user_id = ?', [invite_id, targetUser.id]);
if (inv && room_uid !== undefined) {
try {
await db.run(
'UPDATE federation_invitations SET room_uid = ?, max_participants = ?, allow_recording = ? WHERE id = ?',
[room_uid || null, max_participants ?? 0, allow_recording ?? 1, inv.id]
);
} catch { /* column may not exist on very old installs */ }
}
// Send notification email (fire-and-forget, don't fail the request if mail fails)
try {
const appUrl = process.env.APP_URL || '';
@@ -254,9 +269,15 @@ router.post('/invitations/:id/accept', authenticateToken, async (req, res) => {
);
if (!existing) {
await db.run(
`INSERT INTO federated_rooms (user_id, invite_id, room_name, from_user, join_url)
VALUES (?, ?, ?, ?, ?)`,
[req.user.id, invitation.invite_id, invitation.room_name, invitation.from_user, invitation.join_url]
`INSERT INTO federated_rooms (user_id, invite_id, room_name, from_user, join_url, meet_id, max_participants, allow_recording)
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,
[
req.user.id, invitation.invite_id, invitation.room_name,
invitation.from_user, invitation.join_url,
invitation.room_uid || null,
invitation.max_participants ?? 0,
invitation.allow_recording ?? 1,
]
);
}

View File

@@ -419,7 +419,7 @@ router.get('/:uid/public', async (req, res) => {
try {
const db = getDb();
const room = await db.get(`
SELECT r.uid, r.name, r.welcome_message, r.access_code,
SELECT r.uid, r.name, r.welcome_message, r.access_code, r.record_meeting, r.max_participants, r.anyone_can_start,
u.name as owner_name
FROM rooms r
JOIN users u ON r.user_id = u.id
@@ -439,6 +439,9 @@ router.get('/:uid/public', async (req, res) => {
owner_name: room.owner_name,
welcome_message: room.welcome_message,
has_access_code: !!room.access_code,
allow_recording: !!room.record_meeting,
max_participants: room.max_participants ?? 0,
anyone_can_start: !!room.anyone_can_start,
},
running,
});