서버, 클라이언트, 서비스 워커 공용 코드를 lib/shared로 분리하고 브라우저 전용 모듈을 lib/client로 재구성

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
staticandClaude Opus 5.5 committed 2026-10-12 00:04:56 +09:00
1 parent 6a6aa1765b
commit aee87fd9b6
82 files changed
+326 -221

No files matched your search

@@ -1,4 +1,4 @@
import { concatenateBuffers, exportRSAKey, digestMessage } from "#lib/modules/crypto/index.js";
import { concatenateBuffers, exportRSAKey, digestMessage } from "#lib/shared/crypto/index.js";
export { requestMasterKeyDownload } from "#lib/services/key.js";
@@ -6,8 +6,8 @@
import { FullscreenDiv } from "#lib/components/atoms/index.js";
import { Categories, IconEntryButton, TopBar } from "#lib/components/molecules/index.js";
import { getFileInfo, type MaybeFileInfo } from "#lib/modules/filesystem/index.js";
import { captureVideoThumbnail } from "#lib/modules/thumbnail.js";
import { getFileDownloadState } from "#lib/modules/file/index.js";
import { captureVideoThumbnail } from "#lib/client/media/thumbnail.js";
import { getFileDownloadState } from "#lib/client/transfer/index.js";
import { masterKeyStore } from "#lib/stores/index.js";
import { HybridPromise } from "#lib/utils/index.js";
import AddToCategoryBottomSheet from "./AddToCategoryBottomSheet.svelte";
@@ -1,5 +1,5 @@
<script lang="ts">
import { isFileDownloading, type FileDownloadState } from "#lib/modules/file/index.js";
import { isFileDownloading, type FileDownloadState } from "#lib/client/transfer/index.js";
import { formatNetworkSpeed } from "#lib/utils/index.js";
interface Props {
+2 -2
View File
@@ -1,5 +1,5 @@
import { storeFileThumbnailCache } from "#lib/modules/file/index.js";
import { prepareFileDecryption, getDecryptedFileUrl } from "#lib/serviceWorker/index.js";
import { storeFileThumbnailCache } from "#lib/client/cache/index.js";
import { prepareFileDecryption, getDecryptedFileUrl } from "#lib/client/serviceWorker.js";
import { requestFileThumbnailUpload } from "#lib/services/file.js";
import { trpc } from "#trpc/client.js";
@@ -6,7 +6,7 @@
getDownloadingFiles,
clearDownloadedFiles,
type FileDownloadState,
} from "#lib/modules/file/index.js";
} from "#lib/client/transfer/index.js";
import { bulkGetFileInfo, type MaybeFileInfo } from "#lib/modules/filesystem/index.js";
import { masterKeyStore } from "#lib/stores/index.js";
import File from "./File.svelte";
@@ -1,5 +1,5 @@
<script lang="ts">
import type { FileDownloadState } from "#lib/modules/file/index.js";
import type { FileDownloadState } from "#lib/client/transfer/index.js";
import type { SummarizedFileInfo } from "#lib/modules/filesystem/index.js";
import { formatNetworkSpeed } from "#lib/utils/index.js";
@@ -1,7 +1,7 @@
<script lang="ts">
import { FullscreenDiv } from "#lib/components/atoms/index.js";
import { TopBar } from "#lib/components/molecules/index.js";
import { getUploadingFiles, clearUploadedFiles } from "#lib/modules/file/index.js";
import { getUploadingFiles, clearUploadedFiles } from "#lib/client/transfer/index.js";
import File from "./File.svelte";
const uploadingFiles = getUploadingFiles();
@@ -1,5 +1,5 @@
<script lang="ts">
import type { FileUploadState } from "#lib/modules/file/index.js";
import type { FileUploadState } from "#lib/client/transfer/index.js";
import { formatNetworkSpeed } from "#lib/utils/index.js";
import IconPending from "~icons/material-symbols/pending";
@@ -1,3 +1,4 @@
import { deserializeClientKeys } from "#lib/modules/key.js";
import {
generateEncryptionKeyPair,
generateSigningKeyPair,
@@ -10,8 +11,7 @@ import {
makeAESKeyNonextractable,
wrapHmacSecret,
generateHmacSecret,
} from "#lib/modules/crypto/index.js";
import { deserializeClientKeys } from "#lib/modules/key.js";
} from "#lib/shared/crypto/index.js";
import { clientKeyStore } from "#lib/stores/index.js";
export { requestLogout } from "#lib/services/auth.js";
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { ActionEntryButton } from "#lib/components/atoms/index.js";
import { DirectoryEntryLabel } from "#lib/components/molecules/index.js";
import { getFileThumbnail } from "#lib/modules/file/index.js";
import { getFileThumbnail } from "#lib/client/cache/index.js";
import type { SummarizedFileInfo } from "#lib/modules/filesystem/index.js";
import { formatDateTime } from "#lib/utils/index.js";
+2 -2
View File
@@ -2,11 +2,11 @@
import { onMount } from "svelte";
import { FullscreenDiv } from "#lib/components/atoms/index.js";
import { TopBar } from "#lib/components/molecules/index.js";
import type { FileCacheIndex } from "#lib/indexedDB/index.js";
import type { FileCacheIndex } from "#lib/client/storage/indexedDB/index.js";
import {
getFileCacheIndex,
deleteFileCache as doDeleteFileCache,
} from "#lib/modules/file/index.js";
} from "#lib/client/cache/index.js";
import { bulkGetFileInfo, type MaybeFileInfo } from "#lib/modules/filesystem/index.js";
import { masterKeyStore } from "#lib/stores/index.js";
import { formatFileSize } from "#lib/utils/index.js";
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import type { FileCacheIndex } from "#lib/indexedDB/index.js";
import type { FileCacheIndex } from "#lib/client/storage/indexedDB/index.js";
import type { MaybeFileInfo } from "#lib/modules/filesystem/index.js";
import { formatDate, formatFileSize } from "#lib/utils/index.js";
@@ -3,7 +3,7 @@
import { goto } from "$app/navigation";
import { BottomDiv, Button, FullscreenDiv } from "#lib/components/atoms/index.js";
import { IconEntryButton, TopBar } from "#lib/components/molecules/index.js";
import { deleteAllFileThumbnailCaches } from "#lib/modules/file/index.js";
import { deleteAllFileThumbnailCaches } from "#lib/client/cache/index.js";
import type { MaybeFileInfo } from "#lib/modules/filesystem/index.js";
import { masterKeyStore } from "#lib/stores/index.js";
import { sortEntries } from "#lib/utils/index.js";
@@ -1,8 +1,8 @@
import { limitFunction } from "p-limit";
import { SvelteMap } from "svelte/reactivity";
import { storeFileThumbnailCache } from "#lib/modules/file/index.js";
import { storeFileThumbnailCache } from "#lib/client/cache/index.js";
import { generateThumbnail } from "#lib/client/media/thumbnail.js";
import { getFileInfo, type FileInfo } from "#lib/modules/filesystem/index.js";
import { generateThumbnail } from "#lib/modules/thumbnail.js";
import { requestFileDownload, requestFileThumbnailUpload } from "#lib/services/file.js";
import { HybridPromise, Scheduler } from "#lib/utils/index.js";
import type { RouterOutputs } from "#trpc/router.server.js";
@@ -3,7 +3,7 @@
import { CheckBox, RowVirtualizer } from "#lib/components/atoms/index.js";
import { SubCategories, TopBar } from "#lib/components/molecules/index.js";
import { CategoryCreateModal } from "#lib/components/organisms/index.js";
import { updateCategoryInfo } from "#lib/indexedDB/index.js";
import { updateCategoryInfo } from "#lib/client/storage/indexedDB/index.js";
import { getCategoryInfo, type MaybeCategoryInfo } from "#lib/modules/filesystem/index.js";
import { masterKeyStore } from "#lib/stores/index.js";
import { HybridPromise, sortEntries } from "#lib/utils/index.js";
@@ -1,7 +1,7 @@
<script lang="ts">
import { ActionEntryButton } from "#lib/components/atoms/index.js";
import { DirectoryEntryLabel } from "#lib/components/molecules/index.js";
import { getFileThumbnail } from "#lib/modules/file/index.js";
import { getFileThumbnail } from "#lib/client/cache/index.js";
import type { CategoryFileInfo } from "#lib/modules/filesystem/index.js";
import { formatDateTime } from "#lib/utils/index.js";
import type { SelectedFile } from "./service.svelte";
@@ -1,6 +1,6 @@
import { getContext, setContext } from "svelte";
import { encryptString } from "#lib/modules/crypto/index.js";
import type { SelectedCategory } from "#lib/components/molecules/index.js";
import { encryptString } from "#lib/shared/crypto/index.js";
import { trpc } from "#trpc/client.js";
export { requestCategoryCreation, requestFileRemovalFromCategory } from "#lib/services/category.js";
@@ -1,7 +1,7 @@
<script lang="ts">
import { ActionEntryButton, RowVirtualizer } from "#lib/components/atoms/index.js";
import { DirectoryEntryLabel } from "#lib/components/molecules/index.js";
import { getUploadingFiles, type LiveFileUploadState } from "#lib/modules/file/index.js";
import { getUploadingFiles, type LiveFileUploadState } from "#lib/client/transfer/index.js";
import type { DirectoryInfo } from "#lib/modules/filesystem/index.js";
import { sortEntries } from "#lib/utils/index.js";
import File from "./File.svelte";
@@ -1,7 +1,7 @@
<script lang="ts">
import { ActionEntryButton } from "#lib/components/atoms/index.js";
import { DirectoryEntryLabel } from "#lib/components/molecules/index.js";
import { getFileThumbnail } from "#lib/modules/file/index.js";
import { getFileThumbnail } from "#lib/client/cache/index.js";
import type { SummarizedFileInfo } from "#lib/modules/filesystem/index.js";
import { formatDateTime } from "#lib/utils/index.js";
import type { SelectedEntry } from "../service.svelte";
@@ -1,5 +1,5 @@
<script lang="ts">
import type { LiveFileUploadState } from "#lib/modules/file/index.js";
import type { LiveFileUploadState } from "#lib/client/transfer/index.js";
import { formatNetworkSpeed } from "#lib/utils/index.js";
import IconDraft from "~icons/material-symbols/draft";
@@ -1,5 +1,5 @@
<script lang="ts">
import { getDownloadingFiles } from "#lib/modules/file/index.js";
import { getDownloadingFiles } from "#lib/client/transfer/index.js";
interface Props {
onclick: () => void;
@@ -1,5 +1,5 @@
<script lang="ts">
import { getUploadingFiles } from "#lib/modules/file/index.js";
import { getUploadingFiles } from "#lib/client/transfer/index.js";
interface Props {
onclick: () => void;
@@ -1,19 +1,19 @@
import { getContext, setContext } from "svelte";
import { storeHmacSecrets } from "#lib/indexedDB/index.js";
import {
generateDataKey,
wrapDataKey,
unwrapHmacSecret,
encryptString,
} from "#lib/modules/crypto/index.js";
import {
storeFileCache,
deleteFileCache,
storeFileThumbnailCache,
deleteFileThumbnailCache,
uploadFile,
} from "#lib/modules/file/index.js";
} from "#lib/client/cache/index.js";
import { storeHmacSecrets } from "#lib/client/storage/indexedDB/index.js";
import { uploadFile } from "#lib/client/transfer/index.js";
import type { DataKey } from "#lib/modules/filesystem/index.js";
import {
generateDataKey,
wrapDataKey,
unwrapHmacSecret,
encryptString,
} from "#lib/shared/crypto/index.js";
import { hmacSecretStore, type MasterKey, type HmacSecret } from "#lib/stores/index.js";
import { trpc } from "#trpc/client.js";
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { ActionEntryButton } from "#lib/components/atoms/index.js";
import { DirectoryEntryLabel } from "#lib/components/molecules/index.js";
import { getFileThumbnail } from "#lib/modules/file/index.js";
import { getFileThumbnail } from "#lib/client/cache/index.js";
import type { SummarizedFileInfo } from "#lib/modules/filesystem/index.js";
import { formatDateTime } from "#lib/utils/index.js";
+1 -1
View File
@@ -1,4 +1,4 @@
import { getAllFileInfos } from "#lib/indexedDB/index.js";
import { getAllFileInfos } from "#lib/client/storage/indexedDB/index.js";
export const requestFreshMediaFilesRetrieval = async (limit = 8) => {
const files = await getAllFileInfos();
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import { getDownloadingFiles, getUploadingFiles } from "#lib/modules/file/index.js";
import { getDownloadingFiles, getUploadingFiles } from "#lib/client/transfer/index.js";
import "../app.css";
let { children } = $props();
@@ -1,9 +1,9 @@
import { error } from "@sveltejs/kit";
import { z } from "zod";
import { parseRangeHeader, getContentRangeHeader } from "#lib/modules/http.js";
import { authorize } from "#lib/server/auth.js";
import { handleAppErrors } from "#lib/server/http.js";
import { FileService } from "#lib/server/services/index.js";
import { parseRangeHeader, getContentRangeHeader } from "#lib/shared/http.js";
import type { RequestEvent, RequestHandler } from "./$types";
const downloadHandler = async ({ locals, params, request }: RequestEvent) => {