Work on file uploads and manage.

This commit is contained in:
Scott Idem
2025-07-22 19:02:16 -04:00
parent 1e94043e19
commit 47eb745f3b
5 changed files with 61 additions and 18 deletions

View File

@@ -108,7 +108,7 @@ $effect(() => {
});
}}
title={`Download this file:\n${filename ?? hosted_file_obj.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256.slice(0, 10)}...\nHosted ID: ${hosted_file_obj.hosted_file_id_random}\n Linked to: ${linked_to_type} ID: ${linked_to_id}`}
title={`Download this file:\n${filename ?? hosted_file_obj?.filename}\n[API] SHA256: ${hosted_file_obj?.hash_sha256?.slice(0, 10)}...\nHosted ID: ${hosted_file_obj?.hosted_file_id_random}\n Linked to: ${linked_to_type} ID: ${linked_to_id}`}
>
{#await ae_promises[hosted_file_obj.hosted_file_id_random]}
<span class="fas fa-spinner fa-spin mx-1"></span>

View File

@@ -166,12 +166,20 @@ async function handle_input_upload_files(
hosted_file_obj_li.push(hosted_file_obj);
let hosted_file_data: key_val = {};
hosted_file_data['id'] = hosted_file_id;
hosted_file_data['hosted_file_id'] = hosted_file_id;
hosted_file_data['hosted_file_id_random'] = hosted_file_id;
hosted_file_data['for_type'] = link_to_type;
hosted_file_data['for_id'] = link_to_id;
hosted_file_data['for_id_random'] = link_to_id;
hosted_file_data['hash_sha256'] = hosted_file_obj.hash_sha256;
hosted_file_data['filename'] = hosted_file_obj.filename;
hosted_file_data['extension'] = hosted_file_obj.extension;
hosted_file_data['content_type'] = hosted_file_obj.content_type;
hosted_file_data['size'] = hosted_file_obj.size;
hosted_file_data['enable'] = true;
hosted_file_data['created_on'] = hosted_file_obj.created_on;
hosted_file_data['updated_on'] = hosted_file_obj.updated_on;
console.log(hosted_file_data);
hosted_file_obj_kv[hosted_file_id] = hosted_file_data;

View File

@@ -69,7 +69,8 @@ let lq__hosted_file_obj_li = $derived(liveQuery(async () => {
results = await db_core.file
.where(dq__where_val)
.equals(dq__where_eq_val)
.sortBy('created_on');
.sortBy('created_on')
;
} else if (file_type == 'video') {
// Handle video/mp4, video/mov, video/webm. If the content type is prefixed with "video/", then it is a video file.
let extension = 'mp4';