파일 업로드/다운로드 현황을 모두 볼 수 있는 페이지 구현

This commit is contained in:
static
2025-01-18 10:26:35 +09:00
parent bde090c464
commit 811713cd03
21 changed files with 322 additions and 52 deletions

View File

@@ -2,22 +2,22 @@
import { onMount } from "svelte";
import { get } from "svelte/store";
import { goto as svelteGoto } from "$app/navigation";
import { fileUploadStatusStore, clientKeyStore, masterKeyStore } from "$lib/stores";
import {
fileUploadStatusStore,
fileDownloadStatusStore,
isFileUploading,
isFileDownloading,
clientKeyStore,
masterKeyStore,
} from "$lib/stores";
import "../app.css";
let { children } = $props();
const checkFileUploadStatus = (e: BeforeUnloadEvent) => {
const protectFileUploadAndDownload = (e: BeforeUnloadEvent) => {
if (
$fileUploadStatusStore.some((statusStore) => {
const status = get(statusStore);
return (
status.status === "encryption-pending" ||
status.status === "encrypting" ||
status.status === "upload-pending" ||
status.status === "uploading"
);
})
$fileUploadStatusStore.some((status) => isFileUploading(get(status).status)) ||
$fileDownloadStatusStore.some((status) => isFileDownloading(get(status).status))
) {
e.preventDefault();
}
@@ -41,6 +41,6 @@
});
</script>
<svelte:window onbeforeunload={checkFileUploadStatus} />
<svelte:window onbeforeunload={protectFileUploadAndDownload} />
{@render children()}