mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 06:58:46 +00:00
heic 파일에 대한 썸네일 지원 추가 및 카테고리 페이지에서도 파일의 썸네일이 표시되도록 개선
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
</script>
|
||||
|
||||
{#if isFileUploading($status.status)}
|
||||
<div class="flex h-14 items-center gap-x-4 p-2">
|
||||
<div class="flex-shrink-0 text-lg">
|
||||
<div class="flex h-14 gap-x-4 p-2">
|
||||
<div class="flex h-10 w-10 flex-shrink-0 items-center justify-center text-xl">
|
||||
<IconDraft class="text-gray-600" />
|
||||
</div>
|
||||
<div class="flex flex-grow flex-col overflow-hidden text-gray-800">
|
||||
|
||||
@@ -1,21 +1 @@
|
||||
import { callGetApi } from "$lib/hooks";
|
||||
import { decryptData } from "$lib/modules/crypto";
|
||||
import { storeFileThumbnail } from "$lib/modules/file";
|
||||
import { getThumbnailUrl } from "$lib/modules/thumbnail";
|
||||
import type { FileThumbnailInfoResponse } from "$lib/server/schemas";
|
||||
|
||||
export const requestFileThumbnailDownload = async (fileId: number, dataKey: CryptoKey) => {
|
||||
let res = await callGetApi(`/api/file/${fileId}/thumbnail`);
|
||||
if (!res.ok) return null;
|
||||
|
||||
const { contentIv: thumbnailEncryptedIv }: FileThumbnailInfoResponse = await res.json();
|
||||
|
||||
res = await callGetApi(`/api/file/${fileId}/thumbnail/download`);
|
||||
if (!res.ok) return null;
|
||||
|
||||
const thumbnailEncrypted = await res.arrayBuffer();
|
||||
const thumbnail = await decryptData(thumbnailEncrypted, thumbnailEncryptedIv, dataKey);
|
||||
|
||||
storeFileThumbnail(fileId, thumbnail); // Intended
|
||||
return getThumbnailUrl(thumbnail);
|
||||
};
|
||||
export { requestFileThumbnailDownload } from "$lib/services/file";
|
||||
|
||||
Reference in New Issue
Block a user