Environment & Bootstrap Stability: Fix Ghost Account and Modernize PWA Manifest

- Resolved 'Ghost Account' warning by updating layout hydration to align with V3 ID Vision (account_id vs account_id_random).
- Improved site lookup reliability using Agent API Key and structured EQ filters for exact FQDN matching (including ports).
- Modernized PWA manifest with maskable icons (PNG/WebP), app shortcuts, and unique installation IDs.
- Implemented automatic Electron 'Native' mode detection in root layout.
- Fixed stale API URLs in Launcher native file download logic.
- Added V3 migration documentation and JWT verification test scripts.
This commit is contained in:
Scott Idem
2026-01-19 16:44:20 -05:00
parent 08d0d9ca45
commit 25d6503afe
11 changed files with 341 additions and 83 deletions

View File

@@ -86,10 +86,21 @@
console.log(`$ae_api = `, $ae_api);
}
$ae_loc = {
...$ae_loc,
...(ae_acct.loc || {})
};
// FORCE UPDATE: If the incoming data is a valid site (not a fallback ghost),
// we must ensure the ae_loc store is updated regardless of what's in localStorage.
if (ae_acct.loc?.account_id && ae_acct.loc.account_id !== 'ghost') {
$ae_loc = {
...$ae_loc,
...(ae_acct.loc || {})
};
} else {
// If it IS a ghost, we still update it to show the correct fallback message
$ae_loc = {
...$ae_loc,
...(ae_acct.loc || {})
};
}
if (log_lvl > 1) {
console.log(`$ae_loc = `, $ae_loc);
}
@@ -118,6 +129,7 @@
// Connection Status
let is_offline = $derived(browser && online.current === false);
let api_unreachable = $derived($ae_loc?.account_id === 'ghost');
let api_error_msg = $derived($ae_loc?.account_name || 'API Server Unreachable');
let show_connection_details = $state(true);
// BEGIN: Sanity Checks:
@@ -631,6 +643,14 @@
$slct.sponsorship_cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
$ae_loc.mod.sponsorships.cfg_id = data.url.searchParams.get('sponsorship_cfg_id');
}
// *** Electron Native Mode Detection ***
// If window.native_app exists, we are running inside the Electron bridge
// @ts-ignore - native_app is injected by the Electron preload script
if (window.native_app) {
console.log('ELECTRON: Native environment detected. Switching to native app_mode.');
$events_loc.launcher.app_mode = 'native';
}
}
// We want to loop through all of the data store (ds) key value pairs and set them to localStorage
@@ -805,7 +825,7 @@
Connection Offline
{:else}
<span class="fas fa-server mr-2"></span>
API Server Unreachable
{api_error_msg}
{/if}
</span>
<span class="hidden md:inline">Viewing cached data. Changes may not be saved.</span>