feat(launcher): harden native caching and telemetry; consolidate documentation

- Implemented SHA-256 integrity checks and stale temp purge in native download logic.\n- Enabled strict hash verification in background sync cycle.\n- Made CPU load gauge dynamic using real-time loadavg metadata.\n- Consolidated native app documentation into single master manual.\n- Marked legacy electron_native.js as deprecated.\n- Updated roadmap with temp cleanup and launch protection tasks.
This commit is contained in:
Scott Idem
2026-02-10 14:07:45 -05:00
parent 6abfff293c
commit b5b44e4016
16 changed files with 990 additions and 48 deletions

View File

@@ -9,6 +9,18 @@
let { on_expand }: Props = $props();
// Derived Usage Percentage for Visuals
let cpu_load_pct = $derived.by(() => {
const meta = $ae_loc.native_device?.meta_json;
// loadavg is [1m, 5m, 15m] - use 1m load
if (!meta?.loadavg || !Array.isArray(meta.loadavg)) return 15;
// Load average is usually 0.0 to N (cores). Normalize to 0-100 based on cores if available.
const load = meta.loadavg[0];
const cores = (meta.cpus || []).length || 1;
const pct = Math.round((load / cores) * 100);
return Math.min(Math.max(pct, 5), 100); // Clamp 5-100
});
let ram_usage_pct = $derived.by(() => {
const meta = $ae_loc.native_device?.meta_json;
if (!meta?.total_mem || !meta?.free_mem) return 0;
@@ -51,14 +63,14 @@
>CPU Architecture: {$ae_loc.native_device?.meta_json
?.arch || '...'}</span
>
<span>Load: Healthy</span>
<span>Load: {cpu_load_pct}%</span>
</div>
<div
class="w-full h-1.5 bg-surface-500/20 rounded-full overflow-hidden"
>
<div
class="h-full bg-primary-500 transition-all duration-1000"
style="width: 15%"
class="h-full transition-all duration-1000 {get_usage_color(cpu_load_pct)}"
style="width: {cpu_load_pct}%"
></div>
</div>
</div>

View File

@@ -150,7 +150,8 @@
const exists = await native.check_hash_file_cache({
cache_root,
hash: file_obj.hash_sha256,
hash_prefix_length: prefix_len
hash_prefix_length: prefix_len,
verify_hash: true // Hardened check: Perform full SHA-256 verify if file exists
});
if (exists) {
@@ -238,7 +239,10 @@
if (info) {
update_payload.info_hostname = info.hostname;
update_payload.info_ip_list = info.ip_addresses.join(', ');
// Safely handle IP list (bridge may return ip_addresses or networkInterfaces)
const ips = info.ip_addresses || [];
update_payload.info_ip_list = Array.isArray(ips) ? ips.join(', ') : 'Unknown';
update_payload.meta_json = {
platform: info.platform,
release: info.release,