From 1cabc5f7b3d7fcd388bb66008feb8e9eaa46c3cd Mon Sep 17 00:00:00 2001 From: static Date: Tue, 7 Jan 2025 00:09:32 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=84=ED=9A=A8=EC=9C=A8=EC=A0=81=EC=9D=B8?= =?UTF-8?q?=20=EB=94=94=EB=A0=89=ED=84=B0=EB=A6=AC=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=9E=90=EB=8F=99=20=EA=B0=B1=EC=8B=A0=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/(main)/directory/[[id]]/+page.svelte | 7 ++++++- src/routes/(main)/directory/[[id]]/service.ts | 2 +- svelte.config.js | 3 +++ vite.config.ts | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/routes/(main)/directory/[[id]]/+page.svelte b/src/routes/(main)/directory/[[id]]/+page.svelte index 43c4755..95d05db 100644 --- a/src/routes/(main)/directory/[[id]]/+page.svelte +++ b/src/routes/(main)/directory/[[id]]/+page.svelte @@ -37,13 +37,16 @@ const createDirectory = async (name: string) => { await requestDirectoryCreation(name, data.id, $masterKeyStore?.get(1)!); isCreateDirectoryModalOpen = false; + info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME }; const uploadFile = () => { const file = fileInput?.files?.[0]; if (!file) return; - requestFileUpload(file, data.id, $masterKeyStore?.get(1)!); + requestFileUpload(file, data.id, $masterKeyStore?.get(1)!).then(() => { + info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME + }); }; $effect(() => { @@ -114,6 +117,7 @@ bind:selectedEntry onRenameClick={async (newName) => { await requestDirectoryEntryRename(selectedEntry!, newName); + info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME return true; }} /> @@ -122,6 +126,7 @@ bind:selectedEntry onDeleteClick={async () => { await requestDirectoryEntryDeletion(selectedEntry!); + info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME return true; }} /> diff --git a/src/routes/(main)/directory/[[id]]/service.ts b/src/routes/(main)/directory/[[id]]/service.ts index 5a85c93..7fdb1df 100644 --- a/src/routes/(main)/directory/[[id]]/service.ts +++ b/src/routes/(main)/directory/[[id]]/service.ts @@ -29,7 +29,7 @@ export const requestDirectoryCreation = async ( ) => { const { dataKey, dataKeyVersion } = await generateDataKey(); const nameEncrypted = await encryptData(new TextEncoder().encode(name), dataKey); - return await callPostApi("/api/directory/create", { + await callPostApi("/api/directory/create", { parentId, mekVersion: masterKey.version, dek: await wrapDataKey(dataKey, masterKey.key), diff --git a/svelte.config.js b/svelte.config.js index bbef2bb..27d6c18 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -12,6 +12,9 @@ const config = { // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://svelte.dev/docs/kit/adapters for more information about adapters. adapter: adapter(), + csrf: { + checkOrigin: false, + }, }, }; diff --git a/vite.config.ts b/vite.config.ts index 1e576b9..cf2e3fa 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,4 +9,7 @@ export default defineConfig({ compiler: "svelte", }), ], + server: { + host: true, + }, });