Saving changes from last night related to Jitsi.

This commit is contained in:
Scott Idem
2025-09-19 09:30:13 -04:00
parent 7a0ba7d571
commit 5527bce327
2 changed files with 126 additions and 1 deletions

View File

@@ -0,0 +1,125 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>IDAA Novi Jitsi iframe Test Page</title>
</head>
<body>
<script>
let novi_customer_uid = '<%=Novi.User.CustomerUniqueId%>'; // NOTE: The Novi UUID for the current current user/customer
console.log(`Novi's Current User's ID: ${novi_customer_uid}`);
// var novi_current_user_role = '<%=Novi.User.xyz%>';
// console.log(`Novi's Current User's Role: ${novi_current_user_role}`);
let novi_api_root_url = 'https://www.idaa.org/api';
let novi_api_key_for_idaa = 'CmNdWgdPmgluBWjiTd8xsUCk5mio8F1O9DYAh0pVDcg=';
let novi_current_user_obj = null;
let novi_current_user_email = null;
let is_moderator = true;
let idaa_osit_site_key = '8VTOJ0X5hvT6JdiTJsGEzQ'; // 'restricted-access'
// let idaa_ae_api_root_url = 'https://sk-idaa.oneskyit.com/idaa/jitsi_meet';
let idaa_ae_api_root_url = 'https://static.oneskyit.com/c/DgrZone/idaa_novi_iframe_jitsi.html';
let idaa_ae_params = new URLSearchParams(document.location.search);
// let idaa_ae_slct_event_id = idaa_ae_params.get('event_id');
let idaa_ae_iframe_height = null;
var novi_api_headers = new Headers();
novi_api_headers.append("Authorization", `Basic ${novi_api_key_for_idaa}`);
var requestOptions = {
method: 'GET',
headers: novi_api_headers,
redirect: 'follow'
};
let novi_api_get_customer_endpoint = `${novi_api_root_url}/customers/${novi_customer_uid}`;
console.log(novi_api_get_customer_endpoint);
fetch(novi_api_get_customer_endpoint, requestOptions)
// .then(response => response.text())
.then(response => response.json())
.then(result => {
novi_current_user_obj = result;
// console.log(`Novi's Current User Obj (${novi_current_user_obj.Email}):`, novi_current_user_obj);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_jitsi_meeting_iframe');
idaa_ae_iframe_element.src = `${idaa_ae_api_root_url}?uuid=${novi_customer_uid}&email=${novi_current_user_obj.Email}&full_name=${novi_current_user_obj.Name}&moderator=${is_moderator}&iframe=true&key=${idaa_osit_site_key}`;
// url.searchParams.delete('event_id');
// history.pushState({}, '', url);
})
.catch(error => console.log('error', error));
window.addEventListener('message', function(event) {
// console.log('Message received from the child:', event.data); // Message received from child
if (event.data) {
if (event.data.iframe_height) {
// console.log(`Got iframe height: ${event.data.iframe_height}`);
idaa_ae_iframe_height = event.data.iframe_height;
let idaa_ae_iframe_element = document.getElementById('ae_idaa_novi_meeting_iframe');
// idaa_ae_iframe_element.style.height = idaa_ae_iframe_height;
idaa_ae_iframe_element.style.height = `${idaa_ae_iframe_height+50}px`;
}
if (event.data.scroll_to !== undefined) {
console.log(`Got scroll_to: ${event.data.scroll_to}`);
let idaa_ae_iframe_element = document.getElementById('ae_idaa_novi_meeting_iframe');
if (idaa_ae_iframe_element) {
console.log(`Scrolling to: ${event.data.scroll_to}`);
// window.scrollTo(0, 0); // This works for all current browsers
window.scrollTo({
top: 0,
left: 0,
behavior: 'smooth'
});
// idaa_ae_iframe_element.scrollTo({x: 0, y: 0}); // Scroll to top
// document.body.scrollTo({x: 0, y: 0}); // Scroll to top
// document.body.scrollTo({
// top: 0,
// behavior: 'smooth'
// });
// document.body.scrollTop = 0;
// idaa_ae_iframe_element?.scrollTo(0, 0)
// idaa_ae_iframe_element.scrollTo({
// top: 0,
// behavior: 'smooth'
// });
// idaa_ae_iframe_element.scrollTo({
// top: event.data.scroll_to,
// behavior: 'smooth'
// });
} else {
console.warn(`Element with ID "ae_idaa_jitsi_meeting_iframe" not found.`);
}
}
} else {
console.log(`No data in message? ${event}`);
}
});
</script>
<!-- IDAA Aether Apps for Novi - Recovery Meetings (events) iframe -->
<p><iframe width="100%" height="950" id="ae_idaa_jitsi_meeting_iframe" src="" style="min-height: 950px; height: min-content; max-height: 2048px;" class="ae_idaa_iframe"></iframe></p>
</body>
</html>

View File

@@ -9,7 +9,7 @@
<h1>Testing the Jitsi Meet iframe API</h1>
<p>The URL parameters are passed from the Novi page that (will) contains this as an iframe. This will automatically set the attendees name, email address, and moderator status. The UUID is not currently used. There are <strong>many</strong> other options that can be set through the Jitsi API.</p>
<p>The URL parameters are passed from the Novi page that contains this as an iframe. This will automatically set the attendees name, email address, and moderator status. The UUID is not currently used. For now, everyone is set as moderator when viewing from this page. There are <strong>many</strong> other options that can be set through the Jitsi API.</p>
<div id="jitsi_meet_external_api_container" style="height: 750px; width: 100%;"></div>
<script src="https://jitsi.dgrzone.com/external_api.js"></script>