mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-14 22:08:45 +00:00
파일 업로드가 완료된 후에 파일/디렉터리 목록이 갱신되지 않던 버그 수정 및 구현되지 않은 탭 임시 레이아웃 구현
This commit is contained in:
@@ -2,7 +2,7 @@ import { redirect } from "@sveltejs/kit";
|
|||||||
import type { PageServerLoad } from "./$types";
|
import type { PageServerLoad } from "./$types";
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ url, cookies }) => {
|
export const load: PageServerLoad = async ({ url, cookies }) => {
|
||||||
const redirectPath = url.searchParams.get("redirect") || "/";
|
const redirectPath = url.searchParams.get("redirect") || "/home";
|
||||||
|
|
||||||
const accessToken = cookies.get("accessToken");
|
const accessToken = cookies.get("accessToken");
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { PageLoad } from "./$types";
|
import type { PageLoad } from "./$types";
|
||||||
|
|
||||||
export const load: PageLoad = async ({ url }) => {
|
export const load: PageLoad = async ({ url }) => {
|
||||||
const redirectPath = url.searchParams.get("redirect") || "/";
|
const redirectPath = url.searchParams.get("redirect") || "/home";
|
||||||
return { redirectPath };
|
return { redirectPath };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { PageLoad } from "./$types";
|
import type { PageLoad } from "./$types";
|
||||||
|
|
||||||
export const load: PageLoad = async ({ url }) => {
|
export const load: PageLoad = async ({ url }) => {
|
||||||
const redirectPath = url.searchParams.get("redirect") || "/";
|
const redirectPath = url.searchParams.get("redirect") || "/home";
|
||||||
return { redirectPath };
|
return { redirectPath };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
import { page } from "$app/state";
|
import { page } from "$app/state";
|
||||||
import { AdaptiveDiv } from "$lib/components/divs";
|
import { AdaptiveDiv } from "$lib/components/divs";
|
||||||
|
|
||||||
@@ -26,7 +27,10 @@
|
|||||||
<div class="flex w-full justify-evenly px-4 py-2">
|
<div class="flex w-full justify-evenly px-4 py-2">
|
||||||
{#each pages as { path, label, icon: Icon }}
|
{#each pages as { path, label, icon: Icon }}
|
||||||
{@const textColor = !page.url.pathname.startsWith(path) ? "text-gray-600" : ""}
|
{@const textColor = !page.url.pathname.startsWith(path) ? "text-gray-600" : ""}
|
||||||
<button class="w-16 active:rounded-xl active:bg-gray-100 {textColor}">
|
<button
|
||||||
|
onclick={() => goto(path)}
|
||||||
|
class="w-16 active:rounded-xl active:bg-gray-100 {textColor}"
|
||||||
|
>
|
||||||
<div class="gap-y flex flex-col items-center gap-y-1 p-1 transition active:scale-95">
|
<div class="gap-y flex flex-col items-center gap-y-1 p-1 transition active:scale-95">
|
||||||
<Icon class="text-xl" fill="0" />
|
<Icon class="text-xl" fill="0" />
|
||||||
<p class="text-sm">{label}</p>
|
<p class="text-sm">{label}</p>
|
||||||
|
|||||||
3
src/routes/(main)/category/+page.svelte
Normal file
3
src/routes/(main)/category/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="flex h-full items-center justify-center py-4">
|
||||||
|
<p class="text-gray-500">아직 개발 중이에요.</p>
|
||||||
|
</div>
|
||||||
@@ -52,6 +52,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="my-4 flex flex-grow items-center justify-center">
|
<div class="my-4 flex flex-grow items-center justify-center">
|
||||||
<p class="text-gray-500">폴더가 비어있어요.</p>
|
<p class="text-gray-500">폴더가 비어 있어요.</p>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -39,35 +39,42 @@ export const requestDirectoryCreation = async (
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestFileUpload = async (
|
export const requestFileUpload = (file: File, parentId: "root" | number, masterKey: MasterKey) => {
|
||||||
file: File,
|
return new Promise<void>(async (resolve, reject) => {
|
||||||
parentId: "root" | number,
|
const { dataKey, dataKeyVersion } = await generateDataKey();
|
||||||
masterKey: MasterKey,
|
const fileEncrypted = await encryptData(await file.arrayBuffer(), dataKey);
|
||||||
) => {
|
const nameEncrypted = await encryptString(file.name, dataKey);
|
||||||
const { dataKey, dataKeyVersion } = await generateDataKey();
|
|
||||||
const fileEncrypted = await encryptData(await file.arrayBuffer(), dataKey);
|
|
||||||
const nameEncrypted = await encryptString(file.name, dataKey);
|
|
||||||
|
|
||||||
const form = new FormData();
|
const form = new FormData();
|
||||||
form.set(
|
form.set(
|
||||||
"metadata",
|
"metadata",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
parentId,
|
parentId,
|
||||||
mekVersion: masterKey.version,
|
mekVersion: masterKey.version,
|
||||||
dek: await wrapDataKey(dataKey, masterKey.key),
|
dek: await wrapDataKey(dataKey, masterKey.key),
|
||||||
dekVersion: dataKeyVersion,
|
dekVersion: dataKeyVersion,
|
||||||
contentType: file.type,
|
contentType: file.type,
|
||||||
contentIv: fileEncrypted.iv,
|
contentIv: fileEncrypted.iv,
|
||||||
name: nameEncrypted.ciphertext,
|
name: nameEncrypted.ciphertext,
|
||||||
nameIv: nameEncrypted.iv,
|
nameIv: nameEncrypted.iv,
|
||||||
} satisfies FileUploadRequest),
|
} satisfies FileUploadRequest),
|
||||||
);
|
);
|
||||||
form.set("content", new Blob([fileEncrypted.ciphertext]));
|
form.set("content", new Blob([fileEncrypted.ciphertext]));
|
||||||
|
|
||||||
// TODO: Progress, Scheduling, ...
|
// TODO: Progress, Scheduling, ...
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("POST", "/api/file/upload");
|
|
||||||
xhr.send(form);
|
xhr.addEventListener("load", () => {
|
||||||
|
if (xhr.status === 200) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject(new Error(xhr.responseText));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
xhr.open("POST", "/api/file/upload");
|
||||||
|
xhr.send(form);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const requestDirectoryEntryRename = async (
|
export const requestDirectoryEntryRename = async (
|
||||||
|
|||||||
3
src/routes/(main)/favorite/+page.svelte
Normal file
3
src/routes/(main)/favorite/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="flex h-full items-center justify-center py-4">
|
||||||
|
<p class="text-gray-500">아직 개발 중이에요.</p>
|
||||||
|
</div>
|
||||||
3
src/routes/(main)/home/+page.svelte
Normal file
3
src/routes/(main)/home/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="flex h-full items-center justify-center py-4">
|
||||||
|
<p class="text-gray-500">아직 개발 중이에요.</p>
|
||||||
|
</div>
|
||||||
3
src/routes/(main)/menu/+page.svelte
Normal file
3
src/routes/(main)/menu/+page.svelte
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="flex h-full items-center justify-center py-4">
|
||||||
|
<p class="text-gray-500">아직 개발 중이에요.</p>
|
||||||
|
</div>
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
<h1>Welcome to SvelteKit</h1>
|
|
||||||
<p>Visit <a href="https://svelte.dev/docs/kit">svelte.dev/docs/kit</a> to read the documentation</p>
|
|
||||||
6
src/routes/+server.ts
Normal file
6
src/routes/+server.ts
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import { redirect } from "@sveltejs/kit";
|
||||||
|
import type { RequestHandler } from "./$types";
|
||||||
|
|
||||||
|
export const GET: RequestHandler = () => {
|
||||||
|
redirect(302, "/home");
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user