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:
8
dist/main/index.js
vendored
8
dist/main/index.js
vendored
@@ -37,6 +37,8 @@ const electron_1 = require("electron");
|
||||
const path = __importStar(require("path"));
|
||||
const config_loader_1 = require("./config_loader");
|
||||
const api_client_1 = require("./api_client");
|
||||
const shell_handlers_1 = require("./shell_handlers");
|
||||
const file_handlers_1 = require("./file_handlers");
|
||||
let mainWindow = null;
|
||||
let cachedSeed = null;
|
||||
let cachedFullConfig = null;
|
||||
@@ -57,13 +59,12 @@ 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;
|
||||
const eventId = device.event_id_random || device.event_id;
|
||||
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}`;
|
||||
}
|
||||
@@ -76,6 +77,9 @@ async function createWindow() {
|
||||
mainWindow = null;
|
||||
});
|
||||
}
|
||||
// Register OS-level handlers
|
||||
(0, shell_handlers_1.registerShellHandlers)();
|
||||
(0, file_handlers_1.registerFileHandlers)();
|
||||
electron_1.app.on('ready', createWindow);
|
||||
electron_1.app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
|
||||
Reference in New Issue
Block a user