- Broke down the massive launcher_cfg.svelte into 7 modular sub-components. - Updated electron_relay.ts with Phase 5 presentation controls and manifest tools. - Updated architecture documentation to reflect the new TypeScript-based native bridge.
Electron Integration (Events - Launcher)
This document describes the Electron integration for the Aether Svelte application, which provides native capabilities for the Events module, specifically for the Event Launcher functionality.
Overview
The Event Launcher is not a standalone module but rather a set of native functions and UI elements integrated into the Events module. It is designed to be used in a hybrid event scenario where a local application (the Electron app) is used to control presentations and other event-related content on a local machine.
Architecture
The Electron integration is composed of three main parts:
- Electron Main Process (
electron.js): The main process of the Electron application. It is responsible for creating the browser window and handling communication with the renderer process. - Native Functions (
src/lib/electron/electron_native.js): A set of functions that are executed in the Electron main process and have access to the operating system's native APIs. These functions provide the core functionality for the Event Launcher, such as opening files, running commands, and managing processes. - Relay/Bridge (
src/lib/electron/electron_relay.js): A bridge that exposes the native functions to the Svelte application running in the renderer process. This allows the Svelte components to call the native functions.
Key Functionality
The native functions in electron_native.js provide the following key functionalities for the Event Launcher:
- File Caching:
check_hash_file_cache(): Checks if a file with a specific hash exists in the local cache.download_hash_file_to_cache(): Downloads a file from the API and stores it in the local cache.
- File Operations:
open_hash_file_to_temp(): Copies a file from the cache to a temporary directory and opens it.open_local_file(): Opens a local file.
- Process Management:
kill_processes(): Kills processes by name or ID. This is used to close presentation applications after a presentation is finished.
- Command Execution:
run_osascript(): Runs an AppleScript command (macOS only).run_cmd(): Runs a shell command.
- Device Information:
get_device_info(): Gets information about the device, which can be used for logging and debugging.
UI Integration
The Event Launcher functionality is integrated into the Events module's UI as follows:
- Launcher Links: In the list of event sessions, there are "launcher" links that, when clicked, trigger the native launcher functionality.
- Configuration: The visibility and behavior of the launcher links are controlled by the
mod_pres_mgmt_jsonconfiguration in theEventobject. This allows for fine-grained control over the launcher functionality on a per-event basis.
How it Works
- The Svelte application, running in the Electron renderer process, displays a list of event sessions.
- For each session, a "launcher" link is displayed if the configuration allows it.
- When the user clicks on a launcher link, a function in
electron_relay.jsis called. - The relay function then calls the corresponding native function in
electron_native.jsvia the Electron context bridge. - The native function performs the requested action, such as downloading a file, opening a presentation, or running a command.