diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index f1b581af..1fa24771 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -140,13 +140,32 @@ export async function load({ fetch, params, parent, route, url }) { site_domain_id: native_device_config.site_domain_id || native_device_config.site_domain_id_random, }; - // Inject native device metadata into the location state + // Inject native device metadata into the location state with SAFE MERGE if (native_device_config.native_device) { - ae_loc_init['native_device'] = native_device_config.native_device; + const incoming_dev = native_device_config.native_device; + + // 1. Recover existing user overrides from localStorage + let existing_dev = {}; + try { + const raw = localStorage.getItem('ae_loc'); + if (raw) existing_dev = JSON.parse(raw).native_device || {}; + } catch (e) {} + + // 2. Merge: Priority to EXISTING overrides for specific timers + ae_loc_init['native_device'] = { + ...incoming_dev, + // Persist these specific user-controlled fields + check_event_loop_period: (existing_dev as any).check_event_loop_period || incoming_dev.check_event_loop_period, + check_event_device_loop_period: (existing_dev as any).check_event_device_loop_period || incoming_dev.check_event_device_loop_period, + check_event_location_loop_period: (existing_dev as any).check_event_location_loop_period || incoming_dev.check_event_location_loop_period, + check_event_session_loop_period: (existing_dev as any).check_event_session_loop_period || incoming_dev.check_event_session_loop_period, + hash_prefix_length: (existing_dev as any).hash_prefix_length || incoming_dev.hash_prefix_length + }; + // Map specific operational paths - ae_loc_init['local_file_cache_path'] = native_device_config.native_device.local_file_cache_path; - ae_loc_init['host_file_temp_path'] = native_device_config.native_device.host_file_temp_path; - ae_loc_init['recording_path'] = native_device_config.native_device.recording_path; + ae_loc_init['local_file_cache_path'] = incoming_dev.local_file_cache_path; + ae_loc_init['host_file_temp_path'] = incoming_dev.host_file_temp_path; + ae_loc_init['recording_path'] = incoming_dev.recording_path; } // IMPORTANT: Update API settings with the native-authorized key if present diff --git a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte index 4277bfaa..21b2cf9f 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -1,8 +1,7 @@ -{#if currently_syncing && log_lvl} -