Fix: system bar hide logic for iframe and menu param overrides (IDAA embed reliability)
This commit is contained in:
@@ -90,6 +90,7 @@ async function verify_novi_uuid(
|
||||
api_key: string | null,
|
||||
api_root_url: string
|
||||
) {
|
||||
console.log(`IDAA Layout: Starting Novi UUID verification for ${uuid}...`);
|
||||
if (!api_key) {
|
||||
// No Novi API key in site config. All-or-nothing means no UUID-based access.
|
||||
console.warn(
|
||||
|
||||
@@ -518,6 +518,7 @@ onMount(async () => {
|
||||
'Jitsi: onMount - fetching user data and initializing Jitsi...'
|
||||
);
|
||||
}
|
||||
// $ae_loc.sys_menu.hide = true;
|
||||
|
||||
await fetch_novi_data();
|
||||
|
||||
|
||||
@@ -32,56 +32,56 @@ interface Props {
|
||||
|
||||
let { data, children }: Props = $props();
|
||||
|
||||
function add_activity_log({
|
||||
action = 'idaa_root_layout',
|
||||
action_with = 'none'
|
||||
}: {
|
||||
action?: string;
|
||||
action_with?: string;
|
||||
}) {
|
||||
let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
|
||||
// function add_activity_log({
|
||||
// action = 'idaa_root_layout',
|
||||
// action_with = 'none'
|
||||
// }: {
|
||||
// action?: string;
|
||||
// action_with?: string;
|
||||
// }) {
|
||||
// let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
|
||||
|
||||
let activity_description = `
|
||||
${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? 'no-email'}
|
||||
allow=${$ae_loc?.allow_access}
|
||||
last_cache_refresh=${last_cache_refresh_iso.toLocaleString()}
|
||||
data_route=${data?.route.toString() ?? 'unknown'}
|
||||
`;
|
||||
// let activity_description = `
|
||||
// ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? 'no-email'}
|
||||
// allow=${$ae_loc?.allow_access}
|
||||
// last_cache_refresh=${last_cache_refresh_iso.toLocaleString()}
|
||||
// data_route=${data?.route.toString() ?? 'unknown'}
|
||||
// `;
|
||||
|
||||
let data_kv = {
|
||||
external_client_id: data?.route.id,
|
||||
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
|
||||
description: activity_description ?? null,
|
||||
object_type: 'idaa', // archive, post, event
|
||||
// object_id: data?.route,
|
||||
url_root: data?.url.origin,
|
||||
// url_full_path: data?.url.href,
|
||||
url_full_path: data?.url.pathname,
|
||||
url_params: data?.url.searchParams.toString(),
|
||||
action: action,
|
||||
action_with: action_with ?? 'none',
|
||||
meta_json: {
|
||||
allow_access: $ae_loc?.allow_access,
|
||||
last_cache_refresh: $ae_loc?.last_cache_refresh,
|
||||
last_cache_refresh_iso: last_cache_refresh_iso.toISOString(),
|
||||
last_cache_refresh_locale: last_cache_refresh_iso.toLocaleString(),
|
||||
access_level: $ae_loc?.access_level,
|
||||
iframe: $ae_loc?.iframe
|
||||
// site_access_key: $ae_loc?.site_access_key,
|
||||
// site_domain_access_key: $ae_loc?.site_domain_access_key,
|
||||
// site_domain: $ae_loc?.site_domain,
|
||||
// extra_data: extra_data ?? '',
|
||||
// log_lvl: log_lvl,
|
||||
}
|
||||
};
|
||||
// let data_kv = {
|
||||
// external_client_id: data?.route.id,
|
||||
// name: `IDAA: ${$idaa_loc.novi_full_name ?? 'none'} ${$idaa_loc.novi_email ?? ''}`,
|
||||
// description: activity_description ?? null,
|
||||
// object_type: 'idaa', // archive, post, event
|
||||
// // object_id: data?.route,
|
||||
// url_root: data?.url.origin,
|
||||
// // url_full_path: data?.url.href,
|
||||
// url_full_path: data?.url.pathname,
|
||||
// url_params: data?.url.searchParams.toString(),
|
||||
// action: action,
|
||||
// action_with: action_with ?? 'none',
|
||||
// meta_json: {
|
||||
// allow_access: $ae_loc?.allow_access,
|
||||
// last_cache_refresh: $ae_loc?.last_cache_refresh,
|
||||
// last_cache_refresh_iso: last_cache_refresh_iso.toISOString(),
|
||||
// last_cache_refresh_locale: last_cache_refresh_iso.toLocaleString(),
|
||||
// access_level: $ae_loc?.access_level,
|
||||
// iframe: $ae_loc?.iframe
|
||||
// // site_access_key: $ae_loc?.site_access_key,
|
||||
// // site_domain_access_key: $ae_loc?.site_domain_access_key,
|
||||
// // site_domain: $ae_loc?.site_domain,
|
||||
// // extra_data: extra_data ?? '',
|
||||
// // log_lvl: log_lvl,
|
||||
// }
|
||||
// };
|
||||
|
||||
core_func.create_ae_obj__activity_log({
|
||||
api_cfg: $ae_api,
|
||||
account_id: $ae_loc.account_id,
|
||||
data_kv: data_kv,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
}
|
||||
// core_func.create_ae_obj__activity_log({
|
||||
// api_cfg: $ae_api,
|
||||
// account_id: $ae_loc.account_id,
|
||||
// data_kv: data_kv,
|
||||
// log_lvl: log_lvl
|
||||
// });
|
||||
// }
|
||||
|
||||
let box: any;
|
||||
let xLeft = $state(0);
|
||||
@@ -184,51 +184,53 @@ afterNavigate(() => {
|
||||
}
|
||||
});
|
||||
|
||||
let iframe = $derived(data.url.searchParams.get('iframe'));
|
||||
// let iframe = $derived(data.url.searchParams.get('iframe'));
|
||||
|
||||
$effect(() => {
|
||||
if (browser && iframe == 'true') {
|
||||
console.log('Use iframe layout!');
|
||||
// data_struct['iframe'] = iframe;
|
||||
$ae_loc.iframe = true;
|
||||
// $effect(() => {
|
||||
// if (browser && iframe == 'true') {
|
||||
// console.log('Use iframe layout!');
|
||||
// // data_struct['iframe'] = iframe;
|
||||
// // $ae_loc.iframe = true;
|
||||
|
||||
document.getElementsByTagName('html')[0].classList.add('iframe');
|
||||
// document.getElementsByTagName('html')[0].classList.remove('dark');
|
||||
// document.getElementsByTagName('html')[0].classList.remove('light');
|
||||
// // document.getElementsByTagName('html')[0].classList.add('iframe');
|
||||
// // document.getElementsByTagName('html')[0].classList.remove('dark');
|
||||
// // document.getElementsByTagName('html')[0].classList.remove('light');
|
||||
|
||||
// $ae_loc.app_cfg.show_element__access_type = false;
|
||||
// $ae_loc.app_cfg.show_element__cfg = false;
|
||||
} else if (browser && iframe == 'false') {
|
||||
// data_struct['iframe'] = false;
|
||||
$ae_loc.iframe = false;
|
||||
// // $ae_loc.app_cfg.show_element__access_type = false;
|
||||
// // $ae_loc.app_cfg.show_element__cfg = false;
|
||||
// } else if (browser && iframe == 'false') {
|
||||
// // data_struct['iframe'] = false;
|
||||
// // $ae_loc.iframe = false;
|
||||
|
||||
document.getElementsByTagName('html')[0].classList.remove('iframe');
|
||||
// data_struct['iframe'] = false;
|
||||
// WHY: The root layout sets sys_menu.hide=true when iframe=true, but never
|
||||
// restores it. We restore it here so the system bar reappears when the URL
|
||||
// param is explicitly set to false (e.g. admin toggling embed mode off).
|
||||
untrack(() => {
|
||||
$ae_loc.sys_menu.hide = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
// // document.getElementsByTagName('html')[0].classList.remove('iframe');
|
||||
// // data_struct['iframe'] = false;
|
||||
// // WHY: The root layout sets sys_menu.hide=true when iframe=true, but never
|
||||
// // restores it. We restore it here so the system bar reappears when the URL
|
||||
// // param is explicitly set to false (e.g. admin toggling embed mode off).
|
||||
// untrack(() => {
|
||||
// $ae_loc.sys_menu.hide = false;
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// When in iframe mode, the sys bar is hidden by default (it's nav chrome the host page
|
||||
// doesn't need). However, trusted admins should still get the menu — they can't update
|
||||
// the iframe src to pass show_menu=true, so we watch for trusted_access and unhide it.
|
||||
$effect(() => {
|
||||
if (browser && $ae_loc.iframe && $ae_loc.trusted_access) {
|
||||
// WHY the guard: ae_loc is a tracked dep here (reads above). Writing
|
||||
// $ae_loc.sys_menu.hide re-notifies this effect every run — infinite loop.
|
||||
// untrack() does NOT help: it prevents new dep reads but the store still
|
||||
// notifies already-subscribed effects after the write.
|
||||
// The idempotent write guard breaks the cycle: run 2 finds the value
|
||||
// already false, skips the write, no further re-queue.
|
||||
if ($ae_loc.sys_menu.hide !== false) {
|
||||
$ae_loc.sys_menu.hide = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// let show_menu = $derived(data.url.searchParams.get('show_menu'));
|
||||
// $effect(() => {
|
||||
// if (browser && $ae_loc.iframe && $ae_loc.trusted_access && show_menu === 'true') {
|
||||
// // WHY the guard: ae_loc is a tracked dep here (reads above). Writing
|
||||
// // $ae_loc.sys_menu.hide re-notifies this effect every run — infinite loop.
|
||||
// // untrack() does NOT help: it prevents new dep reads but the store still
|
||||
// // notifies already-subscribed effects after the write.
|
||||
// // The idempotent write guard breaks the cycle: run 2 finds the value
|
||||
// // already false, skips the write, no further re-queue.
|
||||
// if ($ae_loc.sys_menu.hide !== false) {
|
||||
// $ae_loc.sys_menu.hide = false;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
$effect(() => {
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user