Fix: Persist native sync timers and implement monitor UI
- Implemented safe merge in root layout to preserve local timer overrides. - Added Native Sync Monitor UI to background sync component. - Exposed loop periods and hash prefix length in Launcher Config. - Ensured manual adjustments survive page refreshes.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user