mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 15:08:46 +00:00
썸네일 설정 페이지 완성
This commit is contained in:
@@ -94,7 +94,6 @@ const generateThumbnail = async (file: File, fileType: string) => {
|
||||
}
|
||||
return null;
|
||||
} catch {
|
||||
// TODO: Error handling
|
||||
return null;
|
||||
} finally {
|
||||
if (url) {
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
import { callGetApi } from "$lib/hooks";
|
||||
import { decryptData } from "$lib/modules/crypto";
|
||||
import { storeFileThumbnail } from "$lib/modules/file";
|
||||
import { getFileCache, storeFileCache, downloadFile, storeFileThumbnail } from "$lib/modules/file";
|
||||
import { getThumbnailUrl } from "$lib/modules/thumbnail";
|
||||
import type { FileThumbnailInfoResponse } from "$lib/server/schemas";
|
||||
|
||||
export const requestFileDownload = async (
|
||||
fileId: number,
|
||||
fileEncryptedIv: string,
|
||||
dataKey: CryptoKey,
|
||||
) => {
|
||||
const cache = await getFileCache(fileId);
|
||||
if (cache) return cache;
|
||||
|
||||
const fileBuffer = await downloadFile(fileId, fileEncryptedIv, dataKey);
|
||||
storeFileCache(fileId, fileBuffer); // Intended
|
||||
return fileBuffer;
|
||||
};
|
||||
|
||||
export const requestFileThumbnailDownload = async (fileId: number, dataKey: CryptoKey) => {
|
||||
let res = await callGetApi(`/api/file/${fileId}/thumbnail`);
|
||||
if (!res.ok) return null;
|
||||
|
||||
Reference in New Issue
Block a user