diff --git a/eslint.config.js b/eslint.config.js index 4974f25..567adb5 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -61,7 +61,7 @@ export default defineConfig( "src/lib/ui/**": "^(#lib/(server|client|features)/|#trpc/)", "src/lib/features/**": "^#lib/server/", "src/service-worker/**": - "^(#lib/(?!shared/|client/storage/|client/cache/fileCache\\.js$)|#trpc/|#workers/)", + "^(#lib/(?!shared/|client/storage/|client/cache/file-cache\\.ts$)|#trpc/|#workers/)", }), { files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"], diff --git a/kysely.config.ts b/kysely.config.ts index 1d3b9a5..3f14855 100644 --- a/kysely.config.ts +++ b/kysely.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "kysely-ctl"; -import { createDialect } from "./src/lib/server/db/dialect"; +import { createDialect } from "./src/lib/server/db/dialect.ts"; // Empty values (e.g. `DATABASE_HOST=` in .env) are treated as unset, as in src/env.ts const optional = (name: string) => process.env[name] || undefined; diff --git a/src/hooks.client.ts b/src/hooks.client.ts index 696e3c5..17795fc 100644 --- a/src/hooks.client.ts +++ b/src/hooks.client.ts @@ -1,8 +1,8 @@ import type { ClientInit } from "@sveltejs/kit/hooks"; -import { cleanupFileCaches } from "#lib/client/cache/index.js"; -import { keyring } from "#lib/client/keys/index.js"; -import { listenForServiceWorkerMessages } from "#lib/client/serviceWorker.js"; -import { cleanupDanglingInfos } from "#lib/client/storage/indexedDB/index.js"; +import { cleanupFileCaches } from "#lib/client/cache/index.ts"; +import { keyring } from "#lib/client/keys/index.ts"; +import { listenForServiceWorkerMessages } from "#lib/client/service-worker.ts"; +import { cleanupDanglingInfos } from "#lib/client/storage/indexed-db/index.ts"; const requestPersistentStorage = async () => { const isPersistent = await navigator.storage.persist(); diff --git a/src/hooks.server.ts b/src/hooks.server.ts index b78bae2..c859d0a 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,9 +1,9 @@ import { sequence, type ServerInit } from "@sveltejs/kit/hooks"; import schedule from "node-schedule"; -import { ClientRepo, SessionRepo } from "#lib/server/db/index.js"; -import { migrateDB } from "#lib/server/db/kysely.js"; -import { authenticate, setAgentInfo } from "#lib/server/middlewares/index.js"; -import { FileDeletionService, UploadService } from "#lib/server/services/index.js"; +import { ClientRepo, SessionRepo } from "#lib/server/db/index.ts"; +import { migrateDB } from "#lib/server/db/kysely.ts"; +import { authenticate, setAgentInfo } from "#lib/server/middlewares/index.ts"; +import { FileDeletionService, UploadService } from "#lib/server/services/index.ts"; export const init: ServerInit = async () => { await migrateDB(); diff --git a/src/lib/client/cache/fileCache.ts b/src/lib/client/cache/file-cache.ts similarity index 98% rename from src/lib/client/cache/fileCache.ts rename to src/lib/client/cache/file-cache.ts index 325ebc5..d15b5dd 100644 --- a/src/lib/client/cache/fileCache.ts +++ b/src/lib/client/cache/file-cache.ts @@ -4,7 +4,7 @@ import { getFileCacheIndexOf, storeFileCacheIndex, updateFileCacheRetrievedAt, -} from "#lib/client/storage/indexedDB/cacheIndex.js"; +} from "#lib/client/storage/indexed-db/cache-index.ts"; import { createWritable, deleteDirectory, @@ -14,8 +14,8 @@ import { listDirectoryNames, listFileNames, moveFile, -} from "#lib/client/storage/opfs.js"; -import { CHUNK_SIZE, getChunkCount } from "#lib/shared/format/index.js"; +} from "#lib/client/storage/opfs.ts"; +import { CHUNK_SIZE, getChunkCount } from "#lib/shared/format/index.ts"; // Caches the plaintext of files in chunks, so that partially loaded files (e.g. videos which were // partially played) can also be cached. Chunk `i` starts at `i * CHUNK_SIZE` of the plaintext, diff --git a/src/lib/client/cache/index.ts b/src/lib/client/cache/index.ts index b55527a..29b8d6e 100644 --- a/src/lib/client/cache/index.ts +++ b/src/lib/client/cache/index.ts @@ -1,2 +1,2 @@ -export * from "./fileCache"; -export * from "./thumbnailCache.svelte"; +export * from "./file-cache.ts"; +export * from "./thumbnail-cache.svelte.ts"; diff --git a/src/lib/client/cache/thumbnailCache.svelte.ts b/src/lib/client/cache/thumbnail-cache.svelte.ts similarity index 98% rename from src/lib/client/cache/thumbnailCache.svelte.ts rename to src/lib/client/cache/thumbnail-cache.svelte.ts index cc45213..6d85b48 100644 --- a/src/lib/client/cache/thumbnailCache.svelte.ts +++ b/src/lib/client/cache/thumbnail-cache.svelte.ts @@ -1,7 +1,7 @@ /* eslint-disable svelte/prefer-svelte-reactivity -- Lookup tables of reactive entries */ import { LRUCache } from "lru-cache"; -import { deleteDirectory, deleteFile, readFile, writeFile } from "#lib/client/storage/opfs.js"; -import { decryptChunk, encodeToBase64 } from "#lib/shared/crypto/index.js"; +import { deleteDirectory, deleteFile, readFile, writeFile } from "#lib/client/storage/opfs.ts"; +import { decryptChunk, encodeToBase64 } from "#lib/shared/crypto/index.ts"; export interface Thumbnail { url?: string; diff --git a/src/lib/client/crypto/hmac.ts b/src/lib/client/crypto/hmac.ts index 6df84ef..00c93b4 100644 --- a/src/lib/client/crypto/hmac.ts +++ b/src/lib/client/crypto/hmac.ts @@ -1,5 +1,5 @@ -import type { ComputeMessage, ResultMessage } from "#workers/hmac.js"; -import HmacWorker from "#workers/hmac.js?worker"; +import type { ComputeMessage, ResultMessage } from "#workers/hmac.ts"; +import HmacWorker from "#workers/hmac.ts?worker"; // Computes HMAC of large blobs incrementally in a worker, which WebCrypto doesn't support export const signMessageHmac = async (message: Blob, hmacSecret: CryptoKey) => { diff --git a/src/lib/client/keys/generation.ts b/src/lib/client/keys/generation.ts index 30f4bf0..b4d88da 100644 --- a/src/lib/client/keys/generation.ts +++ b/src/lib/client/keys/generation.ts @@ -13,9 +13,9 @@ import { makeRSAKeyNonextractable, wrapHmacSecret, wrapMasterKey, -} from "#lib/shared/crypto/index.js"; -import { keyring } from "./keyring.svelte"; -import { deserializeClientKeys } from "./serialization"; +} from "#lib/shared/crypto/index.ts"; +import { keyring } from "./keyring.svelte.ts"; +import { deserializeClientKeys } from "./serialization.ts"; // Generates new client keys and keeps them in the keyring without persisting export const generateClientKeys = async () => { diff --git a/src/lib/client/keys/index.ts b/src/lib/client/keys/index.ts index 7440132..b43e7c2 100644 --- a/src/lib/client/keys/index.ts +++ b/src/lib/client/keys/index.ts @@ -1,5 +1,5 @@ -export * from "./generation"; -export * from "./keyring.svelte"; -export * from "./serialization"; -export * from "./sync"; -export * from "./types"; +export * from "./generation.ts"; +export * from "./keyring.svelte.ts"; +export * from "./serialization.ts"; +export * from "./sync.ts"; +export * from "./types.ts"; diff --git a/src/lib/client/keys/keyring.svelte.ts b/src/lib/client/keys/keyring.svelte.ts index 86f4792..a2e0913 100644 --- a/src/lib/client/keys/keyring.svelte.ts +++ b/src/lib/client/keys/keyring.svelte.ts @@ -5,8 +5,8 @@ import { storeClientKey, storeHmacSecrets, storeMasterKeys, -} from "#lib/client/storage/indexedDB/index.js"; -import type { ClientKeys, HmacSecret, MasterKey } from "./types"; +} from "#lib/client/storage/indexed-db/index.ts"; +import type { ClientKeys, HmacSecret, MasterKey } from "./types.ts"; const findLatestActive = ( entries: ReadonlyMap, diff --git a/src/lib/client/keys/sync.ts b/src/lib/client/keys/sync.ts index c16c14c..3bfad92 100644 --- a/src/lib/client/keys/sync.ts +++ b/src/lib/client/keys/sync.ts @@ -7,10 +7,10 @@ import { unwrapHmacSecret, unwrapMasterKey, verifyMasterKeyWrapped, -} from "#lib/shared/crypto/index.js"; -import { isTRPCClientError, trpc } from "#trpc/client.js"; -import { keyring } from "./keyring.svelte"; -import type { ClientKeys } from "./types"; +} from "#lib/shared/crypto/index.ts"; +import { isTRPCClientError, trpc } from "#trpc/client.ts"; +import { keyring } from "./keyring.svelte.ts"; +import type { ClientKeys } from "./types.ts"; // Synchronizes keys with the server diff --git a/src/lib/client/serviceWorker.ts b/src/lib/client/service-worker.ts similarity index 97% rename from src/lib/client/serviceWorker.ts rename to src/lib/client/service-worker.ts index 1343358..c3063ee 100644 --- a/src/lib/client/serviceWorker.ts +++ b/src/lib/client/service-worker.ts @@ -1,10 +1,10 @@ -import { handleDownloadProgress } from "#lib/client/transfer/download.svelte.js"; +import { handleDownloadProgress } from "#lib/client/transfer/download.svelte.ts"; import { DECRYPTED_FILE_URL_PREFIX, type FileMetadata, type ServiceWorkerMessage, type ServiceWorkerResponse, -} from "#lib/shared/serviceWorker.js"; +} from "#lib/shared/service-worker.ts"; const PREPARE_TIMEOUT_MS = 5000; diff --git a/src/lib/client/storage/indexedDB/cacheIndex.ts b/src/lib/client/storage/indexed-db/cache-index.ts similarity index 100% rename from src/lib/client/storage/indexedDB/cacheIndex.ts rename to src/lib/client/storage/indexed-db/cache-index.ts diff --git a/src/lib/client/storage/indexedDB/filesystem.ts b/src/lib/client/storage/indexed-db/filesystem.ts similarity index 100% rename from src/lib/client/storage/indexedDB/filesystem.ts rename to src/lib/client/storage/indexed-db/filesystem.ts diff --git a/src/lib/client/storage/indexed-db/index.ts b/src/lib/client/storage/indexed-db/index.ts new file mode 100644 index 0000000..90e02dc --- /dev/null +++ b/src/lib/client/storage/indexed-db/index.ts @@ -0,0 +1,3 @@ +export * from "./cache-index.ts"; +export * from "./filesystem.ts"; +export * from "./key-store.ts"; diff --git a/src/lib/client/storage/indexedDB/keyStore.ts b/src/lib/client/storage/indexed-db/key-store.ts similarity index 100% rename from src/lib/client/storage/indexedDB/keyStore.ts rename to src/lib/client/storage/indexed-db/key-store.ts diff --git a/src/lib/client/storage/indexedDB/index.ts b/src/lib/client/storage/indexedDB/index.ts deleted file mode 100644 index 4ca1202..0000000 --- a/src/lib/client/storage/indexedDB/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./cacheIndex"; -export * from "./filesystem"; -export * from "./keyStore"; diff --git a/src/lib/client/transfer/chunkedUpload.ts b/src/lib/client/transfer/chunked-upload.ts similarity index 95% rename from src/lib/client/transfer/chunkedUpload.ts rename to src/lib/client/transfer/chunked-upload.ts index a641ece..be08e46 100644 --- a/src/lib/client/transfer/chunkedUpload.ts +++ b/src/lib/client/transfer/chunked-upload.ts @@ -1,10 +1,10 @@ import { sha256 } from "@noble/hashes/sha2.js"; import axios from "axios"; import pLimit from "p-limit"; -import { encodeToBase64, encryptChunk } from "#lib/shared/crypto/index.js"; -import { CHUNK_SIZE, getChunkCount, getEncryptedSize } from "#lib/shared/format/index.js"; -import { BoundedQueue } from "#lib/utils/concurrency/index.js"; -import { createSpeedMeter } from "#lib/utils/speedMeter.js"; +import { encodeToBase64, encryptChunk } from "#lib/shared/crypto/index.ts"; +import { CHUNK_SIZE, getChunkCount, getEncryptedSize } from "#lib/shared/format/index.ts"; +import { BoundedQueue } from "#lib/utils/concurrency/index.ts"; +import { createSpeedMeter } from "#lib/utils/speed-meter.ts"; interface UploadStats { progress: number; diff --git a/src/lib/client/transfer/download.svelte.ts b/src/lib/client/transfer/download.svelte.ts index ea163ff..f8ecd27 100644 --- a/src/lib/client/transfer/download.svelte.ts +++ b/src/lib/client/transfer/download.svelte.ts @@ -1,5 +1,5 @@ -import type { DownloadProgressMessage } from "#lib/shared/serviceWorker.js"; -import { createSpeedMeter } from "#lib/utils/speedMeter.js"; +import type { DownloadProgressMessage } from "#lib/shared/service-worker.ts"; +import { createSpeedMeter } from "#lib/utils/speed-meter.ts"; // Files are downloaded and decrypted by the service worker, which reports the progress diff --git a/src/lib/client/transfer/index.ts b/src/lib/client/transfer/index.ts index a862c01..372a76e 100644 --- a/src/lib/client/transfer/index.ts +++ b/src/lib/client/transfer/index.ts @@ -1,2 +1,2 @@ -export * from "./download.svelte"; -export * from "./upload.svelte"; +export * from "./download.svelte.ts"; +export * from "./upload.svelte.ts"; diff --git a/src/lib/client/transfer/upload.svelte.ts b/src/lib/client/transfer/upload.svelte.ts index ee79101..4d51983 100644 --- a/src/lib/client/transfer/upload.svelte.ts +++ b/src/lib/client/transfer/upload.svelte.ts @@ -1,24 +1,24 @@ import { limitFunction } from "p-limit"; -import { signMessageHmac } from "#lib/client/crypto/hmac.js"; +import { createUploadFileCache } from "#lib/client/cache/index.ts"; +import { signMessageHmac } from "#lib/client/crypto/hmac.ts"; import { ensureHmacSecrets, keyring, type HmacSecret, type MasterKey, -} from "#lib/client/keys/index.js"; -import { createUploadFileCache } from "#lib/client/cache/index.js"; -import { readExifDateTime } from "#lib/client/media/exif.js"; -import { generateThumbnail } from "#lib/client/media/thumbnail.js"; -import { uploadBlob } from "#lib/client/transfer/chunkedUpload.js"; +} from "#lib/client/keys/index.ts"; +import { readExifDateTime } from "#lib/client/media/exif.ts"; +import { generateThumbnail } from "#lib/client/media/thumbnail.ts"; +import { uploadBlob } from "#lib/client/transfer/chunked-upload.ts"; import { encodeToBase64, generateDataKey, wrapDataKey, encryptString, -} from "#lib/shared/crypto/index.js"; -import { getChunkCount } from "#lib/shared/format/index.js"; -import { Scheduler } from "#lib/utils/index.js"; -import { trpc } from "#trpc/client.js"; +} from "#lib/shared/crypto/index.ts"; +import { getChunkCount } from "#lib/shared/format/index.ts"; +import { Scheduler } from "#lib/utils/index.ts"; +import { trpc } from "#trpc/client.ts"; export interface FileUploadState { id: string; diff --git a/src/lib/features/auth/components/ForceLoginModal.svelte b/src/lib/features/auth/components/ForceLoginModal.svelte index 259e9b0..91830c5 100644 --- a/src/lib/features/auth/components/ForceLoginModal.svelte +++ b/src/lib/features/auth/components/ForceLoginModal.svelte @@ -1,5 +1,5 @@
diff --git a/src/lib/ui/overlays/overlayGroup.svelte.ts b/src/lib/ui/overlays/overlay-group.svelte.ts similarity index 100% rename from src/lib/ui/overlays/overlayGroup.svelte.ts rename to src/lib/ui/overlays/overlay-group.svelte.ts diff --git a/src/lib/utils/concurrency/BoundedQueue.ts b/src/lib/utils/concurrency/bounded-queue.ts similarity index 100% rename from src/lib/utils/concurrency/BoundedQueue.ts rename to src/lib/utils/concurrency/bounded-queue.ts diff --git a/src/lib/utils/concurrency/index.ts b/src/lib/utils/concurrency/index.ts index 31b055c..916b6f9 100644 --- a/src/lib/utils/concurrency/index.ts +++ b/src/lib/utils/concurrency/index.ts @@ -1,2 +1,2 @@ -export * from "./BoundedQueue"; -export * from "./Scheduler"; +export * from "./bounded-queue.ts"; +export * from "./scheduler.ts"; diff --git a/src/lib/utils/concurrency/Scheduler.ts b/src/lib/utils/concurrency/scheduler.ts similarity index 100% rename from src/lib/utils/concurrency/Scheduler.ts rename to src/lib/utils/concurrency/scheduler.ts diff --git a/src/lib/utils/gotoStateful.ts b/src/lib/utils/goto-stateful.ts similarity index 100% rename from src/lib/utils/gotoStateful.ts rename to src/lib/utils/goto-stateful.ts diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index e830fde..fe034c2 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -1,6 +1,6 @@ -export * from "./concurrency"; -export * from "./format"; -export * from "./gotoStateful"; -export * from "./search"; -export * from "./sort"; -export * from "./speedMeter"; +export * from "./concurrency/index.ts"; +export * from "./format.ts"; +export * from "./goto-stateful.ts"; +export * from "./search.ts"; +export * from "./sort.ts"; +export * from "./speed-meter.ts"; diff --git a/src/lib/utils/speedMeter.ts b/src/lib/utils/speed-meter.ts similarity index 100% rename from src/lib/utils/speedMeter.ts rename to src/lib/utils/speed-meter.ts diff --git a/src/routes/(fullscreen)/+layout.svelte b/src/routes/(fullscreen)/+layout.svelte index 13711d7..aa85319 100644 --- a/src/routes/(fullscreen)/+layout.svelte +++ b/src/routes/(fullscreen)/+layout.svelte @@ -1,5 +1,5 @@ diff --git a/src/routes/(fullscreen)/auth/changePassword/+page.svelte b/src/routes/(fullscreen)/auth/change-password/+page.svelte similarity index 93% rename from src/routes/(fullscreen)/auth/changePassword/+page.svelte rename to src/routes/(fullscreen)/auth/change-password/+page.svelte index be11553..9f5ee29 100644 --- a/src/routes/(fullscreen)/auth/changePassword/+page.svelte +++ b/src/routes/(fullscreen)/auth/change-password/+page.svelte @@ -1,7 +1,7 @@