More work on making things right for IDAA.

This commit is contained in:
Scott Idem
2025-06-02 16:47:33 -04:00
parent a2e4c710a0
commit b97e4002bc
2 changed files with 57 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
/** @type {import('./$types').LayoutData} */
// /** @type {import('./$types').LayoutProps} */
let log_lvl: number = 2;
let log_lvl: number = 1;
// *** Import Svelte specific
// import { tick } from 'svelte';
@@ -179,8 +179,8 @@ if ($ae_loc && $ae_sess && ($ae_loc?.ver != $ae_sess?.ver)) {
// Minutes reference:
// 240 = 4 hours; 720 = 12 hours; 2880 = 48 hours; 7200 = 5 days;
// 10080 = 1 week; 20160 = 2 weeks; 43200 = 1 month;
let default_refresh_minutes: number = 7200; // default was 4 hours
let authenticated_refresh_minutes: number = 10080; // default was 12 hours
let default_refresh_minutes: number = 20160; // 7200; // default was 4 hours
let authenticated_refresh_minutes: number = 20160; // 10080; // default was 12 hours
let trusted_refresh_minutes: number = 20160; // default was 1 week
let manager_refresh_minutes: number = 20160; // default was 2 weeks
if ($ae_loc?.site_cfg_json?.default_refresh_minutes) {

View File

@@ -1,6 +1,7 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
let log_lvl: number = 1;
// Imports
// *** Import Svelte specific
@@ -14,6 +15,7 @@ import type {
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
import { core_func } from '$lib/ae_core/ae_core_functions';
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
import Element_data_store from '$lib/element_data_store_v2.svelte';
@@ -26,6 +28,58 @@ const modalRegistry: Record<string, ModalComponent> = {
let { data, children }: Props = $props();
function add_activity_log(
{
action = 'idaa_root_layout',
}: {
action?: string,
}
) {
let last_cache_refresh_iso = new Date($ae_loc?.last_cache_refresh);
let data_kv = {
external_client_id: data?.route.id,
name: `IDAA: ${$idaa_loc.novi_full_name ?? 'no-name'} ${$idaa_loc.novi_email ?? 'no-email'} allow=${$ae_loc?.allow_access}`,
object_type: 'idaa', // archive, post, event
// object_id_random: 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,
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
});
}
if (browser) {
add_activity_log(
{
action: 'idaa_root_layout - browser',
}
);
}
</script>
<svelte:head>