Fix: Standardize Electron bridge and implement robust caching

- Refactored all IPC methods and parameters to snake_case for consistency with SvelteKit.
- Implemented exhaustive background caching engine with download locking.
- Reverted to legacy-proven flat hash storage pattern (hash.file).
- Added axios for reliable stream-based binary downloads.
- Updated preload and main handlers to support recursive room data fetching.
This commit is contained in:
Scott Idem
2026-01-23 16:30:23 -05:00
parent 30db989b2c
commit 280de213c1
21 changed files with 665 additions and 24 deletions

View File

@@ -2,6 +2,8 @@ import { app, BrowserWindow, ipcMain } from 'electron';
import * as path from 'path';
import { loadSeedConfig } from './config_loader';
import { fetchFullConfig } from './api_client';
import { registerShellHandlers } from './shell_handlers';
import { registerFileHandlers } from './file_handlers';
import { SeedConfig } from '../shared/types';
let mainWindow: BrowserWindow | null = null;
@@ -27,7 +29,7 @@ async function createWindow() {
});
// Determine target URL based on hydrated config
let targetUrl = 'http://demo.localhost:5173'; // Default Dev Fallback
let targetUrl = 'http://demo.localhost:5173';
if (cachedFullConfig && cachedFullConfig.native_device) {
const device = cachedFullConfig.native_device;
@@ -35,7 +37,6 @@ async function createWindow() {
const locationId = device.event_location_id_random || device.event_location_id || '';
const host = device.app_base_url || 'demo.localhost:5173';
// In development, we likely want to stick to localhost even if app_base_url is set
const useHost = (host.includes('localhost')) ? host : 'demo.localhost:5173';
targetUrl = `http://${useHost}/events/${eventId}/launcher/${locationId}`;
@@ -53,6 +54,10 @@ async function createWindow() {
});
}
// Register OS-level handlers
registerShellHandlers();
registerFileHandlers();
app.on('ready', createWindow);
app.on('window-all-closed', () => {