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 21b2cf9f..b5f40315 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_background_sync.svelte @@ -122,6 +122,65 @@ is_syncing = false; } } + + /** + * Device Heartbeat & Telemetry + * Gathers OS info and updates the device record in the cloud. + */ + async function run_device_heartbeat() { + const device_id = $ae_loc.native_device?.event_device_id || $ae_loc.native_device?.id; + if (!device_id) return; + + try { + const info = await native.get_device_info(); + if (!info) return; + + const update_payload = { + heartbeat: new Date().toISOString(), + info_hostname: info.hostname, + info_ip_list: info.ip_addresses.join(', '), + meta_json: { + platform: info.platform, + release: info.release, + arch: info.arch, + cpus: info.cpus, + total_mem: Math.round(info.total_mem / (1024 * 1024)) + 'MB', + free_mem: Math.round(info.free_mem / (1024 * 1024)) + 'MB' + } + }; + + await events_func.update_ae_obj__event_device({ + api_cfg: $ae_api, + event_device_id: device_id, + data_kv: update_payload, + log_lvl: 0 + }); + + if (log_lvl > 1) console.log('Sync: Device heartbeat SUCCESS.'); + } catch (err) { + console.error('Sync: Device heartbeat FAILED:', err); + } + } + + /** + * Location Config Refresh + * Ensures we have latest room settings. + */ + async function refresh_location_config() { + const location_id = $events_slct.event_location_id; + if (!location_id) return; + + try { + await events_func.load_ae_obj_id__event_location({ + api_cfg: $ae_api, + event_location_id: location_id, + try_cache: true, + log_lvl: 0 + }); + } catch (err) { + console.error('Sync: Location refresh FAILED:', err); + } + }