diff --git a/src/lib/ae_events/ae_events__event_location.ts b/src/lib/ae_events/ae_events__event_location.ts index d1582171..cd548641 100644 --- a/src/lib/ae_events/ae_events__event_location.ts +++ b/src/lib/ae_events/ae_events__event_location.ts @@ -188,8 +188,8 @@ async function _handle_nested_loads(location_obj: any, { api_cfg, inc_file_li, i inc_all_file_li: inc_all_file_li, inc_presentation_li: true, inc_presenter_li: true, - enabled: 'all', - hidden: 'all', + enabled: 'enabled', + hidden: 'not_hidden', limit: 150, log_lvl }); diff --git a/src/lib/electron/electron_relay.ts b/src/lib/electron/electron_relay.ts index 70749a57..870bbbe9 100644 --- a/src/lib/electron/electron_relay.ts +++ b/src/lib/electron/electron_relay.ts @@ -1,76 +1,67 @@ /** - * Aether Native Bridge Relay (TypeScript) - * Standardizes communication between SvelteKit and the Electron Main process. + * electron_relay.ts + * TypeScript relay for Aether Native (Electron) Bridge. + * Standardizes all IPC calls to snake_case. */ -// Handle the standardized aetherNative bridge const native = (typeof window !== 'undefined') ? (window as any).aetherNative : null; -export async function get_device_config(): Promise { - if (!native) return null; - return await native.get_device_config(); +export const is_native = !!native; + +// 1. Core Config +export async function get_device_config() { + if (!native) return null; + return await native.get_device_config(); } -// --- File Operations --- - -export async function check_hash_file_cache({ cache_root, hash }: { cache_root: string; hash: string }): Promise { - if (!native) return false; - // Uses the specific bridge method instead of generic invoke - return await native.check_cache({ cache_root, hash }); +export async function get_device_info() { + if (!native) return null; + return await native.get_device_info(); } -export async function download_to_cache({ - url, - cache_root, - hash, - api_key, - account_id -}: { - url: string; - cache_root: string; - hash: string; - api_key: string; - account_id: string; -}): Promise<{ success: boolean; path?: string; error?: string }> { - if (!native) return { success: false, error: 'Native bridge not available' }; - return await native.download_to_cache({ url, cache_root, hash, api_key, account_id }); +// 2. File & Cache Management +export async function check_hash_file_cache({ cache_root, hash, hash_prefix_length = 2 }: any) { + if (!native) return false; + return await native.check_cache({ cache_root, hash, hash_prefix_length }); } -export async function launch_from_cache({ - cache_root, - hash, - temp_root, - filename -}: { - cache_root: string; - hash: string; - temp_root: string; - filename: string; -}): Promise<{ success: boolean; error?: string }> { - if (!native) return { success: false, error: 'Native bridge not available' }; - return await native.launch_from_cache({ cache_root, hash, temp_root, filename }); +export async function download_to_cache({ url, cache_root, hash, api_key, account_id, hash_prefix_length = 2 }: any) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.download_to_cache({ url, cache_root, hash, api_key, account_id, hash_prefix_length }); } -// --- OS Operations --- - -export async function open_folder(path: string): Promise { - if (!native) return; - return await native.open_folder(path); +export async function launch_from_cache({ cache_root, hash, temp_root, filename, hash_prefix_length = 2 }: any) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.launch_from_cache({ cache_root, hash, temp_root, filename, hash_prefix_length }); } -export async function run_cmd({ cmd, return_stdout = false }: { cmd: string; return_stdout?: boolean }): Promise { - if (!native) return false; - return await native.run_command({ cmd, return_stdout }); +// 3. OS Shell Commands (Phase 3) +export async function open_folder(path: string) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.open_folder(path); } -export async function run_cmd_sync({ cmd, return_stdout = false }: { cmd: string; return_stdout?: boolean }): Promise { - if (!native) return false; - // Legacy mapping to the same command handler - return await native.run_command({ cmd, return_stdout }); +export async function run_cmd({ cmd, timeout = 30000, return_stdout = true }: { cmd: string, timeout?: number, return_stdout?: boolean }) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.run_cmd({ cmd, timeout, return_stdout }); } -// --- Compatibility Aliases (Legacy) --- -export const open_local_file_v2 = launch_from_cache; -export const get_device_info = get_device_config; -export const run_osascript = async ({ cmd }: { cmd: string }) => await run_cmd({ cmd: `osascript -e '${cmd}'` }); -export const kill_processes = async ({ process_name }: { process_name: string }) => await run_cmd({ cmd: `pkill -f '${process_name}'` }); +export async function run_cmd_sync({ cmd, return_stdout = true }: { cmd: string, return_stdout?: boolean }) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.run_cmd_sync({ cmd, return_stdout }); +} + +export async function run_osascript(script: string) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.run_osascript(script); +} + +export async function kill_processes({ process_name_li = [] }: { process_name_li: string[] }) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.kill_processes({ process_name_li }); +} + +export async function open_local_file_v2(path: string) { + if (!native) return { success: false, error: 'Native bridge not available' }; + return await native.open_local_file_v2(path); +} \ No newline at end of file diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 9a61d0e7..1d79faeb 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -645,12 +645,17 @@ } // *** Electron Native Mode Detection *** - // If window.native_app or window.aetherNative exists, we are running inside the Electron bridge - // @ts-ignore - native_app is injected by legacy, aetherNative by new V3 bridge + // Explicitly set is_native if the bridge is detected, ensuring reactivity for all child components + // @ts-ignore if (window.native_app || window.aetherNative) { - console.log('ELECTRON: Native environment detected. Switching to native app_mode.'); - $events_loc.launcher.app_mode = 'native'; - $ae_loc.is_native = true; + if (!$ae_loc.is_native) { + console.log('ELECTRON: Native environment detected via window bridge.'); + $ae_loc.is_native = true; + } + // Ensure launcher mode is set to native if we're in the bridge + if ($events_loc?.launcher && $events_loc.launcher.app_mode !== 'native') { + $events_loc.launcher.app_mode = 'native'; + } } } diff --git a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte index 611494ea..4703dcc6 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_cfg.svelte @@ -68,7 +68,7 @@ {:else} {/if} - Native OS Folders + Native OS Handlers & Folders Active