fix(launcher): resolve 'download' filename bug and refactor data_url to global page state

- Updated 'handle_open_file' in launcher_file_cont.svelte to correctly pass filename to API.
- Fixed WebSocket ae_download command in launcher layout to include filename.
- Implemented a safety net in api_get_object.ts to extract filename from params if missing.
- Added 'download' attribute to Hosted Files download button for direct links.
- Refactored launcher menu components to use Svelte 5 global 'page' state instead of obsolete 'data_url' prop.
This commit is contained in:
Scott Idem
2026-02-10 19:12:55 -05:00
parent 72abd8034e
commit c5bfc140af
8 changed files with 22 additions and 18 deletions

View File

@@ -57,6 +57,10 @@ export const get_object = async function get_object({
return false;
}
if (!filename && params.filename) {
filename = params.filename;
}
const url = new URL(endpoint, api_cfg['base_url']);
Object.keys(params).forEach((key) => url.searchParams.append(key, params[key]));

View File

@@ -280,6 +280,7 @@
{#if show_direct_download}
<a
href={direct_download_url}
download={ae_util.clean_filename(final_filename)}
class={variant_classes}
title={`Direct download (V3 Action):\n${final_filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}...\nHosted ID: ${file_id}`}
>

View File

@@ -4,8 +4,8 @@
* Root layout for the launcher area.
* Ensures background sync runs globally regardless of active tab.
*/
import { ae_loc } from '$lib/stores/ae_stores';
import LauncherBackgroundSync from './launcher_background_sync.svelte';
// import { ae_loc } from '$lib/stores/ae_stores';
import Launcher_Background_Sync from './launcher_background_sync.svelte';
interface Props {
children?: import('svelte').Snippet;
@@ -15,7 +15,7 @@
</script>
<!-- Background Sync Process (Invisible) -->
<LauncherBackgroundSync log_lvl={1} />
<Launcher_Background_Sync log_lvl={1} />
<!-- Render the rest of the launcher UI -->
{@render children?.()}

View File

@@ -272,6 +272,7 @@
filename: obj_filename,
key: $ae_api.account_id
},
filename: obj_filename,
return_blob: true,
auto_download: true,
log_lvl: 1

View File

@@ -178,6 +178,7 @@
filename: filename,
x_no_account_id_token: 'direct-download'
},
filename: filename,
return_blob: true,
auto_download: true,
log_lvl: 1
@@ -199,6 +200,7 @@
filename: event_file_obj.filename,
x_no_account_id_token: 'direct-download'
},
filename: event_file_obj.filename,
return_blob: true,
auto_download: true,
log_lvl: 1

View File

@@ -1,7 +1,5 @@
<script lang="ts">
interface Props {
data_url: any;
lq__event_obj: any;
lq__event_event_file_obj_li: any;
@@ -28,8 +26,6 @@
}
let {
data_url,
lq__event_obj,
lq__event_event_file_obj_li,
@@ -168,7 +164,6 @@
{#if $ae_loc.edit_mode}
<Menu_location_list_menu
{data_url}
{lq__event_location_obj_li}
slct_event_location_id={$events_slct.event_location_id}
bind:loading__session_li_status
@@ -213,7 +208,6 @@
{#if $lq__event_session_obj_li}
<Menu_session_list_menu
{data_url}
bind:slct__event_session_id
bind:loading__session_id_status
{lq__event_session_obj_li}

View File

@@ -1,6 +1,5 @@
<script lang="ts">
interface Props {
data_url: any;
loading__session_li_status?: null | boolean | string;
lq__event_location_obj_li: any;
slct_event_location_id: string | null;
@@ -12,7 +11,6 @@
}
let {
data_url,
loading__session_li_status = $bindable(null),
lq__event_location_obj_li,
slct_event_location_id = null,
@@ -24,6 +22,7 @@
}: Props = $props();
// *** Import Svelte specific
import { page } from '$app/state';
import { goto } from '$app/navigation';
// import { liveQuery } from "dexie";
// import { tick } from 'svelte';
@@ -156,13 +155,14 @@
loading__session_li_status = true;
console.log('Remove fields from the URL.');
// data_url.searchParams.delete('location_id');
data_url.searchParams.delete('presentation_id');
data_url.searchParams.delete('presenter_id');
data_url.searchParams.delete('session_id');
let new_url_obj = new URL(page.url);
// new_url_obj.searchParams.delete('location_id');
new_url_obj.searchParams.delete('presentation_id');
new_url_obj.searchParams.delete('presenter_id');
new_url_obj.searchParams.delete('session_id');
// let url_location_id = slct_event_location_id;
// data_url.searchParams.set('location_id', url_location_id);
// new_url_obj.searchParams.set('location_id', url_location_id);
let new_url = `/events/${$events_slct.event_id}/launcher`;

View File

@@ -25,6 +25,7 @@
}: Props = $props();
// *** Import Svelte specific
import { page } from '$app/state';
import { goto } from '$app/navigation';
// import { liveQuery } from "dexie";
@@ -94,9 +95,10 @@
$events_sess.launcher.controller_trigger_send = true;
}
data_url.searchParams.set('session_id', event_session_id);
let new_url_obj = new URL(page.url);
new_url_obj.searchParams.set('session_id', event_session_id);
let new_url = data_url.toString();
let new_url = new_url_obj.toString();
if (log_lvl)
console.log(
`[UI Trace] Initiating SvelteKit goto... (+${(performance.now() - start).toFixed(2)}ms)`