mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-12 21:08:46 +00:00
사소한 리팩토링 2
This commit is contained in:
@@ -110,7 +110,7 @@ const encryptFile = limitFunction(
|
||||
|
||||
const thumbnail = await generateThumbnail(fileBuffer, fileType);
|
||||
const thumbnailBuffer = await thumbnail?.arrayBuffer();
|
||||
const thumbnailEncrypted = thumbnailBuffer ? await encryptData(thumbnailBuffer, dataKey) : null;
|
||||
const thumbnailEncrypted = thumbnailBuffer && (await encryptData(thumbnailBuffer, dataKey));
|
||||
|
||||
status.update((value) => {
|
||||
value.status = "upload-pending";
|
||||
@@ -126,8 +126,7 @@ const encryptFile = limitFunction(
|
||||
nameEncrypted,
|
||||
createdAtEncrypted,
|
||||
lastModifiedAtEncrypted,
|
||||
thumbnail: thumbnail &&
|
||||
thumbnailEncrypted && { plaintext: thumbnailBuffer, ...thumbnailEncrypted },
|
||||
thumbnail: thumbnailEncrypted && { plaintext: thumbnailBuffer, ...thumbnailEncrypted },
|
||||
};
|
||||
},
|
||||
{ concurrency: 4 },
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<TopBar title="썸네일" />
|
||||
<FullscreenDiv class="bg-gray-100 !px-0">
|
||||
<div class="flex flex-grow flex-col space-y-4">
|
||||
<div class="flex-shrink-0 bg-white p-4 !pt-0">
|
||||
<div class="bg-white p-4 !pt-0">
|
||||
<IconEntryButton icon={IconDelete} onclick={deleteAllFileThumbnailCaches} class="w-full">
|
||||
저장된 썸네일 모두 삭제하기
|
||||
</IconEntryButton>
|
||||
@@ -70,7 +70,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
{#if persistentStates.files.length > 0}
|
||||
<BottomDiv class="flex flex-col items-center gap-y-2 px-4">
|
||||
<BottomDiv class="px-4">
|
||||
<Button onclick={generateAllThumbnails} class="w-full">모두 썸네일 생성하기</Button>
|
||||
</BottomDiv>
|
||||
{/if}
|
||||
|
||||
@@ -27,7 +27,7 @@ export const persistentStates = $state({
|
||||
files: [] as File[],
|
||||
});
|
||||
|
||||
export const getGenerationStatus = (fileId: number): Writable<GenerationStatus> | undefined => {
|
||||
export const getGenerationStatus = (fileId: number) => {
|
||||
return workingFiles.get(fileId);
|
||||
};
|
||||
|
||||
@@ -39,6 +39,7 @@ const generateThumbnail = limitFunction(
|
||||
dataKey: CryptoKey,
|
||||
) => {
|
||||
status.set("generating");
|
||||
|
||||
const thumbnail = await doGenerateThumbnail(fileBuffer, fileType);
|
||||
if (!thumbnail) {
|
||||
status.set("error");
|
||||
@@ -47,7 +48,6 @@ const generateThumbnail = limitFunction(
|
||||
|
||||
const thumbnailBuffer = await thumbnail.arrayBuffer();
|
||||
const thumbnailEncrypted = await encryptData(thumbnailBuffer, dataKey);
|
||||
|
||||
status.set("upload-pending");
|
||||
return { plaintext: thumbnailBuffer, ...thumbnailEncrypted };
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user