From b697126495d478e1d37b692fb9854ac5e9b30738 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 13 May 2026 10:26:01 -0400 Subject: [PATCH] refactor(launcher): prefer launch_profiles naming\n\nRename the public launcher override concept to launch_profiles across the task list\nand docs, while keeping launch_scripts as a compatibility alias for older device records. Update the Svelte resolver to read both keys so per-device tweaks remain backward compatible during the transition. --- .../MODULE__AE_Events_PressMgmt_Launcher.md | 7 ++++--- ...__AE_Events_Launcher_Native_integration.md | 8 +++++--- documentation/TODO__Agents.md | 8 ++++---- src/lib/electron/electron_relay.ts | 3 ++- .../(launcher)/launcher_file_cont.svelte | 20 +++++++++++++------ 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/documentation/MODULE__AE_Events_PressMgmt_Launcher.md b/documentation/MODULE__AE_Events_PressMgmt_Launcher.md index 39e70e90..a5a9b582 100644 --- a/documentation/MODULE__AE_Events_PressMgmt_Launcher.md +++ b/documentation/MODULE__AE_Events_PressMgmt_Launcher.md @@ -312,11 +312,12 @@ The Electron app zero-configs itself: 4. OS opens the file (Keynote, PowerPoint, Preview, etc.) **Configurable launch behavior:** The open/launch command in step 4 can be overridden -per file extension via `event_device.data_json.launch_scripts` (device-level config) or -`event.launcher.launch_scripts` (event-level fallback). Templates use `{{path}}` as the +per file extension via `event_device.data_json.launch_profiles` (device-level config) or +`event.launcher.launch_profiles` (event-level fallback). Templates use `{{path}}` as the file path placeholder; AppleScript or `shell:` prefixed commands are both supported. No Electron rebuild required to change how files open — edit config in Aether and it applies -immediately. See `PROJECT__AE_Events_Launcher_Native_integration.md` Section 8. +immediately. Legacy `launch_scripts` keys are still accepted by the resolver for older data. +See `PROJECT__AE_Events_Launcher_Native_integration.md` Section 8. Versioning is handled automatically: when a presenter uploads an updated file, the new hash is cached separately and the old one remains intact. diff --git a/documentation/PROJECT__AE_Events_Launcher_Native_integration.md b/documentation/PROJECT__AE_Events_Launcher_Native_integration.md index 2ae52724..2a32409e 100644 --- a/documentation/PROJECT__AE_Events_Launcher_Native_integration.md +++ b/documentation/PROJECT__AE_Events_Launcher_Native_integration.md @@ -199,15 +199,17 @@ temp directory (after the atomic copy from cache). ### Where to Configure -Templates are resolved in priority order by `get_launch_script_template()` in +Launch profiles are resolved in priority order by `get_launch_profile()` in `launcher_file_cont.svelte`: -1. **`event_device.data_json.launch_scripts`** — API-driven, per-device. Highest priority. +1. **`event_device.data_json.launch_profiles`** — API-driven, per-device. Highest priority. Set via the `event_device` record (Pres Mgmt → Device Management or direct DB edit). -2. **`$events_loc.launcher.launch_scripts`** — Local persistent config. Editable via the +2. **`$events_loc.launcher.launch_profiles`** — Local persistent config. Editable via the Launcher config UI (planned) or direct `localStorage` manipulation. If neither is set, `script_template` is `null` and Electron uses its built-in hardcoded defaults. +Legacy `launch_scripts` keys remain accepted as compatibility aliases in the resolver so older +device records continue to work while the preferred schema is `launch_profiles`. ### Key Format diff --git a/documentation/TODO__Agents.md b/documentation/TODO__Agents.md index 15a9fe7a..983f143d 100644 --- a/documentation/TODO__Agents.md +++ b/documentation/TODO__Agents.md @@ -20,7 +20,7 @@ thin OS primitive layer; all business logic lives in Svelte and device config. **Svelte-side migration — remaining before May 26:** - [ ] **[Launcher] Built-in Svelte default templates** — move the "known good" pptx/key/pdf AppleScript strings out of Electron hardcode and into a Svelte constants file (e.g. - `ae_launcher__default_launch_scripts.ts`). Priority: `get_launch_script_template()` already + `ae_launcher__default_launch_profiles.ts`). Priority: `get_launch_profile()` already checks device config and event config; add a 3rd fallback to these Svelte defaults before returning `null`. This means Electron's hardcoded defaults become the last-resort only. - [ ] **[Launcher] Composable open flow** — refactor `handle_open_file()` to use @@ -37,9 +37,9 @@ thin OS primitive layer; all business logic lives in Svelte and device config. - [ ] **[Launcher] `kill_processes` target list in config** — process names to kill on cleanup are currently caller-hardcoded. Allow device config to specify the process name list per file type / app, so adding a new presentation app doesn't require a Svelte code change. -- [ ] **[Launcher] Launcher config UI — launch_scripts editor** — add a Technical Mode panel - in the Launcher config (tabbed settings) to view and edit `launch_scripts` entries on the - active device record. PATCH via `event_device` V3 CRUD. Lets OSIT staff tune scripts onsite +- [ ] **[Launcher] Launcher config UI — launch_profiles editor** — add a Technical Mode panel + in the Launcher config (tabbed settings) to view and edit `launch_profiles` entries on the + active device record. PATCH via `event_device` V3 CRUD. Lets OSIT staff tune launch behavior onsite without needing phpMyAdmin or a code deploy. - [ ] **[Launcher] End-to-end test on macOS** — test pptx and key opens on a real podium Mac before May 26 setup day. Verify: file copies to tmp correctly, script fires, app opens in diff --git a/src/lib/electron/electron_relay.ts b/src/lib/electron/electron_relay.ts index f8c2c73e..a74a8f0b 100644 --- a/src/lib/electron/electron_relay.ts +++ b/src/lib/electron/electron_relay.ts @@ -80,7 +80,8 @@ export async function launch_from_cache({ * - AppleScript: multi-line string with {{path}} placeholder (macOS only) * - Shell command: prefix with "shell:" → e.g. "shell:open \"{{path}}\"" * - * Configure via event_device.data_json.launch_scripts or $events_loc.launcher.launch_scripts. + * Configure via event_device.data_json.launch_profiles or $events_loc.launcher.launch_profiles. + * Legacy launch_scripts keys are still accepted by the Svelte resolver for older records. * If null, Electron falls through to its built-in hardcoded defaults. */ script_template?: string | null; diff --git a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte index aef975c2..c8250d5c 100644 --- a/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte +++ b/src/routes/events/[event_id]/(launcher)/launcher_file_cont.svelte @@ -118,18 +118,26 @@ let screen_saver_exts = ['jpg', 'png', 'PNG', 'webp']; /** * Resolves the LaunchProfile for a given file extension and optional per-file * display override. Checked in priority order: - * 1. event_device.data_json.launch_profiles (API-driven, per-device) - * 2. $events_loc.launcher.launch_profiles (local persistent override) - * 3. DEFAULT_LAUNCH_PROFILES[ext] (Svelte built-in defaults) - * 4. DEFAULT_LAUNCH_PROFILES['default'] (catch-all) + * 1. event_device.data_json.launch_profiles (API-driven, per-device) + * 2. event_device.data_json.launch_scripts (legacy alias) + * 3. $events_loc.launcher.launch_profiles (local persistent override) + * 4. $events_loc.launcher.launch_scripts (legacy alias) + * 5. DEFAULT_LAUNCH_PROFILES[ext] (Svelte built-in defaults) + * 6. DEFAULT_LAUNCH_PROFILES['default'] (catch-all) * Per-file display_override from event_file.cfg_json overrides display_mode only. */ function get_launch_profile( extension: string, file_obj?: any ): LaunchProfile { - const device_profiles = ($ae_loc as any).native_device?.launch_profiles ?? null; - const local_profiles = ($events_loc as any).launcher?.launch_profiles ?? null; + const device_profiles = + ($ae_loc as any).native_device?.launch_profiles ?? + ($ae_loc as any).native_device?.launch_scripts ?? + null; + const local_profiles = + ($events_loc as any).launcher?.launch_profiles ?? + ($events_loc as any).launcher?.launch_scripts ?? + null; const display_override = file_obj?.cfg_json?.display_override ?? null; return resolve_launch_profile(extension, display_override, device_profiles, local_profiles); }