diff --git a/static/jitsi_iframe_api.html b/static/jitsi_iframe_api.html index 10d9d989..b60eabd2 100644 --- a/static/jitsi_iframe_api.html +++ b/static/jitsi_iframe_api.html @@ -46,36 +46,53 @@ // 1. Function to fetch the JWT from your backend async function getJitsiJwt() { - // This is the URL of your backend API endpoint. - // It's a server-side route that will create the JWT for you. const tokenEndpoint = 'https://api.oneskyit.com/api/jitsi_token'; - // Pass user information and moderator status to the backend + // This payload now correctly separates features, settings, and config overrides. + // The backend will place these into the correct locations in the JWT. const payload = { room: room_name, name: display_name, email: email, - is_moderator: is_moderator + is_moderator: is_moderator, + + // 'features': For enabling/disabling major Jitsi tools + features: { + livestreaming: false, + recording: false, + transcription: false, + }, + + // 'settings': For moderator default checkboxes in the settings panel + settings: { + startMuted: true, // Corresponds to "Everyone starts muted" + startHidden: true, // Corresponds to "Everyone starts hidden" + followMe: false, // Corresponds to "Everyone follows me" + reactionsMuted: true // Corresponds to "Mute reaction sounds for everyone" + }, + + // 'config': For overriding properties from the server's config.js file + config: { + // This disables the reactions feature entirely. If you want reactions to be + // available but just have the sounds muted by default, set this to 'false'. + disableReactions: true, + } + }; - console.log('Requesting JWT with payload:', payload); try { const response = await fetch(tokenEndpoint, { method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, + headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }); - if (!response.ok) { - throw new Error('Failed to fetch JWT token from the server.'); - } + if (!response.ok) throw new Error('Failed to fetch JWT token from the server.'); const data = await response.json(); - return data.token; // Your backend should return a JSON object like { "token": "..." } - } catch (error) { - console.error('Error getting JWT:', error); + return data.token; // expect { token: "..." } + } catch (err) { + console.error('Error getting JWT:', err); return null; } } @@ -85,9 +102,7 @@ let jwtToken = null; if (is_moderator) { jwtToken = await getJitsiJwt(); - if (!jwtToken) { - // Handle the error (e.g., show a message to the user) document.getElementById('jitsi_meet_external_api_container').innerHTML = '