feat(v3-auth): modernize hosted file access with simplified bypass pattern
- Roll out platform-wide standard for unauthenticated binary access using '?key=[account_id]' query parameter. - Update API helpers (get, post, patch) to recognize 'key' bypass and strip account context headers accordingly. - Refactor IDAA Bulletin Board to restore inline image rendering and edit-mode previews. - Modernize Events Launcher (Layout, Sync, Session View) to use V3 Action URLs with verified auth. - Update HTML generators in 'ae_utils.ts' to support the new authenticated URL structure. - Harden 'ae_comp__event_file_obj_tbl' CSV export and clipboard links with V3 standard patterns.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
|
||||
import Comp_hosted_files_upload from '$lib/ae_core/ae_comp__hosted_files_upload.svelte';
|
||||
import Element_manage_hosted_file_li_wrap from '$lib/elements/element_manage_hosted_file_li_all.svelte';
|
||||
import AE_Comp_Hosted_Files_Download_Button from '$lib/ae_core/ae_comp__hosted_files_download_button.svelte';
|
||||
|
||||
interface Props {
|
||||
log_lvl?: number;
|
||||
@@ -158,18 +159,6 @@
|
||||
|
||||
await update_journal_entry(updated_li);
|
||||
}
|
||||
|
||||
async function download_file(file: any) {
|
||||
const file_id = file.hosted_file_id || file.id || file.hosted_file_id;
|
||||
ae_promises[file_id] = api.download_hosted_file({
|
||||
api_cfg: $ae_api,
|
||||
hosted_file_id: file_id,
|
||||
return_file: true,
|
||||
filename: file.filename,
|
||||
auto_download: true,
|
||||
log_lvl: 0
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<section class="ae_section journal_entry_files w-full space-y-4 my-2">
|
||||
@@ -203,29 +192,20 @@
|
||||
{#each unified_file_li as file}
|
||||
{@const file_id = file.hosted_file_id || file.id || file.hosted_file_id}
|
||||
<div class="flex items-center justify-between p-3 rounded-xl bg-surface-50-950 border border-surface-500/10 group hover:border-primary-500 transition-all shadow-sm">
|
||||
<div class="flex items-center gap-3 overflow-hidden">
|
||||
<div class="text-primary-500 shrink-0">
|
||||
<span class="fas fa-{ae_util.file_extension_icon(file.extension)} fa-lg"></span>
|
||||
</div>
|
||||
<div class="flex flex-col overflow-hidden">
|
||||
<span class="text-sm font-bold truncate" title={file.filename}>{file.filename}</span>
|
||||
<span class="text-xs opacity-60 uppercase font-semibold">{file.extension} • {ae_util.format_bytes(file.size)}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-3 overflow-hidden grow">
|
||||
<AE_Comp_Hosted_Files_Download_Button
|
||||
hosted_file_id={file_id}
|
||||
hosted_file_obj={file}
|
||||
color="primary"
|
||||
variant="tonal"
|
||||
classes="w-full !justify-start !px-2"
|
||||
show_divider={true}
|
||||
max_filename={25}
|
||||
show_direct_download={$ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center gap-1">
|
||||
<button
|
||||
class="btn btn-sm variant-soft-primary"
|
||||
onclick={() => download_file(file)}
|
||||
title="Download file"
|
||||
>
|
||||
{#if ae_promises[file_id]}
|
||||
<Loader2 size="1.1em" class="animate-spin" />
|
||||
{:else}
|
||||
<Download size="1.1em" />
|
||||
{/if}
|
||||
</button>
|
||||
|
||||
<div class="flex items-center gap-1 ml-2">
|
||||
{#if $ae_loc.edit_mode}
|
||||
<button
|
||||
class="btn btn-sm variant-soft-error"
|
||||
|
||||
Reference in New Issue
Block a user