diff --git a/.dockerignore b/.dockerignore index ed4c8e5..495d123 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,6 +10,7 @@ node_modules /build /data /library +/thumbnails # OS .DS_Store diff --git a/.env.example b/.env.example index f492443..e3b6365 100644 --- a/.env.example +++ b/.env.example @@ -11,3 +11,4 @@ SESSION_EXPIRES= USER_CLIENT_CHALLENGE_EXPIRES= SESSION_UPGRADE_CHALLENGE_EXPIRES= LIBRARY_PATH= +THUMBNAILS_PATH= diff --git a/.gitignore b/.gitignore index aac77c6..73eddae 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ node_modules /build /data /library +/thumbnails # OS .DS_Store diff --git a/docker-compose.yaml b/docker-compose.yaml index dc7f392..eba1e94 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,6 +7,7 @@ services: user: ${CONTAINER_UID:-0}:${CONTAINER_GID:-0} volumes: - ./data/library:/app/data/library + - ./data/thumbnails:/app/data/thumbnails environment: # ArkVault - DATABASE_HOST=database @@ -17,6 +18,7 @@ services: - USER_CLIENT_CHALLENGE_EXPIRES - SESSION_UPGRADE_CHALLENGE_EXPIRES - LIBRARY_PATH=/app/data/library + - THUMBNAILS_PATH=/app/data/thumbnails # SvelteKit - ADDRESS_HEADER=${TRUST_PROXY:+X-Forwarded-For} - XFF_DEPTH=${TRUST_PROXY:-} diff --git a/package.json b/package.json index cae9662..b4eb70b 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "@sveltejs/kit": "^2.22.2", "@sveltejs/vite-plugin-svelte": "^4.0.4", "@types/file-saver": "^2.0.7", - "@types/ms": "^2.1.0", + "@types/ms": "^0.7.34", "@types/node-schedule": "^2.1.7", "@types/pg": "^8.15.4", "autoprefixer": "^10.4.21", @@ -37,6 +37,7 @@ "globals": "^16.3.0", "heic2any": "^0.0.4", "kysely-ctl": "^0.13.1", + "lru-cache": "^11.1.0", "mime": "^4.0.7", "p-limit": "^6.2.0", "prettier": "^3.6.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e7e04aa..79fec12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -52,8 +52,8 @@ importers: specifier: ^2.0.7 version: 2.0.7 '@types/ms': - specifier: ^2.1.0 - version: 2.1.0 + specifier: ^0.7.34 + version: 0.7.34 '@types/node-schedule': specifier: ^2.1.7 version: 2.1.7 @@ -96,6 +96,9 @@ importers: kysely-ctl: specifier: ^0.13.1 version: 0.13.1(kysely@0.28.2) + lru-cache: + specifier: ^11.1.0 + version: 11.1.0 mime: specifier: ^4.0.7 version: 4.0.7 @@ -592,8 +595,8 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/ms@2.1.0': - resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} + '@types/ms@0.7.34': + resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} '@types/node-schedule@2.1.7': resolution: {integrity: sha512-G7Z3R9H7r3TowoH6D2pkzUHPhcJrDF4Jz1JOQ80AX0K2DWTHoN9VC94XzFAPNMdbW9TBzMZ3LjpFi7RYdbxtXA==} @@ -1290,6 +1293,10 @@ packages: lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + lru-cache@11.1.0: + resolution: {integrity: sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==} + engines: {node: 20 || >=22} + luxon@3.6.1: resolution: {integrity: sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==} engines: {node: '>=12'} @@ -2364,7 +2371,7 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/ms@2.1.0': {} + '@types/ms@0.7.34': {} '@types/node-schedule@2.1.7': dependencies: @@ -3099,6 +3106,8 @@ snapshots: lru-cache@10.4.3: {} + lru-cache@11.1.0: {} + luxon@3.6.1: {} magic-string@0.30.17: diff --git a/src/lib/components/atoms/divs/FullscreenDiv.svelte b/src/lib/components/atoms/divs/FullscreenDiv.svelte index c90e02c..4bb1cc0 100644 --- a/src/lib/components/atoms/divs/FullscreenDiv.svelte +++ b/src/lib/components/atoms/divs/FullscreenDiv.svelte @@ -1,7 +1,15 @@ -
{@render children()}
diff --git a/src/lib/components/organisms/Category/File.svelte b/src/lib/components/organisms/Category/File.svelte
index 5263b95..7d49cf3 100644
--- a/src/lib/components/organisms/Category/File.svelte
+++ b/src/lib/components/organisms/Category/File.svelte
@@ -3,7 +3,7 @@
import { ActionEntryButton } from "$lib/components/atoms";
import { DirectoryEntryLabel } from "$lib/components/molecules";
import type { FileInfo } from "$lib/modules/filesystem";
- import type { SelectedFile } from "./service";
+ import { requestFileThumbnailDownload, type SelectedFile } from "./service";
import IconClose from "~icons/material-symbols/close";
@@ -15,6 +15,8 @@
let { info, onclick, onRemoveClick }: Props = $props();
+ let thumbnail: string | undefined = $state();
+
const openFile = () => {
const { id, dataKey, dataKeyVersion, name } = $info as FileInfo;
if (!dataKey || !dataKeyVersion) return; // TODO: Error handling
@@ -28,6 +30,21 @@
onRemoveClick!({ id, dataKey, dataKeyVersion, name });
};
+
+ $effect(() => {
+ if ($info?.dataKey) {
+ requestFileThumbnailDownload($info.id, $info.dataKey)
+ .then((thumbnailUrl) => {
+ thumbnail = thumbnailUrl ?? undefined;
+ })
+ .catch(() => {
+ // TODO: Error Handling
+ thumbnail = undefined;
+ });
+ } else {
+ thumbnail = undefined;
+ }
+ });
{#if $info}
@@ -37,6 +54,6 @@
actionButtonIcon={onRemoveClick && IconClose}
onActionButtonClick={removeFile}
>
- 썸네일이 누락된 파일
+ {persistentStates.files.length}개 파일의 썸네일이 존재하지 않아요.
+ 보안