Enhance: Implement exhaustive background caching and recursive data loading
- Implemented aggressive room-wide background caching engine in LauncherBackgroundSync.svelte. - Added inc_file_li and inc_all_file_li support to Event and Event Location object loaders for total room coverage. - Switched to proven V1 download path (/hosted_file/) to resolve V3 CRUD binary delivery issues. - Optimized Electron bridge with download locking and flat-hash storage matching legacy 'perfect' logic. - Standardized all Electron IPC methods and parameters to snake_case. - Added visual sync progress indicator for room caching status.
This commit is contained in:
@@ -90,30 +90,33 @@
|
||||
|
||||
// 1. NATIVE MODE (Electron)
|
||||
if ($ae_loc.is_native && $events_loc.launcher.app_mode === 'native') {
|
||||
const cacheRoot = $ae_loc.local_file_cache_path;
|
||||
const tempRoot = $ae_loc.host_file_temp_path;
|
||||
const cache_root = $ae_loc.local_file_cache_path;
|
||||
const temp_root = $ae_loc.host_file_temp_path;
|
||||
|
||||
open_file_clicked = true;
|
||||
open_file_status = 'checking_cache';
|
||||
open_file_status_message = 'Checking local cache...';
|
||||
|
||||
const exists = await native.check_hash_file_cache({ cacheRoot, hash: event_file_obj.hash_sha256 });
|
||||
const exists = await native.check_hash_file_cache({ cache_root, hash: event_file_obj.hash_sha256 });
|
||||
|
||||
if (!exists) {
|
||||
open_file_status = 'downloading_file';
|
||||
open_file_status_message = 'Downloading file to cache...';
|
||||
|
||||
const url = `${$ae_api.base_url}/v3/crud/hosted_file/${event_file_obj.hosted_file_id}/download`;
|
||||
const dlResult = await native.download_to_cache({
|
||||
// Use the PROVEN endpoint path from api.ts that is known to work in Default Mode.
|
||||
const url = `${$ae_api.base_url}/hosted_file/${event_file_obj.hosted_file_id}/download?return_file=true&filename=${encodeURIComponent(event_file_obj.filename)}`;
|
||||
|
||||
const dl_result = await native.download_to_cache({
|
||||
url,
|
||||
cacheRoot,
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
apiKey: $ae_api.api_secret_key
|
||||
api_key: $ae_api.api_secret_key,
|
||||
account_id: $ae_api.account_id
|
||||
});
|
||||
|
||||
if (!dlResult.success) {
|
||||
if (!dl_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Download failed: ${dlResult.error}`;
|
||||
open_file_status_message = `Download failed: ${dl_result.error}`;
|
||||
setTimeout(() => open_file_clicked = false, 5000);
|
||||
return;
|
||||
}
|
||||
@@ -122,16 +125,16 @@
|
||||
open_file_status = 'opening_file';
|
||||
open_file_status_message = 'Opening Application';
|
||||
|
||||
const launchResult = await native.launch_from_cache({
|
||||
cacheRoot,
|
||||
const launch_result = await native.launch_from_cache({
|
||||
cache_root,
|
||||
hash: event_file_obj.hash_sha256,
|
||||
tempRoot,
|
||||
temp_root,
|
||||
filename: event_file_obj.filename
|
||||
});
|
||||
|
||||
if (!launchResult.success) {
|
||||
if (!launch_result.success) {
|
||||
open_file_status = 'error';
|
||||
open_file_status_message = `Failed to open: ${launchResult.error}`;
|
||||
open_file_status_message = `Failed to open: ${launch_result.error}`;
|
||||
}
|
||||
|
||||
setTimeout(() => open_file_clicked = false, 5000);
|
||||
|
||||
Reference in New Issue
Block a user