BlueGit

timfa filemanager

feat: add share links, folder zip download, and Delen sidebar button

- Add share_tokens table to DB schema (expires_at indexed)
- New server/routes/share.js: POST /api/share/create, GET /api/share/info/:token,
  GET /api/share/preview/:token, GET /api/share/download/:token
- Zip cache in zip-cache/ with 1-day max age and automatic pruning (buildZip, pruneZipCache)
- Authenticated GET /api/files/download-zip for folder zip download
- Public share page at /share/:token (public/share.html) with live HH:MM:SS timer,
  inline file preview, and download button
- Sidebar: Delen button on all items, Download als zip button on folders
- Share modal: read-only URL field with copy button and OK dismiss
- Tests: tests/share.routes.test.js (22 tests), download-zip tests in files.routes.test.js
- Updated technical-reference.md and tests.md

timfa Tim Falken · pushed by timfa

Authored 2026-05-06 · 6 months ago

Hash
080377b542eadfd9a5ca6bcd7cea4f1515a3969c
Parent
56a6b93d
15 files changed +2217 −157
.github/technical-reference.md +180 −157
@@ -1,157 +1,180 @@
1 # Technical Reference
2
3 ## server/index.js
4 - start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
5 - shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
6
7 ## server/thumbnail-cache.js
8 - syncThumbnailCacheOnce() - Mirrors configured roots into public/thumbs and generates 99x99-max WebP thumbnails for image files; removes stale thumbnails and updates manifest hashes while preserving prior cache entries for temporarily unavailable roots (e.g. removable mounts).
9 - startThumbnailCacheLoop() - Schedules cache sync runs 5 seconds after boot and 5 seconds after each run completes.
10 - stopThumbnailCacheLoop() - Stops scheduled background cache sync runs.
11 - getCachedThumbnailInfo(sourceFile) - Returns cached thumbnail path/content-type when present; null when not ready.
12 - getThumbPathForSourceFile(sourceFile) - Maps an absolute source file path to its mirrored cache thumbnail path.
13 - getThumbRelPathForSourceFile(sourceFile) - Returns public-relative thumbnail path used in manifest entries.
14 - getImagesWithThumbnailsInDir(dirPath) - Returns [{filePath, thumbRelPath}] for all images inside dirPath (recursive) that have a cached thumbnail; sorted by filePath.
15 - getFolderIconSourceFile(folderPath) - Returns the source image path for a folder's icon: explicit assignment first, then auto-first cached image, null if none.
16 - setFolderIconAssignment(folderPath, imagePath) - Saves an explicit folder icon assignment to .folder-icons.json; pass null to clear (auto-detect used instead).
17
18 ## server/db.js
19 - initDb() - Initializes SQLite schema for users, file metadata, and auth_sessions (idle timeout/revocation support).
20 - getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
21 - closeDb() - Closes singleton DB handle to release file locks.
22
23 ## server/auth.js
24 - createToken(username, req, fingerprint) - Creates JWT bound to IP/region/fingerprint and linked to a DB-backed session id.
25 - requireAuth(req, res, next) - Verifies JWT + binding + session row + 1-hour idle timeout, updates last_seen_at, and attaches req.user.
26 - requireAdmin(req, res, next) - Requires authenticated admin user.
27 - revokeSession(sessionId) - Revokes a session row so future token use fails immediately.
28 - getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
29 - getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
30 - SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
31
32 ## server/routes/auth.js
33 - extractCredentials(body) - Accepts encrypted payloads and compatibility plaintext payloads for login/setup.
34 - makeAuthResponse(token, clientPublicKey) - Returns encrypted token when client key exists, plaintext token otherwise.
35 - POST /api/auth/setup - Creates first admin and issues token.
36 - POST /api/auth/login - Authenticates user by case-insensitive username match and issues token with canonical stored username.
37 - GET /api/auth/me - Returns current authenticated user profile.
38 - POST /api/auth/logout - Revokes the active session.
39
40 ## server/routes/admin.js
41 - POST /api/admin/users - Creates a new user and enforces case-insensitive username uniqueness.
42 - normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
43
44 ## server/routes/files.js
45 - GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
46 - POST /api/files/root-alias - Sets a display-only alias for an exact configured root path (no filesystem rename).
47 - GET /api/files/root-access - Returns users who can access an exact configured root and their access mode (R / R+W).
48 - GET /api/files/thumbnail - Serves cache-only thumbnail images for authorized files; returns 404 while cache is not ready.
49 - GET /api/files/folder-images - Returns images inside a directory (recursive) that already have a cached thumbnail; only thumbnailed images are included per user requirement.
50 - GET /api/files/folder-icon - Returns the current icon source file for a folder ({icon:{filePath}} or {icon:null}); explicit assignment takes priority over auto-first.
51 - POST /api/files/folder-icon - Sets or clears a folder's explicit icon assignment; imagePath must have a cached thumbnail; write access required.
52 - makeTempUploadPath(dir, originalName) - Builds a hidden per-upload staging filename in the target directory for multipart uploads.
53 - unlinkIfExists(targetPath, cb) - Removes a file during upload cleanup while ignoring already-missing temp files.
54 - promoteUploadedFile(tempPath, finalPath, cb) - Atomically renames a completed staged upload into place on the Linux server.
55 - splitNameExt(name) - Splits a filename into stem/ext, preserving dotless names and hidden-file behavior.
56 - pickNumberedPath(dir, requestedName) - Finds the first free `name (n).ext` path inside a directory.
57 - removePathRecursive(targetPath) - Deletes existing file or directory destination to support overwrite moves.
58 - POST /api/files/upload - Streams multipart uploads into hidden temp files, cleans them up on abort, and only exposes final filenames after completion.
59 - POST /api/files/move - Moves file/folder; supports conflict strategies: `error` (default), `overwrite`, or `rename` with optional `targetName`.
60
61 ## public/app.js
62 - showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.
63 - getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.
64 - getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.
65 - saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.
66 - loadSessionState() - Restores persisted state only when the last operation is within the 1-hour local idle window.
67 - api(method, path, body, opts) - Central API caller; refreshes local session timestamp on successful authenticated calls.
68 - performLogout() - Explicit logout path that revokes server session and clears local session state.
69 - initAuth() - Restores prior session when valid and auto-logins without credential prompt.
70 - showConfirm(title, message) - In-page confirm dialog; returns Promise<boolean>. Use instead of window.confirm().
71 - showPrompt(title, message, defaultValue) - In-page text-input dialog; returns Promise<string|null>. Use instead of window.prompt().
72 - showOverwrite(filename) - In-page overwrite-decision dialog for file conflicts; returns Promise<'yes'|'no'|'all'|'none'>.
73 - splitNameExt(name) - Client-side filename splitter used for local conflict rename suggestions.
74 - nextAvailableName(requestedName, existingNames) - Computes `name (n).ext` for upload/move rename options.
75 - listDirNameSet(dir) - Fetches directory listing and returns a Set of existing names.
76 - cloneFileWithName(file, newName) - Creates a renamed File object for non-overwrite uploads.
77 - showFileConflictChoice(filename, renameTo, mode) - Dialog for single upload/move conflicts; returns overwrite/rename/cancel.
78 - loadThumbnails() - Registers visible file icons for lazy thumbnail loading (both file thumbnails and folder icons); retries missing cache thumbnails during incremental refresh.
79 - loadOneThumbnail(iconEl) - Loads thumbnails from server cache endpoint for images, text snapshots for text files, and badges for other files; marks image icons as pending when cache returns 404 and uses direct source SVG thumbnails for SVG files under 1MB.
80 - observeFolderIcon(iconEl) - Registers a folder icon element with IntersectionObserver for lazy loading.
81 - loadOneFolderIcon(iconEl) - Fetches /api/files/folder-icon then the thumbnail blob and overlays it inside the folder SVG; no-op if no icon available.
82 - applyFolderThumbnail(iconEl, srcUrl) - Injects an SVG <image> element clipped to the folder outline path into the folder's icon SVG.
83 - openFolderIconPicker(item) - Opens the folder icon picker modal; shows cached-thumbnail images from the folder; allows selection, clearing, and cancellation.
84 - refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
85 - disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
86 - getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
87 - observeThumbnailIcon(iconEl) - Defers thumbnail fetch work until file icons are near/in the viewport.
88 - disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
89 - setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
90 - buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
91
92 ## tests/thumbnail-cache.test.js
93 - thumbnail cache worker / creates cached thumbnail with dimensions smaller than 100px - Verifies cached image generation and manifest write.
94 - thumbnail cache worker / removes cached thumbnail when source file is deleted - Verifies stale thumbnail cleanup behavior.
95 - afterEach() cleanup - Removes temp roots with `fs.rmSync(...maxRetries...)` to tolerate transient Windows file locks.
96 - detectCodeLanguage(name, mime) - Determines preview language for text/script files by MIME and extension.
97 - prettyPrintCode(raw, lang) - Best-effort formatter for JSON/markup/script previews before rendering.
98 - highlightCode(raw, lang) - Escapes and syntax-highlights preview text into HTML spans.
99 - fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.
100 - openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.
101 - closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.
102 - isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.
103 - hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.
104 - renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.
105 - fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.
106 - downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.
107 - downloadOrView(item, sourceSvgEl) - Opens in-place expanded tile preview from a file icon; shows error toast if no source tile is found.
108 - renderPreviewBody(item, blob, objectUrl, targetEl) - Renders preview content (image/video/audio/pdf/text) or unsupported message into a target container.
109 - animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
110 - openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
111 - openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
112 - closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
113 - closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
114 - closePreview() - Closes expanded-tile preview and revokes active preview object URL.
115 - openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
116 - moveWithConflictResolution(item, targetDir) - Attempts move and handles 409 conflicts by prompting overwrite/rename/cancel then retries.
117 - rootPermissionLabel(root) - Resolves permission key for a root using originalName when available (alias-safe permission checks).
118 - ensureMoveModal() - Lazily creates and wires Move To modal UI (tree, selection state, confirm/cancel handlers).
119 - createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.
120 - loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
121 - isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
122 - makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
123 - attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
124 - openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
125 - fetchRootAccessList(rootPath) - Fetches root access users from the server for a specific configured root.
126 - formatRootAccessList(users) - Formats root access entries as "username mode" values for sidebar rendering.
127 - openSidebar(item) - Renders item details/actions in sidebar; root selections include alias/original name/usage/access list and keep Rename while hiding Move To/Delete.
128 - openFolderSidebar() - Shows current folder details when nothing is selected; when at root base-level it also shows root access list.
129 - openRenameModal(item) - Renames files/folders; for roots this writes display alias via /api/files/root-alias and reloads roots.
130 - uploadFiles(fileList) - Uploads files one-by-one with per-file conflict prompt (overwrite/rename/cancel) when names already exist.
131 - openUserModal(user, paths) - Admin user editor; enforces UI permission rule that Write is disabled/unchecked while Read is unchecked.
132
133 ## public/drag-move.js
134 - makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.
135 - makeDraggable(el, item) - Touch drag now requires a short hold before movement, uses pointer capture, and keeps drag responsive on mobile.
136 - (internal) _beginDrag(e, el, item) - Lifts and re-parents the real .file-item to body, inserts hidden placeholder, and shows parent-folder drag target when applicable.
137 - (internal) _moveDrag(e) - Moves the real dragged item, hit-tests folder tiles, breadcrumb segments, and parent-folder target, toggles target highlight state.
138 - (internal) _endDrag() - On valid target: runs drop animation, calls moveWithConflictResolution() for overwrite/rename/cancel conflicts, then refreshes dir. Otherwise snap-back.
139 - (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
140
141 ## public/drag-move.css
142 - .file-item.dragging - Lifted style for real dragged tile.
143 - .file-item.drop-target - Glows folder icon when drag hovers over it.
144 - .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
145 - .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
146 - @keyframes drag-rise-spin-fall - Real tile rises, spins, falls/scales into folder on drop.
147 - @keyframes folder-bounce - Target folder bounces down then back on accept.
148 - .preview-backdrop/.file-item--preview/.preview-expand-* - In-place expanded tile preview styling (no separate overlay window), including preserved icon-outline layer.
149 - .move-modal/.move-tree/.move-node* - Move To tree picker styles with expandable/collapsible folder hierarchy.
150
151 ## tests/auth.routes.test.js
152 - session lifecycle / POST /api/auth/logout revokes active session - Verifies explicit logout invalidates token immediately.
153 - session lifecycle / session expires after 1 hour of inactivity - Verifies server-side idle timeout enforcement.
154
155 ## tests/page.load.test.js
156 - bootClient() - Boots the app in jsdom and waits until app shell is visible or timeout before assertions.
157 - waitFor(dom, predicate, timeoutMs) - Poll helper used by interaction tests to wait for rendered tiles.
1 # Technical Reference
2
3 ## server/index.js
4 - start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
5 - shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
6
7 ## server/thumbnail-cache.js
8 - syncThumbnailCacheOnce() - Mirrors configured roots into public/thumbs and generates 99x99-max WebP thumbnails for image files; removes stale thumbnails and updates manifest hashes while preserving prior cache entries for temporarily unavailable roots (e.g. removable mounts).
9 - startThumbnailCacheLoop() - Schedules cache sync runs 5 seconds after boot and 5 seconds after each run completes.
10 - stopThumbnailCacheLoop() - Stops scheduled background cache sync runs.
11 - getCachedThumbnailInfo(sourceFile) - Returns cached thumbnail path/content-type when present; null when not ready.
12 - getThumbPathForSourceFile(sourceFile) - Maps an absolute source file path to its mirrored cache thumbnail path.
13 - getThumbRelPathForSourceFile(sourceFile) - Returns public-relative thumbnail path used in manifest entries.
14 - getImagesWithThumbnailsInDir(dirPath) - Returns [{filePath, thumbRelPath}] for all images inside dirPath (recursive) that have a cached thumbnail; sorted by filePath.
15 - getFolderIconSourceFile(folderPath) - Returns the source image path for a folder's icon: explicit assignment first, then auto-first cached image, null if none.
16 - setFolderIconAssignment(folderPath, imagePath) - Saves an explicit folder icon assignment to .folder-icons.json; pass null to clear (auto-detect used instead).
17
18 ## server/db.js
19 - initDb() - Initializes SQLite schema for users, file metadata, and auth_sessions (idle timeout/revocation support).
20 - getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
21 - closeDb() - Closes singleton DB handle to release file locks.
22
23 ## server/auth.js
24 - createToken(username, req, fingerprint) - Creates JWT bound to IP/region/fingerprint and linked to a DB-backed session id.
25 - requireAuth(req, res, next) - Verifies JWT + binding + session row + 1-hour idle timeout, updates last_seen_at, and attaches req.user.
26 - requireAdmin(req, res, next) - Requires authenticated admin user.
27 - revokeSession(sessionId) - Revokes a session row so future token use fails immediately.
28 - getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
29 - getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
30 - SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
31
32 ## server/routes/auth.js
33 - extractCredentials(body) - Accepts encrypted payloads and compatibility plaintext payloads for login/setup.
34 - makeAuthResponse(token, clientPublicKey) - Returns encrypted token when client key exists, plaintext token otherwise.
35 - POST /api/auth/setup - Creates first admin and issues token.
36 - POST /api/auth/login - Authenticates user by case-insensitive username match and issues token with canonical stored username.
37 - GET /api/auth/me - Returns current authenticated user profile.
38 - POST /api/auth/logout - Revokes the active session.
39
40 ## server/routes/admin.js
41 - POST /api/admin/users - Creates a new user and enforces case-insensitive username uniqueness.
42 - normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
43
44 ## server/routes/files.js
45 - GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
46 - POST /api/files/root-alias - Sets a display-only alias for an exact configured root path (no filesystem rename).
47 - GET /api/files/root-access - Returns users who can access an exact configured root and their access mode (R / R+W).
48 - GET /api/files/thumbnail - Serves cache-only thumbnail images for authorized files; returns 404 while cache is not ready.
49 - GET /api/files/folder-images - Returns images inside a directory (recursive) that already have a cached thumbnail; only thumbnailed images are included per user requirement.
50 - GET /api/files/folder-icon - Returns the current icon source file for a folder ({icon:{filePath}} or {icon:null}); explicit assignment takes priority over auto-first.
51 - POST /api/files/folder-icon - Sets or clears a folder's explicit icon assignment; imagePath must have a cached thumbnail; write access required.
52 - GET /api/files/download-zip?dir=<absolute-path> - Authenticated. Streams the directory as a zip archive; caches the zip for up to 1 day in zip-cache/.
53 - makeTempUploadPath(dir, originalName) - Builds a hidden per-upload staging filename in the target directory for multipart uploads.
54 - unlinkIfExists(targetPath, cb) - Removes a file during upload cleanup while ignoring already-missing temp files.
55 - promoteUploadedFile(tempPath, finalPath, cb) - Atomically renames a completed staged upload into place on the Linux server.
56 - splitNameExt(name) - Splits a filename into stem/ext, preserving dotless names and hidden-file behavior.
57 - pickNumberedPath(dir, requestedName) - Finds the first free `name (n).ext` path inside a directory.
58 - removePathRecursive(targetPath) - Deletes existing file or directory destination to support overwrite moves.
59 - POST /api/files/upload - Streams multipart uploads into hidden temp files, cleans them up on abort, and only exposes final filenames after completion.
60 - POST /api/files/move - Moves file/folder; supports conflict strategies: `error` (default), `overwrite`, or `rename` with optional `targetName`.
61
62 ## server/routes/share.js
63 - POST /api/share/create - Authenticated. Creates a 24-hour share token for a file or directory; returns {token, expiresAt}.
64 - GET /api/share/info/:token - Public. Returns {name, isDir, expiresAt} for a valid non-expired token; 410 when expired, 404 when unknown.
65 - GET /api/share/preview/:token - Public. Streams file content inline for preview (files only, max 50 MB); 400 for directories, 410 expired.
66 - GET /api/share/download/:token - Public. Downloads the file or a zip of the directory for a valid token; 410 expired.
67 - buildZip(dirPath, cacheKey) - Creates (or returns cached) zip in zip-cache/; prunes stale zips before building; exported for reuse in files.js.
68 - pruneZipCache() - Deletes zip files in zip-cache/ older than 1 day; called automatically before each zip build.
69 - ZIP_CACHE_DIR - Absolute path to the zip-cache/ directory (project root).
70
71 ## server/db.js
72 - initDb() - Initializes SQLite schema for users, file metadata, auth_sessions, and share_tokens (expires_at index).
73 - getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
74 - closeDb() - Closes singleton DB handle to release file locks.
75
76 ## public/share.html
77 - Standalone public share page served at /share/:token; no auth required.
78 - Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
79 - tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
80 - Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
81 - Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
82
83 ## public/app.js
84 - showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.
85 - getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.
86 - getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.
87 - saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.
88 - loadSessionState() - Restores persisted state only when the last operation is within the 1-hour local idle window.
89 - api(method, path, body, opts) - Central API caller; refreshes local session timestamp on successful authenticated calls.
90 - performLogout() - Explicit logout path that revokes server session and clears local session state.
91 - initAuth() - Restores prior session when valid and auto-logins without credential prompt.
92 - showConfirm(title, message) - In-page confirm dialog; returns Promise<boolean>. Use instead of window.confirm().
93 - showPrompt(title, message, defaultValue) - In-page text-input dialog; returns Promise<string|null>. Use instead of window.prompt().
94 - showOverwrite(filename) - In-page overwrite-decision dialog for file conflicts; returns Promise<'yes'|'no'|'all'|'none'>.
95 - splitNameExt(name) - Client-side filename splitter used for local conflict rename suggestions.
96 - nextAvailableName(requestedName, existingNames) - Computes `name (n).ext` for upload/move rename options.
97 - listDirNameSet(dir) - Fetches directory listing and returns a Set of existing names.
98 - cloneFileWithName(file, newName) - Creates a renamed File object for non-overwrite uploads.
99 - showFileConflictChoice(filename, renameTo, mode) - Dialog for single upload/move conflicts; returns overwrite/rename/cancel.
100 - openShareModal(item) - Opens the Delen (share) popup, calls POST /api/share/create, shows the 24-hour URL with a copy button and OK to dismiss.
101 - loadThumbnails() - Registers visible file icons for lazy thumbnail loading (both file thumbnails and folder icons); retries missing cache thumbnails during incremental refresh.
102 - loadOneThumbnail(iconEl) - Loads thumbnails from server cache endpoint for images, text snapshots for text files, and badges for other files; marks image icons as pending when cache returns 404 and uses direct source SVG thumbnails for SVG files under 1MB.
103 - observeFolderIcon(iconEl) - Registers a folder icon element with IntersectionObserver for lazy loading.
104 - loadOneFolderIcon(iconEl) - Fetches /api/files/folder-icon then the thumbnail blob and overlays it inside the folder SVG; no-op if no icon available.
105 - applyFolderThumbnail(iconEl, srcUrl) - Injects an SVG <image> element clipped to the folder outline path into the folder's icon SVG.
106 - openFolderIconPicker(item) - Opens the folder icon picker modal; shows cached-thumbnail images from the folder; allows selection, clearing, and cancellation.
107 - refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
108 - disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
109 - getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
110 - observeThumbnailIcon(iconEl) - Defers thumbnail fetch work until file icons are near/in the viewport.
111 - disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
112 - setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
113 - buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
114
115 ## tests/thumbnail-cache.test.js
116 - thumbnail cache worker / creates cached thumbnail with dimensions smaller than 100px - Verifies cached image generation and manifest write.
117 - thumbnail cache worker / removes cached thumbnail when source file is deleted - Verifies stale thumbnail cleanup behavior.
118 - afterEach() cleanup - Removes temp roots with `fs.rmSync(...maxRetries...)` to tolerate transient Windows file locks.
119 - detectCodeLanguage(name, mime) - Determines preview language for text/script files by MIME and extension.
120 - prettyPrintCode(raw, lang) - Best-effort formatter for JSON/markup/script previews before rendering.
121 - highlightCode(raw, lang) - Escapes and syntax-highlights preview text into HTML spans.
122 - fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.
123 - openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.
124 - closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.
125 - isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.
126 - hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.
127 - renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.
128 - fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.
129 - downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.
130 - downloadOrView(item, sourceSvgEl) - Opens in-place expanded tile preview from a file icon; shows error toast if no source tile is found.
131 - renderPreviewBody(item, blob, objectUrl, targetEl) - Renders preview content (image/video/audio/pdf/text) or unsupported message into a target container.
132 - animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
133 - openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
134 - openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
135 - closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
136 - closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
137 - closePreview() - Closes expanded-tile preview and revokes active preview object URL.
138 - openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
139 - moveWithConflictResolution(item, targetDir) - Attempts move and handles 409 conflicts by prompting overwrite/rename/cancel then retries.
140 - rootPermissionLabel(root) - Resolves permission key for a root using originalName when available (alias-safe permission checks).
141 - ensureMoveModal() - Lazily creates and wires Move To modal UI (tree, selection state, confirm/cancel handlers).
142 - createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.
143 - loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
144 - isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
145 - makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
146 - attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
147 - openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
148 - fetchRootAccessList(rootPath) - Fetches root access users from the server for a specific configured root.
149 - formatRootAccessList(users) - Formats root access entries as "username mode" values for sidebar rendering.
150 - openSidebar(item) - Renders item details/actions in sidebar; root selections include alias/original name/usage/access list and keep Rename while hiding Move To/Delete.
151 - openFolderSidebar() - Shows current folder details when nothing is selected; when at root base-level it also shows root access list.
152 - openRenameModal(item) - Renames files/folders; for roots this writes display alias via /api/files/root-alias and reloads roots.
153 - uploadFiles(fileList) - Uploads files one-by-one with per-file conflict prompt (overwrite/rename/cancel) when names already exist.
154 - openUserModal(user, paths) - Admin user editor; enforces UI permission rule that Write is disabled/unchecked while Read is unchecked.
155
156 ## public/drag-move.js
157 - makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.
158 - makeDraggable(el, item) - Touch drag now requires a short hold before movement, uses pointer capture, and keeps drag responsive on mobile.
159 - (internal) _beginDrag(e, el, item) - Lifts and re-parents the real .file-item to body, inserts hidden placeholder, and shows parent-folder drag target when applicable.
160 - (internal) _moveDrag(e) - Moves the real dragged item, hit-tests folder tiles, breadcrumb segments, and parent-folder target, toggles target highlight state.
161 - (internal) _endDrag() - On valid target: runs drop animation, calls moveWithConflictResolution() for overwrite/rename/cancel conflicts, then refreshes dir. Otherwise snap-back.
162 - (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
163
164 ## public/drag-move.css
165 - .file-item.dragging - Lifted style for real dragged tile.
166 - .file-item.drop-target - Glows folder icon when drag hovers over it.
167 - .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
168 - .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
169 - @keyframes drag-rise-spin-fall - Real tile rises, spins, falls/scales into folder on drop.
170 - @keyframes folder-bounce - Target folder bounces down then back on accept.
171 - .preview-backdrop/.file-item--preview/.preview-expand-* - In-place expanded tile preview styling (no separate overlay window), including preserved icon-outline layer.
172 - .move-modal/.move-tree/.move-node* - Move To tree picker styles with expandable/collapsible folder hierarchy.
173
174 ## tests/auth.routes.test.js
175 - session lifecycle / POST /api/auth/logout revokes active session - Verifies explicit logout invalidates token immediately.
176 - session lifecycle / session expires after 1 hour of inactivity - Verifies server-side idle timeout enforcement.
177
178 ## tests/page.load.test.js
179 - bootClient() - Boots the app in jsdom and waits until app shell is visible or timeout before assertions.
180 - waitFor(dom, predicate, timeoutMs) - Poll helper used by interaction tests to wait for rendered tiles.
@@ -1,157 +1,180 @@
1# Technical Reference
1# Technical Reference
2
2
3## server/index.js
3## server/index.js
4- start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
4- start() - Initialises DB/keys, starts HTTP/HTTPS servers, and starts the background thumbnail cache loop.
5- shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
5- shutdown(opts, ...servers) - Graceful teardown: stops thumbnail loop, closes DB/servers, exits with configurable code after drain/timeout.
6
6
7## server/thumbnail-cache.js
7## server/thumbnail-cache.js
8- syncThumbnailCacheOnce() - Mirrors configured roots into public/thumbs and generates 99x99-max WebP thumbnails for image files; removes stale thumbnails and updates manifest hashes while preserving prior cache entries for temporarily unavailable roots (e.g. removable mounts).
8- syncThumbnailCacheOnce() - Mirrors configured roots into public/thumbs and generates 99x99-max WebP thumbnails for image files; removes stale thumbnails and updates manifest hashes while preserving prior cache entries for temporarily unavailable roots (e.g. removable mounts).
9- startThumbnailCacheLoop() - Schedules cache sync runs 5 seconds after boot and 5 seconds after each run completes.
9- startThumbnailCacheLoop() - Schedules cache sync runs 5 seconds after boot and 5 seconds after each run completes.
10- stopThumbnailCacheLoop() - Stops scheduled background cache sync runs.
10- stopThumbnailCacheLoop() - Stops scheduled background cache sync runs.
11- getCachedThumbnailInfo(sourceFile) - Returns cached thumbnail path/content-type when present; null when not ready.
11- getCachedThumbnailInfo(sourceFile) - Returns cached thumbnail path/content-type when present; null when not ready.
12- getThumbPathForSourceFile(sourceFile) - Maps an absolute source file path to its mirrored cache thumbnail path.
12- getThumbPathForSourceFile(sourceFile) - Maps an absolute source file path to its mirrored cache thumbnail path.
13- getThumbRelPathForSourceFile(sourceFile) - Returns public-relative thumbnail path used in manifest entries.
13- getThumbRelPathForSourceFile(sourceFile) - Returns public-relative thumbnail path used in manifest entries.
14- getImagesWithThumbnailsInDir(dirPath) - Returns [{filePath, thumbRelPath}] for all images inside dirPath (recursive) that have a cached thumbnail; sorted by filePath.
14- getImagesWithThumbnailsInDir(dirPath) - Returns [{filePath, thumbRelPath}] for all images inside dirPath (recursive) that have a cached thumbnail; sorted by filePath.
15- getFolderIconSourceFile(folderPath) - Returns the source image path for a folder's icon: explicit assignment first, then auto-first cached image, null if none.
15- getFolderIconSourceFile(folderPath) - Returns the source image path for a folder's icon: explicit assignment first, then auto-first cached image, null if none.
16- setFolderIconAssignment(folderPath, imagePath) - Saves an explicit folder icon assignment to .folder-icons.json; pass null to clear (auto-detect used instead).
16- setFolderIconAssignment(folderPath, imagePath) - Saves an explicit folder icon assignment to .folder-icons.json; pass null to clear (auto-detect used instead).
17
17
18## server/db.js
18## server/db.js
19- initDb() - Initializes SQLite schema for users, file metadata, and auth_sessions (idle timeout/revocation support).
19- initDb() - Initializes SQLite schema for users, file metadata, and auth_sessions (idle timeout/revocation support).
20- getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
20- getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
21- closeDb() - Closes singleton DB handle to release file locks.
21- closeDb() - Closes singleton DB handle to release file locks.
22
22
23## server/auth.js
23## server/auth.js
24- createToken(username, req, fingerprint) - Creates JWT bound to IP/region/fingerprint and linked to a DB-backed session id.
24- createToken(username, req, fingerprint) - Creates JWT bound to IP/region/fingerprint and linked to a DB-backed session id.
25- requireAuth(req, res, next) - Verifies JWT + binding + session row + 1-hour idle timeout, updates last_seen_at, and attaches req.user.
25- requireAuth(req, res, next) - Verifies JWT + binding + session row + 1-hour idle timeout, updates last_seen_at, and attaches req.user.
26- requireAdmin(req, res, next) - Requires authenticated admin user.
26- requireAdmin(req, res, next) - Requires authenticated admin user.
27- revokeSession(sessionId) - Revokes a session row so future token use fails immediately.
27- revokeSession(sessionId) - Revokes a session row so future token use fails immediately.
28- getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
28- getClientIp(req) - Normalizes request IP (including IPv4-mapped IPv6 loopback cases).
29- getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
29- getRegion(ip) - Derives coarse region binding from geoip lookup or local fallback.
30- SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
30- SESSION_IDLE_TIMEOUT_MS - Server-enforced idle timeout window (1 hour).
31
31
32## server/routes/auth.js
32## server/routes/auth.js
33- extractCredentials(body) - Accepts encrypted payloads and compatibility plaintext payloads for login/setup.
33- extractCredentials(body) - Accepts encrypted payloads and compatibility plaintext payloads for login/setup.
34- makeAuthResponse(token, clientPublicKey) - Returns encrypted token when client key exists, plaintext token otherwise.
34- makeAuthResponse(token, clientPublicKey) - Returns encrypted token when client key exists, plaintext token otherwise.
35- POST /api/auth/setup - Creates first admin and issues token.
35- POST /api/auth/setup - Creates first admin and issues token.
36- POST /api/auth/login - Authenticates user by case-insensitive username match and issues token with canonical stored username.
36- POST /api/auth/login - Authenticates user by case-insensitive username match and issues token with canonical stored username.
37- GET /api/auth/me - Returns current authenticated user profile.
37- GET /api/auth/me - Returns current authenticated user profile.
38- POST /api/auth/logout - Revokes the active session.
38- POST /api/auth/logout - Revokes the active session.
39
39
40## server/routes/admin.js
40## server/routes/admin.js
41- POST /api/admin/users - Creates a new user and enforces case-insensitive username uniqueness.
41- POST /api/admin/users - Creates a new user and enforces case-insensitive username uniqueness.
42- normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
42- normalizePermissions(permissions) - Normalizes permission maps and enforces that write access implies read access.
43
43
44## server/routes/files.js
44## server/routes/files.js
45- GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
45- GET /api/files/roots - Returns readable roots with display label (alias when configured), originalName, and path.
46- POST /api/files/root-alias - Sets a display-only alias for an exact configured root path (no filesystem rename).
46- POST /api/files/root-alias - Sets a display-only alias for an exact configured root path (no filesystem rename).
47- GET /api/files/root-access - Returns users who can access an exact configured root and their access mode (R / R+W).
47- GET /api/files/root-access - Returns users who can access an exact configured root and their access mode (R / R+W).
48- GET /api/files/thumbnail - Serves cache-only thumbnail images for authorized files; returns 404 while cache is not ready.
48- GET /api/files/thumbnail - Serves cache-only thumbnail images for authorized files; returns 404 while cache is not ready.
49- GET /api/files/folder-images - Returns images inside a directory (recursive) that already have a cached thumbnail; only thumbnailed images are included per user requirement.
49- GET /api/files/folder-images - Returns images inside a directory (recursive) that already have a cached thumbnail; only thumbnailed images are included per user requirement.
50- GET /api/files/folder-icon - Returns the current icon source file for a folder ({icon:{filePath}} or {icon:null}); explicit assignment takes priority over auto-first.
50- GET /api/files/folder-icon - Returns the current icon source file for a folder ({icon:{filePath}} or {icon:null}); explicit assignment takes priority over auto-first.
51- POST /api/files/folder-icon - Sets or clears a folder's explicit icon assignment; imagePath must have a cached thumbnail; write access required.
51- POST /api/files/folder-icon - Sets or clears a folder's explicit icon assignment; imagePath must have a cached thumbnail; write access required.
52- makeTempUploadPath(dir, originalName) - Builds a hidden per-upload staging filename in the target directory for multipart uploads.
52- GET /api/files/download-zip?dir=<absolute-path> - Authenticated. Streams the directory as a zip archive; caches the zip for up to 1 day in zip-cache/.
53- unlinkIfExists(targetPath, cb) - Removes a file during upload cleanup while ignoring already-missing temp files.
53- makeTempUploadPath(dir, originalName) - Builds a hidden per-upload staging filename in the target directory for multipart uploads.
54- promoteUploadedFile(tempPath, finalPath, cb) - Atomically renames a completed staged upload into place on the Linux server.
54- unlinkIfExists(targetPath, cb) - Removes a file during upload cleanup while ignoring already-missing temp files.
55- splitNameExt(name) - Splits a filename into stem/ext, preserving dotless names and hidden-file behavior.
55- promoteUploadedFile(tempPath, finalPath, cb) - Atomically renames a completed staged upload into place on the Linux server.
56- pickNumberedPath(dir, requestedName) - Finds the first free `name (n).ext` path inside a directory.
56- splitNameExt(name) - Splits a filename into stem/ext, preserving dotless names and hidden-file behavior.
57- removePathRecursive(targetPath) - Deletes existing file or directory destination to support overwrite moves.
57- pickNumberedPath(dir, requestedName) - Finds the first free `name (n).ext` path inside a directory.
58- POST /api/files/upload - Streams multipart uploads into hidden temp files, cleans them up on abort, and only exposes final filenames after completion.
58- removePathRecursive(targetPath) - Deletes existing file or directory destination to support overwrite moves.
59- POST /api/files/move - Moves file/folder; supports conflict strategies: `error` (default), `overwrite`, or `rename` with optional `targetName`.
59- POST /api/files/upload - Streams multipart uploads into hidden temp files, cleans them up on abort, and only exposes final filenames after completion.
60
60- POST /api/files/move - Moves file/folder; supports conflict strategies: `error` (default), `overwrite`, or `rename` with optional `targetName`.
61## public/app.js
61
62- showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.
62## server/routes/share.js
63- getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.
63- POST /api/share/create - Authenticated. Creates a 24-hour share token for a file or directory; returns {token, expiresAt}.
64- getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.
64- GET /api/share/info/:token - Public. Returns {name, isDir, expiresAt} for a valid non-expired token; 410 when expired, 404 when unknown.
65- saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.
65- GET /api/share/preview/:token - Public. Streams file content inline for preview (files only, max 50 MB); 400 for directories, 410 expired.
66- loadSessionState() - Restores persisted state only when the last operation is within the 1-hour local idle window.
66- GET /api/share/download/:token - Public. Downloads the file or a zip of the directory for a valid token; 410 expired.
67- api(method, path, body, opts) - Central API caller; refreshes local session timestamp on successful authenticated calls.
67- buildZip(dirPath, cacheKey) - Creates (or returns cached) zip in zip-cache/; prunes stale zips before building; exported for reuse in files.js.
68- performLogout() - Explicit logout path that revokes server session and clears local session state.
68- pruneZipCache() - Deletes zip files in zip-cache/ older than 1 day; called automatically before each zip build.
69- initAuth() - Restores prior session when valid and auto-logins without credential prompt.
69- ZIP_CACHE_DIR - Absolute path to the zip-cache/ directory (project root).
70- showConfirm(title, message) - In-page confirm dialog; returns Promise<boolean>. Use instead of window.confirm().
70
71- showPrompt(title, message, defaultValue) - In-page text-input dialog; returns Promise<string|null>. Use instead of window.prompt().
71## server/db.js
72- showOverwrite(filename) - In-page overwrite-decision dialog for file conflicts; returns Promise<'yes'|'no'|'all'|'none'>.
72- initDb() - Initializes SQLite schema for users, file metadata, auth_sessions, and share_tokens (expires_at index).
73- splitNameExt(name) - Client-side filename splitter used for local conflict rename suggestions.
73- getDb() - Returns singleton DB handle with WAL and foreign key pragmas.
74- nextAvailableName(requestedName, existingNames) - Computes `name (n).ext` for upload/move rename options.
74- closeDb() - Closes singleton DB handle to release file locks.
75- listDirNameSet(dir) - Fetches directory listing and returns a Set of existing names.
75
76- cloneFileWithName(file, newName) - Creates a renamed File object for non-overwrite uploads.
76## public/share.html
77- showFileConflictChoice(filename, renameTo, mode) - Dialog for single upload/move conflicts; returns overwrite/rename/cancel.
77- Standalone public share page served at /share/:token; no auth required.
78- loadThumbnails() - Registers visible file icons for lazy thumbnail loading (both file thumbnails and folder icons); retries missing cache thumbnails during incremental refresh.
78- Timer bar - Live HH:MM:SS countdown showing remaining validity; turns red and disables download when expired.
79- loadOneThumbnail(iconEl) - Loads thumbnails from server cache endpoint for images, text snapshots for text files, and badges for other files; marks image icons as pending when cache returns 404 and uses direct source SVG thumbnails for SVG files under 1MB.
79- tryPreview(name, isDir) - Renders inline preview (img/video/audio/text pre); no-op for unsupported types or directories.
80- observeFolderIcon(iconEl) - Registers a folder icon element with IntersectionObserver for lazy loading.
80- Fetches /api/share/info/:token on load; shows error state for 404/410 responses.
81- loadOneFolderIcon(iconEl) - Fetches /api/files/folder-icon then the thumbnail blob and overlays it inside the folder SVG; no-op if no icon available.
81- Download link points to /api/share/download/:token; labelled "Download als .zip" for directories.
82- applyFolderThumbnail(iconEl, srcUrl) - Injects an SVG <image> element clipped to the folder outline path into the folder's icon SVG.
82
83- openFolderIconPicker(item) - Opens the folder icon picker modal; shows cached-thumbnail images from the folder; allows selection, clearing, and cancellation.
83## public/app.js
84- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
84- showApp() - Reveals app shell; keeps sidebar folded by default on mobile and shows folder overview sidebar on desktop.
85- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
85- getOrCreateClientBindingId() - Creates/loads a persistent local browser binding id used in auth fingerprint derivation.
86- getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
86- getFingerprint() - Builds a stable fingerprint from binding id + stable browser properties (not viewport metrics) to avoid false session invalidation on UI/window-state changes.
87- observeThumbnailIcon(iconEl) - Defers thumbnail fetch work until file icons are near/in the viewport.
87- saveSessionState() - Persists token, selected path, and last operation timestamp in localStorage.
88- disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
88- loadSessionState() - Restores persisted state only when the last operation is within the 1-hour local idle window.
89- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
89- api(method, path, body, opts) - Central API caller; refreshes local session timestamp on successful authenticated calls.
90- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
90- performLogout() - Explicit logout path that revokes server session and clears local session state.
91
91- initAuth() - Restores prior session when valid and auto-logins without credential prompt.
92## tests/thumbnail-cache.test.js
92- showConfirm(title, message) - In-page confirm dialog; returns Promise<boolean>. Use instead of window.confirm().
93- thumbnail cache worker / creates cached thumbnail with dimensions smaller than 100px - Verifies cached image generation and manifest write.
93- showPrompt(title, message, defaultValue) - In-page text-input dialog; returns Promise<string|null>. Use instead of window.prompt().
94- thumbnail cache worker / removes cached thumbnail when source file is deleted - Verifies stale thumbnail cleanup behavior.
94- showOverwrite(filename) - In-page overwrite-decision dialog for file conflicts; returns Promise<'yes'|'no'|'all'|'none'>.
95- afterEach() cleanup - Removes temp roots with `fs.rmSync(...maxRetries...)` to tolerate transient Windows file locks.
95- splitNameExt(name) - Client-side filename splitter used for local conflict rename suggestions.
96- detectCodeLanguage(name, mime) - Determines preview language for text/script files by MIME and extension.
96- nextAvailableName(requestedName, existingNames) - Computes `name (n).ext` for upload/move rename options.
97- prettyPrintCode(raw, lang) - Best-effort formatter for JSON/markup/script previews before rendering.
97- listDirNameSet(dir) - Fetches directory listing and returns a Set of existing names.
98- highlightCode(raw, lang) - Escapes and syntax-highlights preview text into HTML spans.
98- cloneFileWithName(file, newName) - Creates a renamed File object for non-overwrite uploads.
99- fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.
99- showFileConflictChoice(filename, renameTo, mode) - Dialog for single upload/move conflicts; returns overwrite/rename/cancel.
100- openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.
100- openShareModal(item) - Opens the Delen (share) popup, calls POST /api/share/create, shows the 24-hour URL with a copy button and OK to dismiss.
101- closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.
101- loadThumbnails() - Registers visible file icons for lazy thumbnail loading (both file thumbnails and folder icons); retries missing cache thumbnails during incremental refresh.
102- isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.
102- loadOneThumbnail(iconEl) - Loads thumbnails from server cache endpoint for images, text snapshots for text files, and badges for other files; marks image icons as pending when cache returns 404 and uses direct source SVG thumbnails for SVG files under 1MB.
103- hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.
103- observeFolderIcon(iconEl) - Registers a folder icon element with IntersectionObserver for lazy loading.
104- renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.
104- loadOneFolderIcon(iconEl) - Fetches /api/files/folder-icon then the thumbnail blob and overlays it inside the folder SVG; no-op if no icon available.
105- fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.
105- applyFolderThumbnail(iconEl, srcUrl) - Injects an SVG <image> element clipped to the folder outline path into the folder's icon SVG.
106- downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.
106- openFolderIconPicker(item) - Opens the folder icon picker modal; shows cached-thumbnail images from the folder; allows selection, clearing, and cancellation.
107- downloadOrView(item, sourceSvgEl) - Opens in-place expanded tile preview from a file icon; shows error toast if no source tile is found.
107- refreshAfterIconChange(item) - Resets and reloads the folder icon in both the grid tile and sidebar after set/clear operations.
108- renderPreviewBody(item, blob, objectUrl, targetEl) - Renders preview content (image/video/audio/pdf/text) or unsupported message into a target container.
108- disconnectFolderIconObserver() - Disconnects and clears the folder icon IntersectionObserver on grid rebuild.
109- animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
109- getThumbnailKind(name) - Classifies files into image/text/badge thumbnail strategies.
110- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
110- observeThumbnailIcon(iconEl) - Defers thumbnail fetch work until file icons are near/in the viewport.
111- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
111- disconnectThumbnailObserver() - Clears active IntersectionObserver when the grid is rebuilt.
112- closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
112- setThumbnailPending(iconEl, pending) - Toggles per-icon pending spinner state while a cached image thumbnail is not ready yet.
113- closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
113- buildThumbnailSource(item, blob, kind) - Produces thumbnail image source (data/blob URL) for icon injection.
114- closePreview() - Closes expanded-tile preview and revokes active preview object URL.
114
115- openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
115## tests/thumbnail-cache.test.js
116- moveWithConflictResolution(item, targetDir) - Attempts move and handles 409 conflicts by prompting overwrite/rename/cancel then retries.
116- thumbnail cache worker / creates cached thumbnail with dimensions smaller than 100px - Verifies cached image generation and manifest write.
117- rootPermissionLabel(root) - Resolves permission key for a root using originalName when available (alias-safe permission checks).
117- thumbnail cache worker / removes cached thumbnail when source file is deleted - Verifies stale thumbnail cleanup behavior.
118- ensureMoveModal() - Lazily creates and wires Move To modal UI (tree, selection state, confirm/cancel handlers).
118- afterEach() cleanup - Removes temp roots with `fs.rmSync(...maxRetries...)` to tolerate transient Windows file locks.
119- createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.
119- detectCodeLanguage(name, mime) - Determines preview language for text/script files by MIME and extension.
120- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
120- prettyPrintCode(raw, lang) - Best-effort formatter for JSON/markup/script previews before rendering.
121- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
121- highlightCode(raw, lang) - Escapes and syntax-highlights preview text into HTML spans.
122- makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
122- fileAccentColor(name) - Returns canonical file-type accent color used by icon strokes and preview sheet outline.
123- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
123- openFolderSidebar() - Persistent sidebar fallback view that shows current folder/root overview when no item is selected.
124- openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
124- closeSidebar() - Clears selection; hides the panel entirely on mobile and restores folder overview sidebar on desktop.
125- fetchRootAccessList(rootPath) - Fetches root access users from the server for a specific configured root.
125- isMobileViewport() - Central media-query helper for mobile-only sidebar/interaction behavior.
126- formatRootAccessList(users) - Formats root access entries as "username mode" values for sidebar rendering.
126- hideSidebarPanel() - Hides sidebar panel and removes sidebar-open layout class from the app shell.
127- openSidebar(item) - Renders item details/actions in sidebar; root selections include alias/original name/usage/access list and keep Rename while hiding Move To/Delete.
127- renderBreadcrumb() - Builds clickable breadcrumb path and marks each folder segment as a drag-drop move target via .crumb-drop-target and data-path.
128- openFolderSidebar() - Shows current folder details when nothing is selected; when at root base-level it also shows root access list.
128- fetchFileBlob(item) - Downloads a file as Blob with auth headers for preview/download flows.
129- openRenameModal(item) - Renames files/folders; for roots this writes display alias via /api/files/root-alias and reloads roots.
129- downloadOrView(item, sourceSvgEl) - Opens preview; prefers in-place expanded tile preview when invoked from a file icon, falls back to overlay when no source tile is available.
130- uploadFiles(fileList) - Uploads files one-by-one with per-file conflict prompt (overwrite/rename/cancel) when names already exist.
130- downloadOrView(item, sourceSvgEl) - Opens in-place expanded tile preview from a file icon; shows error toast if no source tile is found.
131- openUserModal(user, paths) - Admin user editor; enforces UI permission rule that Write is disabled/unchecked while Read is unchecked.
131- renderPreviewBody(item, blob, objectUrl, targetEl) - Renders preview content (image/video/audio/pdf/text) or unsupported message into a target container.
132
132- animateRect(el, fromRect, toRect, opts) - Helper that animates element rectangle (left/top/width/height) for expand/collapse transitions.
133## public/drag-move.js
133- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents the real file tile to body, expands it to viewport preview, injects close/download controls.
134- makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.
134- openExpandedTilePreview(item, tileEl, sourceSvgEl, blob, objectUrl) - Reparents tile to body, shows spinner during expand animation, renders content after animation; applies file-type accent colour to tile border and outline glow.
135- makeDraggable(el, item) - Touch drag now requires a short hold before movement, uses pointer capture, and keeps drag responsive on mobile.
135- closeExpandedTilePreview() - Collapses expanded tile preview back to original grid position and restores original icon markup.
136- (internal) _beginDrag(e, el, item) - Lifts and re-parents the real .file-item to body, inserts hidden placeholder, and shows parent-folder drag target when applicable.
136- closePreview() - Closes either expanded-tile preview or overlay preview, then revokes active preview object URL.
137- (internal) _moveDrag(e) - Moves the real dragged item, hit-tests folder tiles, breadcrumb segments, and parent-folder target, toggles target highlight state.
137- closePreview() - Closes expanded-tile preview and revokes active preview object URL.
138- (internal) _endDrag() - On valid target: runs drop animation, calls moveWithConflictResolution() for overwrite/rename/cancel conflicts, then refreshes dir. Otherwise snap-back.
138- openMovePicker(item) - Opens Move To selector modal with expandable folder tree across all writable roots and executes /api/files/move.
139- (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
139- moveWithConflictResolution(item, targetDir) - Attempts move and handles 409 conflicts by prompting overwrite/rename/cancel then retries.
140
140- rootPermissionLabel(root) - Resolves permission key for a root using originalName when available (alias-safe permission checks).
141## public/drag-move.css
141- ensureMoveModal() - Lazily creates and wires Move To modal UI (tree, selection state, confirm/cancel handlers).
142- .file-item.dragging - Lifted style for real dragged tile.
142- createMoveNode(folderPath, label) - Builds an expandable/selectable folder node for the Move To tree.
143- .file-item.drop-target - Glows folder icon when drag hovers over it.
143- loadMoveChildren(containerEl, dirPath) - Lazy-loads subfolders for a tree node via /api/files/list.
144- .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
144- isInlinePreviewableBlob(blob, name) - Determines if a blob can be previewed inline by MIME/extension.
145- .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
145- makeFileItem(item) - Builds a .file-item element; roots in Home now use folder-like interaction (single-click focus, double-click open), roots are non-draggable, and mobile long-press contextmenu suppression remains.
146- @keyframes drag-rise-spin-fall - Real tile rises, spins, falls/scales into folder on drop.
146- attachMobileLongPress(el, item) - Adds mobile long-press detection on file/folder tiles to open the item sidebar without desktop side effects.
147- @keyframes folder-bounce - Target folder bounces down then back on accept.
147- openSidebar(item) - Renders item details/actions in sidebar; roots show alias + original name + usage stats, hide Move To/Delete, keep Rename.
148- .preview-backdrop/.file-item--preview/.preview-expand-* - In-place expanded tile preview styling (no separate overlay window), including preserved icon-outline layer.
148- fetchRootAccessList(rootPath) - Fetches root access users from the server for a specific configured root.
149- .move-modal/.move-tree/.move-node* - Move To tree picker styles with expandable/collapsible folder hierarchy.
149- formatRootAccessList(users) - Formats root access entries as "username mode" values for sidebar rendering.
150
150- openSidebar(item) - Renders item details/actions in sidebar; root selections include alias/original name/usage/access list and keep Rename while hiding Move To/Delete.
151## tests/auth.routes.test.js
151- openFolderSidebar() - Shows current folder details when nothing is selected; when at root base-level it also shows root access list.
152- session lifecycle / POST /api/auth/logout revokes active session - Verifies explicit logout invalidates token immediately.
152- openRenameModal(item) - Renames files/folders; for roots this writes display alias via /api/files/root-alias and reloads roots.
153- session lifecycle / session expires after 1 hour of inactivity - Verifies server-side idle timeout enforcement.
153- uploadFiles(fileList) - Uploads files one-by-one with per-file conflict prompt (overwrite/rename/cancel) when names already exist.
154
154- openUserModal(user, paths) - Admin user editor; enforces UI permission rule that Write is disabled/unchecked while Read is unchecked.
155## tests/page.load.test.js
155
156- bootClient() - Boots the app in jsdom and waits until app shell is visible or timeout before assertions.
156## public/drag-move.js
157- waitFor(dom, predicate, timeoutMs) - Poll helper used by interaction tests to wait for rendered tiles.
157- makeDraggable(el, item) - Attaches pointerdown to a .file-item; starts drag after threshold movement. Depends on: api(), canWrite(), navigateTo(), STATE, closeSidebar(), toast() from app.js.
158- makeDraggable(el, item) - Touch drag now requires a short hold before movement, uses pointer capture, and keeps drag responsive on mobile.
159- (internal) _beginDrag(e, el, item) - Lifts and re-parents the real .file-item to body, inserts hidden placeholder, and shows parent-folder drag target when applicable.
160- (internal) _moveDrag(e) - Moves the real dragged item, hit-tests folder tiles, breadcrumb segments, and parent-folder target, toggles target highlight state.
161- (internal) _endDrag() - On valid target: runs drop animation, calls moveWithConflictResolution() for overwrite/rename/cancel conflicts, then refreshes dir. Otherwise snap-back.
162- (internal) _cleanupDrag(reinsert) - Restores tile styles; reinserts into grid on failure/abort or removes before refresh on success, hides drag helper targets.
163
164## public/drag-move.css
165- .file-item.dragging - Lifted style for real dragged tile.
166- .file-item.drop-target - Glows folder icon when drag hovers over it.
167- .drag-parent-target - Temporary top-left "move to parent" drop target shown while dragging in nested folders.
168- .crumb-drop-target.active - Highlight style for breadcrumb drop destinations during drag.
169- @keyframes drag-rise-spin-fall - Real tile rises, spins, falls/scales into folder on drop.
170- @keyframes folder-bounce - Target folder bounces down then back on accept.
171- .preview-backdrop/.file-item--preview/.preview-expand-* - In-place expanded tile preview styling (no separate overlay window), including preserved icon-outline layer.
172- .move-modal/.move-tree/.move-node* - Move To tree picker styles with expandable/collapsible folder hierarchy.
173
174## tests/auth.routes.test.js
175- session lifecycle / POST /api/auth/logout revokes active session - Verifies explicit logout invalidates token immediately.
176- session lifecycle / session expires after 1 hour of inactivity - Verifies server-side idle timeout enforcement.
177
178## tests/page.load.test.js
179- bootClient() - Boots the app in jsdom and waits until app shell is visible or timeout before assertions.
180- waitFor(dom, predicate, timeoutMs) - Poll helper used by interaction tests to wait for rendered tiles.
.github/tests.md +10 −0
@@ -43,6 +43,7 @@
43 43 - `GET /api/files/thumbnail`
44 44 - `GET /api/files/root-access`
45 45 - `folder icon endpoints`
46 - `GET /api/files/download-zip`
46 47
47 48 ---
48 49
@@ -51,6 +52,15 @@
51 52
52 53 ---
53 54
55 ## `test/share.routes.test.js`
56 - `POST /api/share/create`
57 - `GET /api/share/info/:token`
58 - `GET /api/share/preview/:token`
59 - `GET /api/share/download/:token`
60 - `pruneZipCache`
61
62 ---
63
54 64 ## `test/thumbnail-cache.test.js`
55 65 - `thumbnail cache worker`
56 66
@@ -43,6 +43,7 @@
43- `GET /api/files/thumbnail`
43- `GET /api/files/thumbnail`
44- `GET /api/files/root-access`
44- `GET /api/files/root-access`
45- `folder icon endpoints`
45- `folder icon endpoints`
46- `GET /api/files/download-zip`
46
47
47---
48---
48
49
@@ -51,6 +52,15 @@
51
52
52---
53---
53
54
55## `test/share.routes.test.js`
56- `POST /api/share/create`
57- `GET /api/share/info/:token`
58- `GET /api/share/preview/:token`
59- `GET /api/share/download/:token`
60- `pruneZipCache`
61
62---
63
54## `test/thumbnail-cache.test.js`
64## `test/thumbnail-cache.test.js`
55- `thumbnail cache worker`
65- `thumbnail cache worker`
56
66
package-lock.json +821 −0
@@ -8,6 +8,7 @@
8 8 "name": "filemanager",
9 9 "version": "1.0.0",
10 10 "dependencies": {
11 "archiver": "^7.0.1",
11 12 "bcrypt": "^5.1.1",
12 13 "express": "^4.18.2",
13 14 "geoip-lite": "^1.4.10",
@@ -1159,6 +1160,102 @@
1159 1160 "url": "https://opencollective.com/libvips"
1160 1161 }
1161 1162 },
1163 "node_modules/@isaacs/cliui": {
1164 "version": "8.0.2",
1165 "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
1166 "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
1167 "license": "ISC",
1168 "dependencies": {
1169 "string-width": "^5.1.2",
1170 "string-width-cjs": "npm:string-width@^4.2.0",
1171 "strip-ansi": "^7.0.1",
1172 "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
1173 "wrap-ansi": "^8.1.0",
1174 "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
1175 },
1176 "engines": {
1177 "node": ">=12"
1178 }
1179 },
1180 "node_modules/@isaacs/cliui/node_modules/ansi-regex": {
1181 "version": "6.2.2",
1182 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
1183 "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
1184 "license": "MIT",
1185 "engines": {
1186 "node": ">=12"
1187 },
1188 "funding": {
1189 "url": "https://github.com/chalk/ansi-regex?sponsor=1"
1190 }
1191 },
1192 "node_modules/@isaacs/cliui/node_modules/ansi-styles": {
1193 "version": "6.2.3",
1194 "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
1195 "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
1196 "license": "MIT",
1197 "engines": {
1198 "node": ">=12"
1199 },
1200 "funding": {
1201 "url": "https://github.com/chalk/ansi-styles?sponsor=1"
1202 }
1203 },
1204 "node_modules/@isaacs/cliui/node_modules/emoji-regex": {
1205 "version": "9.2.2",
1206 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
1207 "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
1208 "license": "MIT"
1209 },
1210 "node_modules/@isaacs/cliui/node_modules/string-width": {
1211 "version": "5.1.2",
1212 "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
1213 "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
1214 "license": "MIT",
1215 "dependencies": {
1216 "eastasianwidth": "^0.2.0",
1217 "emoji-regex": "^9.2.2",
1218 "strip-ansi": "^7.0.1"
1219 },
1220 "engines": {
1221 "node": ">=12"
1222 },
1223 "funding": {
1224 "url": "https://github.com/sponsors/sindresorhus"
1225 }
1226 },
1227 "node_modules/@isaacs/cliui/node_modules/strip-ansi": {
1228 "version": "7.2.0",
1229 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
1230 "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
1231 "license": "MIT",
1232 "dependencies": {
1233 "ansi-regex": "^6.2.2"
1234 },
1235 "engines": {
1236 "node": ">=12"
1237 },
1238 "funding": {
1239 "url": "https://github.com/chalk/strip-ansi?sponsor=1"
1240 }
1241 },
1242 "node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
1243 "version": "8.1.0",
1244 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
1245 "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
1246 "license": "MIT",
1247 "dependencies": {
1248 "ansi-styles": "^6.1.0",
1249 "string-width": "^5.0.1",
1250 "strip-ansi": "^7.0.1"
1251 },
1252 "engines": {
1253 "node": ">=12"
1254 },
1255 "funding": {
1256 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
1257 }
1258 },
1162 1259 "node_modules/@istanbuljs/load-nyc-config": {
1163 1260 "version": "1.1.0",
1164 1261 "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@@ -1773,6 +1870,16 @@
1773 1870 "node-pre-gyp": "bin/node-pre-gyp"
1774 1871 }
1775 1872 },
1873 "node_modules/@pkgjs/parseargs": {
1874 "version": "0.11.0",
1875 "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
1876 "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
1877 "license": "MIT",
1878 "optional": true,
1879 "engines": {
1880 "node": ">=14"
1881 }
1882 },
1776 1883 "node_modules/@sinclair/typebox": {
1777 1884 "version": "0.27.10",
1778 1885 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz",
@@ -1944,6 +2051,18 @@
1944 2051 "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
1945 2052 "license": "ISC"
1946 2053 },
2054 "node_modules/abort-controller": {
2055 "version": "3.0.0",
2056 "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
2057 "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
2058 "license": "MIT",
2059 "dependencies": {
2060 "event-target-shim": "^5.0.0"
2061 },
2062 "engines": {
2063 "node": ">=6.5"
2064 }
2065 },
1947 2066 "node_modules/accepts": {
1948 2067 "version": "1.3.8",
1949 2068 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -2093,6 +2212,161 @@
2093 2212 "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==",
2094 2213 "license": "ISC"
2095 2214 },
2215 "node_modules/archiver": {
2216 "version": "7.0.1",
2217 "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz",
2218 "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==",
2219 "license": "MIT",
2220 "dependencies": {
2221 "archiver-utils": "^5.0.2",
2222 "async": "^3.2.4",
2223 "buffer-crc32": "^1.0.0",
2224 "readable-stream": "^4.0.0",
2225 "readdir-glob": "^1.1.2",
2226 "tar-stream": "^3.0.0",
2227 "zip-stream": "^6.0.1"
2228 },
2229 "engines": {
2230 "node": ">= 14"
2231 }
2232 },
2233 "node_modules/archiver-utils": {
2234 "version": "5.0.2",
2235 "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.2.tgz",
2236 "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==",
2237 "license": "MIT",
2238 "dependencies": {
2239 "glob": "^10.0.0",
2240 "graceful-fs": "^4.2.0",
2241 "is-stream": "^2.0.1",
2242 "lazystream": "^1.0.0",
2243 "lodash": "^4.17.15",
2244 "normalize-path": "^3.0.0",
2245 "readable-stream": "^4.0.0"
2246 },
2247 "engines": {
2248 "node": ">= 14"
2249 }
2250 },
2251 "node_modules/archiver-utils/node_modules/brace-expansion": {
2252 "version": "2.1.0",
2253 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
2254 "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
2255 "license": "MIT",
2256 "dependencies": {
2257 "balanced-match": "^1.0.0"
2258 }
2259 },
2260 "node_modules/archiver-utils/node_modules/glob": {
2261 "version": "10.5.0",
2262 "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
2263 "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
2264 "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
2265 "license": "ISC",
2266 "dependencies": {
2267 "foreground-child": "^3.1.0",
2268 "jackspeak": "^3.1.2",
2269 "minimatch": "^9.0.4",
2270 "minipass": "^7.1.2",
2271 "package-json-from-dist": "^1.0.0",
2272 "path-scurry": "^1.11.1"
2273 },
2274 "bin": {
2275 "glob": "dist/esm/bin.mjs"
2276 },
2277 "funding": {
2278 "url": "https://github.com/sponsors/isaacs"
2279 }
2280 },
2281 "node_modules/archiver-utils/node_modules/minimatch": {
2282 "version": "9.0.9",
2283 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
2284 "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
2285 "license": "ISC",
2286 "dependencies": {
2287 "brace-expansion": "^2.0.2"
2288 },
2289 "engines": {
2290 "node": ">=16 || 14 >=14.17"
2291 },
2292 "funding": {
2293 "url": "https://github.com/sponsors/isaacs"
2294 }
2295 },
2296 "node_modules/archiver-utils/node_modules/minipass": {
2297 "version": "7.1.3",
2298 "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
2299 "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
2300 "license": "BlueOak-1.0.0",
2301 "engines": {
2302 "node": ">=16 || 14 >=14.17"
2303 }
2304 },
2305 "node_modules/archiver-utils/node_modules/readable-stream": {
2306 "version": "4.7.0",
2307 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
2308 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
2309 "license": "MIT",
2310 "dependencies": {
2311 "abort-controller": "^3.0.0",
2312 "buffer": "^6.0.3",
2313 "events": "^3.3.0",
2314 "process": "^0.11.10",
2315 "string_decoder": "^1.3.0"
2316 },
2317 "engines": {
2318 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
2319 }
2320 },
2321 "node_modules/archiver-utils/node_modules/string_decoder": {
2322 "version": "1.3.0",
2323 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
2324 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
2325 "license": "MIT",
2326 "dependencies": {
2327 "safe-buffer": "~5.2.0"
2328 }
2329 },
2330 "node_modules/archiver/node_modules/async": {
2331 "version": "3.2.6",
2332 "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
2333 "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
2334 "license": "MIT"
2335 },
2336 "node_modules/archiver/node_modules/buffer-crc32": {
2337 "version": "1.0.0",
2338 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz",
2339 "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==",
2340 "license": "MIT",
2341 "engines": {
2342 "node": ">=8.0.0"
2343 }
2344 },
2345 "node_modules/archiver/node_modules/readable-stream": {
2346 "version": "4.7.0",
2347 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
2348 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
2349 "license": "MIT",
2350 "dependencies": {
2351 "abort-controller": "^3.0.0",
2352 "buffer": "^6.0.3",
2353 "events": "^3.3.0",
2354 "process": "^0.11.10",
2355 "string_decoder": "^1.3.0"
2356 },
2357 "engines": {
2358 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
2359 }
2360 },
2361 "node_modules/archiver/node_modules/string_decoder": {
2362 "version": "1.3.0",
2363 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
2364 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
2365 "license": "MIT",
2366 "dependencies": {
2367 "safe-buffer": "~5.2.0"
2368 }
2369 },
2096 2370 "node_modules/are-we-there-yet": {
2097 2371 "version": "2.0.0",
2098 2372 "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
@@ -2158,6 +2432,20 @@
2158 2432 "dev": true,
2159 2433 "license": "MIT"
2160 2434 },
2435 "node_modules/b4a": {
2436 "version": "1.8.1",
2437 "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
2438 "integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
2439 "license": "Apache-2.0",
2440 "peerDependencies": {
2441 "react-native-b4a": "*"
2442 },
2443 "peerDependenciesMeta": {
2444 "react-native-b4a": {
2445 "optional": true
2446 }
2447 }
2448 },
2161 2449 "node_modules/babel-jest": {
2162 2450 "version": "29.7.0",
2163 2451 "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz",
@@ -2283,6 +2571,117 @@
2283 2571 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
2284 2572 "license": "MIT"
2285 2573 },
2574 "node_modules/bare-events": {
2575 "version": "2.8.2",
2576 "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
2577 "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
2578 "license": "Apache-2.0",
2579 "peerDependencies": {
2580 "bare-abort-controller": "*"
2581 },
2582 "peerDependenciesMeta": {
2583 "bare-abort-controller": {
2584 "optional": true
2585 }
2586 }
2587 },
2588 "node_modules/bare-fs": {
2589 "version": "4.7.1",
2590 "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.7.1.tgz",
2591 "integrity": "sha512-WDRsyVN52eAx/lBamKD6uyw8H4228h/x0sGGGegOamM2cd7Pag88GfMQalobXI+HaEUxpCkbKQUDOQqt9wawRw==",
2592 "license": "Apache-2.0",
2593 "dependencies": {
2594 "bare-events": "^2.5.4",
2595 "bare-path": "^3.0.0",
2596 "bare-stream": "^2.6.4",
2597 "bare-url": "^2.2.2",
2598 "fast-fifo": "^1.3.2"
2599 },
2600 "engines": {
2601 "bare": ">=1.16.0"
2602 },
2603 "peerDependencies": {
2604 "bare-buffer": "*"
2605 },
2606 "peerDependenciesMeta": {
2607 "bare-buffer": {
2608 "optional": true
2609 }
2610 }
2611 },
2612 "node_modules/bare-os": {
2613 "version": "3.9.1",
2614 "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.1.tgz",
2615 "integrity": "sha512-6M5XjcnsygQNPMCMPXSK379xrJFiZ/AEMNBmFEmQW8d/789VQATvriyi5r0HYTL9TkQ26rn3kgdTG3aisbrXkQ==",
2616 "license": "Apache-2.0",
2617 "engines": {
2618 "bare": ">=1.14.0"
2619 }
2620 },
2621 "node_modules/bare-path": {
2622 "version": "3.0.0",
2623 "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz",
2624 "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==",
2625 "license": "Apache-2.0",
2626 "dependencies": {
2627 "bare-os": "^3.0.1"
2628 }
2629 },
2630 "node_modules/bare-stream": {
2631 "version": "2.13.1",
2632 "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.1.tgz",
2633 "integrity": "sha512-Vp0cnjYyrEC4whYTymQ+YZi6pBpfiICZO3cfRG8sy67ZNWe951urv1x4eW1BKNngw3U+3fPYb5JQvHbCtxH7Ow==",
2634 "license": "Apache-2.0",
2635 "dependencies": {
2636 "streamx": "^2.25.0",
2637 "teex": "^1.0.1"
2638 },
2639 "peerDependencies": {
2640 "bare-abort-controller": "*",
2641 "bare-buffer": "*",
2642 "bare-events": "*"
2643 },
2644 "peerDependenciesMeta": {
2645 "bare-abort-controller": {
2646 "optional": true
2647 },
2648 "bare-buffer": {
2649 "optional": true
2650 },
2651 "bare-events": {
2652 "optional": true
2653 }
2654 }
2655 },
2656 "node_modules/bare-url": {
2657 "version": "2.4.3",
2658 "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.4.3.tgz",
2659 "integrity": "sha512-Kccpc7ACfXaxfeInfqKcZtW4pT5YBn1mesc4sCsun6sRwtbJ4h+sNOaksUpYEJUKfN65YWC6Bw2OJEFiKxq8nQ==",
2660 "license": "Apache-2.0",
2661 "dependencies": {
2662 "bare-path": "^3.0.0"
2663 }
2664 },
2665 "node_modules/base64-js": {
2666 "version": "1.5.1",
2667 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
2668 "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
2669 "funding": [
2670 {
2671 "type": "github",
2672 "url": "https://github.com/sponsors/feross"
2673 },
2674 {
2675 "type": "patreon",
2676 "url": "https://www.patreon.com/feross"
2677 },
2678 {
2679 "type": "consulting",
2680 "url": "https://feross.org/support"
2681 }
2682 ],
2683 "license": "MIT"
2684 },
2286 2685 "node_modules/baseline-browser-mapping": {
2287 2686 "version": "2.10.27",
2288 2687 "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.27.tgz",
@@ -2412,6 +2811,30 @@
2412 2811 "node-int64": "^0.4.0"
2413 2812 }
2414 2813 },
2814 "node_modules/buffer": {
2815 "version": "6.0.3",
2816 "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
2817 "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
2818 "funding": [
2819 {
2820 "type": "github",
2821 "url": "https://github.com/sponsors/feross"
2822 },
2823 {
2824 "type": "patreon",
2825 "url": "https://www.patreon.com/feross"
2826 },
2827 {
2828 "type": "consulting",
2829 "url": "https://feross.org/support"
2830 }
2831 ],
2832 "license": "MIT",
2833 "dependencies": {
2834 "base64-js": "^1.3.1",
2835 "ieee754": "^1.2.1"
2836 }
2837 },
2415 2838 "node_modules/buffer-crc32": {
2416 2839 "version": "0.2.13",
2417 2840 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@@ -2645,6 +3068,47 @@
2645 3068 "node": ">= 0.8"
2646 3069 }
2647 3070 },
3071 "node_modules/compress-commons": {
3072 "version": "6.0.2",
3073 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",
3074 "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==",
3075 "license": "MIT",
3076 "dependencies": {
3077 "crc-32": "^1.2.0",
3078 "crc32-stream": "^6.0.0",
3079 "is-stream": "^2.0.1",
3080 "normalize-path": "^3.0.0",
3081 "readable-stream": "^4.0.0"
3082 },
3083 "engines": {
3084 "node": ">= 14"
3085 }
3086 },
3087 "node_modules/compress-commons/node_modules/readable-stream": {
3088 "version": "4.7.0",
3089 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
3090 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
3091 "license": "MIT",
3092 "dependencies": {
3093 "abort-controller": "^3.0.0",
3094 "buffer": "^6.0.3",
3095 "events": "^3.3.0",
3096 "process": "^0.11.10",
3097 "string_decoder": "^1.3.0"
3098 },
3099 "engines": {
3100 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3101 }
3102 },
3103 "node_modules/compress-commons/node_modules/string_decoder": {
3104 "version": "1.3.0",
3105 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
3106 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
3107 "license": "MIT",
3108 "dependencies": {
3109 "safe-buffer": "~5.2.0"
3110 }
3111 },
2648 3112 "node_modules/concat-map": {
2649 3113 "version": "0.0.1",
2650 3114 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2720,6 +3184,56 @@
2720 3184 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
2721 3185 "license": "MIT"
2722 3186 },
3187 "node_modules/crc-32": {
3188 "version": "1.2.2",
3189 "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
3190 "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
3191 "license": "Apache-2.0",
3192 "bin": {
3193 "crc32": "bin/crc32.njs"
3194 },
3195 "engines": {
3196 "node": ">=0.8"
3197 }
3198 },
3199 "node_modules/crc32-stream": {
3200 "version": "6.0.0",
3201 "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz",
3202 "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==",
3203 "license": "MIT",
3204 "dependencies": {
3205 "crc-32": "^1.2.0",
3206 "readable-stream": "^4.0.0"
3207 },
3208 "engines": {
3209 "node": ">= 14"
3210 }
3211 },
3212 "node_modules/crc32-stream/node_modules/readable-stream": {
3213 "version": "4.7.0",
3214 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
3215 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
3216 "license": "MIT",
3217 "dependencies": {
3218 "abort-controller": "^3.0.0",
3219 "buffer": "^6.0.3",
3220 "events": "^3.3.0",
3221 "process": "^0.11.10",
3222 "string_decoder": "^1.3.0"
3223 },
3224 "engines": {
3225 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3226 }
3227 },
3228 "node_modules/crc32-stream/node_modules/string_decoder": {
3229 "version": "1.3.0",
3230 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
3231 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
3232 "license": "MIT",
3233 "dependencies": {
3234 "safe-buffer": "~5.2.0"
3235 }
3236 },
2723 3237 "node_modules/create-jest": {
2724 3238 "version": "29.7.0",
2725 3239 "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz",
@@ -2973,6 +3487,12 @@
2973 3487 "node": ">= 0.4"
2974 3488 }
2975 3489 },
3490 "node_modules/eastasianwidth": {
3491 "version": "0.2.0",
3492 "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
3493 "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
3494 "license": "MIT"
3495 },
2976 3496 "node_modules/ecdsa-sig-formatter": {
2977 3497 "version": "1.0.11",
2978 3498 "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
@@ -3177,6 +3697,33 @@
3177 3697 "node": ">= 0.6"
3178 3698 }
3179 3699 },
3700 "node_modules/event-target-shim": {
3701 "version": "5.0.1",
3702 "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
3703 "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
3704 "license": "MIT",
3705 "engines": {
3706 "node": ">=6"
3707 }
3708 },
3709 "node_modules/events": {
3710 "version": "3.3.0",
3711 "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
3712 "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
3713 "license": "MIT",
3714 "engines": {
3715 "node": ">=0.8.x"
3716 }
3717 },
3718 "node_modules/events-universal": {
3719 "version": "1.0.1",
3720 "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
3721 "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
3722 "license": "Apache-2.0",
3723 "dependencies": {
3724 "bare-events": "^2.7.0"
3725 }
3726 },
3180 3727 "node_modules/execa": {
3181 3728 "version": "5.1.1",
3182 3729 "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
@@ -3270,6 +3817,12 @@
3270 3817 "url": "https://opencollective.com/express"
3271 3818 }
3272 3819 },
3820 "node_modules/fast-fifo": {
3821 "version": "1.3.2",
3822 "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
3823 "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
3824 "license": "MIT"
3825 },
3273 3826 "node_modules/fast-json-stable-stringify": {
3274 3827 "version": "2.1.0",
3275 3828 "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -3337,6 +3890,34 @@
3337 3890 "node": ">=8"
3338 3891 }
3339 3892 },
3893 "node_modules/foreground-child": {
3894 "version": "3.3.1",
3895 "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
3896 "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
3897 "license": "ISC",
3898 "dependencies": {
3899 "cross-spawn": "^7.0.6",
3900 "signal-exit": "^4.0.1"
3901 },
3902 "engines": {
3903 "node": ">=14"
3904 },
3905 "funding": {
3906 "url": "https://github.com/sponsors/isaacs"
3907 }
3908 },
3909 "node_modules/foreground-child/node_modules/signal-exit": {
3910 "version": "4.1.0",
3911 "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
3912 "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
3913 "license": "ISC",
3914 "engines": {
3915 "node": ">=14"
3916 },
3917 "funding": {
3918 "url": "https://github.com/sponsors/isaacs"
3919 }
3920 },
3340 3921 "node_modules/form-data": {
3341 3922 "version": "4.0.5",
3342 3923 "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
@@ -3789,6 +4370,26 @@
3789 4370 "node": ">=0.10.0"
3790 4371 }
3791 4372 },
4373 "node_modules/ieee754": {
4374 "version": "1.2.1",
4375 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
4376 "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
4377 "funding": [
4378 {
4379 "type": "github",
4380 "url": "https://github.com/sponsors/feross"
4381 },
4382 {
4383 "type": "patreon",
4384 "url": "https://www.patreon.com/feross"
4385 },
4386 {
4387 "type": "consulting",
4388 "url": "https://feross.org/support"
4389 }
4390 ],
4391 "license": "BSD-3-Clause"
4392 },
3792 4393 "node_modules/import-local": {
3793 4394 "version": "3.2.0",
3794 4395 "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@@ -4040,6 +4641,21 @@
4040 4641 "node": ">=8"
4041 4642 }
4042 4643 },
4644 "node_modules/jackspeak": {
4645 "version": "3.4.3",
4646 "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
4647 "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
4648 "license": "BlueOak-1.0.0",
4649 "dependencies": {
4650 "@isaacs/cliui": "^8.0.2"
4651 },
4652 "funding": {
4653 "url": "https://github.com/sponsors/isaacs"
4654 },
4655 "optionalDependencies": {
4656 "@pkgjs/parseargs": "^0.11.0"
4657 }
4658 },
4043 4659 "node_modules/jest": {
4044 4660 "version": "29.7.0",
4045 4661 "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
@@ -5271,6 +5887,18 @@
5271 5887 "node": ">=0.2.0"
5272 5888 }
5273 5889 },
5890 "node_modules/lazystream": {
5891 "version": "1.0.1",
5892 "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz",
5893 "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",
5894 "license": "MIT",
5895 "dependencies": {
5896 "readable-stream": "^2.0.5"
5897 },
5898 "engines": {
5899 "node": ">= 0.6.3"
5900 }
5901 },
5274 5902 "node_modules/leven": {
5275 5903 "version": "3.1.0",
5276 5904 "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@@ -5806,6 +6434,12 @@
5806 6434 "node": ">=6"
5807 6435 }
5808 6436 },
6437 "node_modules/package-json-from-dist": {
6438 "version": "1.0.1",
6439 "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
6440 "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
6441 "license": "BlueOak-1.0.0"
6442 },
5809 6443 "node_modules/parse-json": {
5810 6444 "version": "5.2.0",
5811 6445 "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
@@ -5879,6 +6513,28 @@
5879 6513 "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
5880 6514 "license": "MIT"
5881 6515 },
6516 "node_modules/path-scurry": {
6517 "version": "1.11.1",
6518 "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
6519 "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
6520 "license": "BlueOak-1.0.0",
6521 "dependencies": {
6522 "lru-cache": "^10.2.0",
6523 "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
6524 },
6525 "engines": {
6526 "node": ">=16 || 14 >=14.18"
6527 },
6528 "funding": {
6529 "url": "https://github.com/sponsors/isaacs"
6530 }
6531 },
6532 "node_modules/path-scurry/node_modules/lru-cache": {
6533 "version": "10.4.3",
6534 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
6535 "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
6536 "license": "ISC"
6537 },
5882 6538 "node_modules/path-to-regexp": {
5883 6539 "version": "0.1.13",
5884 6540 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
@@ -5956,6 +6612,15 @@
5956 6612 "url": "https://github.com/chalk/ansi-styles?sponsor=1"
5957 6613 }
5958 6614 },
6615 "node_modules/process": {
6616 "version": "0.11.10",
6617 "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
6618 "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
6619 "license": "MIT",
6620 "engines": {
6621 "node": ">= 0.6.0"
6622 }
6623 },
5959 6624 "node_modules/process-nextick-args": {
5960 6625 "version": "2.0.1",
5961 6626 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -6100,6 +6765,36 @@
6100 6765 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
6101 6766 "license": "MIT"
6102 6767 },
6768 "node_modules/readdir-glob": {
6769 "version": "1.1.3",
6770 "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz",
6771 "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==",
6772 "license": "Apache-2.0",
6773 "dependencies": {
6774 "minimatch": "^5.1.0"
6775 }
6776 },
6777 "node_modules/readdir-glob/node_modules/brace-expansion": {
6778 "version": "2.1.0",
6779 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
6780 "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
6781 "license": "MIT",
6782 "dependencies": {
6783 "balanced-match": "^1.0.0"
6784 }
6785 },
6786 "node_modules/readdir-glob/node_modules/minimatch": {
6787 "version": "5.1.9",
6788 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
6789 "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
6790 "license": "ISC",
6791 "dependencies": {
6792 "brace-expansion": "^2.0.1"
6793 },
6794 "engines": {
6795 "node": ">=10"
6796 }
6797 },
6103 6798 "node_modules/require-directory": {
6104 6799 "version": "2.1.1",
6105 6800 "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -6510,6 +7205,17 @@
6510 7205 "node": ">=10.0.0"
6511 7206 }
6512 7207 },
7208 "node_modules/streamx": {
7209 "version": "2.25.0",
7210 "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.25.0.tgz",
7211 "integrity": "sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg==",
7212 "license": "MIT",
7213 "dependencies": {
7214 "events-universal": "^1.0.0",
7215 "fast-fifo": "^1.3.2",
7216 "text-decoder": "^1.1.0"
7217 }
7218 },
6513 7219 "node_modules/string_decoder": {
6514 7220 "version": "1.1.1",
6515 7221 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -6552,6 +7258,21 @@
6552 7258 "node": ">=8"
6553 7259 }
6554 7260 },
7261 "node_modules/string-width-cjs": {
7262 "name": "string-width",
7263 "version": "4.2.3",
7264 "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
7265 "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
7266 "license": "MIT",
7267 "dependencies": {
7268 "emoji-regex": "^8.0.0",
7269 "is-fullwidth-code-point": "^3.0.0",
7270 "strip-ansi": "^6.0.1"
7271 },
7272 "engines": {
7273 "node": ">=8"
7274 }
7275 },
6555 7276 "node_modules/strip-ansi": {
6556 7277 "version": "6.0.1",
6557 7278 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -6564,6 +7285,19 @@
6564 7285 "node": ">=8"
6565 7286 }
6566 7287 },
7288 "node_modules/strip-ansi-cjs": {
7289 "name": "strip-ansi",
7290 "version": "6.0.1",
7291 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
7292 "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
7293 "license": "MIT",
7294 "dependencies": {
7295 "ansi-regex": "^5.0.1"
7296 },
7297 "engines": {
7298 "node": ">=8"
7299 }
7300 },
6567 7301 "node_modules/strip-bom": {
6568 7302 "version": "4.0.0",
6569 7303 "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",
@@ -6643,6 +7377,18 @@
6643 7377 "node": ">=10"
6644 7378 }
6645 7379 },
7380 "node_modules/tar-stream": {
7381 "version": "3.2.0",
7382 "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.0.tgz",
7383 "integrity": "sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg==",
7384 "license": "MIT",
7385 "dependencies": {
7386 "b4a": "^1.6.4",
7387 "bare-fs": "^4.5.5",
7388 "fast-fifo": "^1.2.0",
7389 "streamx": "^2.15.0"
7390 }
7391 },
6646 7392 "node_modules/tar/node_modules/mkdirp": {
6647 7393 "version": "1.0.4",
6648 7394 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -6661,6 +7407,15 @@
6661 7407 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
6662 7408 "license": "ISC"
6663 7409 },
7410 "node_modules/teex": {
7411 "version": "1.0.1",
7412 "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
7413 "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
7414 "license": "MIT",
7415 "dependencies": {
7416 "streamx": "^2.12.5"
7417 }
7418 },
6664 7419 "node_modules/test-exclude": {
6665 7420 "version": "6.0.0",
6666 7421 "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
@@ -6675,6 +7430,15 @@
6675 7430 "node": ">=8"
6676 7431 }
6677 7432 },
7433 "node_modules/text-decoder": {
7434 "version": "1.2.7",
7435 "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
7436 "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
7437 "license": "Apache-2.0",
7438 "dependencies": {
7439 "b4a": "^1.6.4"
7440 }
7441 },
6678 7442 "node_modules/tldts": {
6679 7443 "version": "6.1.86",
6680 7444 "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
@@ -7025,6 +7789,24 @@
7025 7789 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
7026 7790 }
7027 7791 },
7792 "node_modules/wrap-ansi-cjs": {
7793 "name": "wrap-ansi",
7794 "version": "7.0.0",
7795 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
7796 "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
7797 "license": "MIT",
7798 "dependencies": {
7799 "ansi-styles": "^4.0.0",
7800 "string-width": "^4.1.0",
7801 "strip-ansi": "^6.0.0"
7802 },
7803 "engines": {
7804 "node": ">=10"
7805 },
7806 "funding": {
7807 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
7808 }
7809 },
7028 7810 "node_modules/wrappy": {
7029 7811 "version": "1.0.2",
7030 7812 "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@@ -7155,6 +7937,45 @@
7155 7937 "funding": {
7156 7938 "url": "https://github.com/sponsors/sindresorhus"
7157 7939 }
7940 },
7941 "node_modules/zip-stream": {
7942 "version": "6.0.1",
7943 "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.1.tgz",
7944 "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==",
7945 "license": "MIT",
7946 "dependencies": {
7947 "archiver-utils": "^5.0.0",
7948 "compress-commons": "^6.0.2",
7949 "readable-stream": "^4.0.0"
7950 },
7951 "engines": {
7952 "node": ">= 14"
7953 }
7954 },
7955 "node_modules/zip-stream/node_modules/readable-stream": {
7956 "version": "4.7.0",
7957 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
7958 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
7959 "license": "MIT",
7960 "dependencies": {
7961 "abort-controller": "^3.0.0",
7962 "buffer": "^6.0.3",
7963 "events": "^3.3.0",
7964 "process": "^0.11.10",
7965 "string_decoder": "^1.3.0"
7966 },
7967 "engines": {
7968 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
7969 }
7970 },
7971 "node_modules/zip-stream/node_modules/string_decoder": {
7972 "version": "1.3.0",
7973 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
7974 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
7975 "license": "MIT",
7976 "dependencies": {
7977 "safe-buffer": "~5.2.0"
7978 }
7158 7979 }
7159 7980 }
7160 7981 }
@@ -8,6 +8,7 @@
8 "name": "filemanager",
8 "name": "filemanager",
9 "version": "1.0.0",
9 "version": "1.0.0",
10 "dependencies": {
10 "dependencies": {
11 "archiver": "^7.0.1",
11 "bcrypt": "^5.1.1",
12 "bcrypt": "^5.1.1",
12 "express": "^4.18.2",
13 "express": "^4.18.2",
13 "geoip-lite": "^1.4.10",
14 "geoip-lite": "^1.4.10",
@@ -1159,6 +1160,102 @@
1159 "url": "https://opencollective.com/libvips"
1160 "url": "https://opencollective.com/libvips"
1160 }
1161 }
1161 },
1162 },
1163 "node_modules/@isaacs/cliui": {
1164 "version": "8.0.2",
1165 "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
1166 "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
1167 "license": "ISC",
1168 "dependencies": {
1169 "string-width": "^5.1.2",
1170 "string-width-cjs": "npm:string-width@^4.2.0",
1171 "strip-ansi": "^7.0.1",
1172 "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
1173 "wrap-ansi": "^8.1.0",
1174 "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
1175 },
1176 "engines": {
1177 "node": ">=12"
1178 }
1179 },
1180 "node_modules/@isaacs/cliui/node_modules/ansi-regex": {
1181 "version": "6.2.2",
1182 "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
1183 "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
1184 "license": "MIT",
1185 "engines": {
1186 "node": ">=12"
1187 },
1188 "funding": {
1189 "url": "https://github.com/chalk/ansi-regex?sponsor=1"
1190 }
1191 },
1192 "node_modules/@isaacs/cliui/node_modules/ansi-styles": {
1193 "version": "6.2.3",
1194 "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
1195 "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
1196 "license": "MIT",
1197 "engines": {
1198 "node": ">=12"
1199 },
1200 "funding": {
1201 "url": "https://github.com/chalk/ansi-styles?sponsor=1"
1202 }
1203 },
1204 "node_modules/@isaacs/cliui/node_modules/emoji-regex": {
1205 "version": "9.2.2",
1206 "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
1207 "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
1208 "license": "MIT"
1209 },
1210 "node_modules/@isaacs/cliui/node_modules/string-width": {
1211 "version": "5.1.2",
1212 "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
1213 "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
1214 "license": "MIT",
1215 "dependencies": {
1216 "eastasianwidth": "^0.2.0",
1217 "emoji-regex": "^9.2.2",
1218 "strip-ansi": "^7.0.1"
1219 },
1220 "engines": {
1221 "node": ">=12"
1222 },
1223 "funding": {
1224 "url": "https://github.com/sponsors/sindresorhus"
1225 }
1226 },
1227 "node_modules/@isaacs/cliui/node_modules/strip-ansi": {
1228 "version": "7.2.0",
1229 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
1230 "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
1231 "license": "MIT",
1232 "dependencies": {
1233 "ansi-regex": "^6.2.2"
1234 },
1235 "engines": {
1236 "node": ">=12"
1237 },
1238 "funding": {
1239 "url": "https://github.com/chalk/strip-ansi?sponsor=1"
1240 }
1241 },
1242 "node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
1243 "version": "8.1.0",
1244 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
1245 "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
1246 "license": "MIT",
1247 "dependencies": {
1248 "ansi-styles": "^6.1.0",
1249 "string-width": "^5.0.1",
1250 "strip-ansi": "^7.0.1"
1251 },
1252 "engines": {
1253 "node": ">=12"
1254 },
1255 "funding": {
1256 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
1257 }
1258 },
1162 "node_modules/@istanbuljs/load-nyc-config": {
1259 "node_modules/@istanbuljs/load-nyc-config": {
1163 "version": "1.1.0",
1260 "version": "1.1.0",
1164 "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
1261 "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@@ -1773,6 +1870,16 @@
1773 "node-pre-gyp": "bin/node-pre-gyp"
1870 "node-pre-gyp": "bin/node-pre-gyp"
1774 }
1871 }
1775 },
1872 },
1873 "node_modules/@pkgjs/parseargs": {
1874 "version": "0.11.0",
1875 "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
1876 "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
1877 "license": "MIT",
1878 "optional": true,
1879 "engines": {
1880 "node": ">=14"
1881 }
1882 },
1776 "node_modules/@sinclair/typebox": {
1883 "node_modules/@sinclair/typebox": {
1777 "version": "0.27.10",
1884 "version": "0.27.10",
1778 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz",
1885 "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.10.tgz",
@@ -1944,6 +2051,18 @@
1944 "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
2051 "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
1945 "license": "ISC"
2052 "license": "ISC"
1946 },
2053 },
2054 "node_modules/abort-controller": {
2055 "version": "3.0.0",
2056 "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
2057 "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
2058 "license": "MIT",
2059 "dependencies": {
2060 "event-target-shim": "^5.0.0"
2061 },
2062 "engines": {
2063 "node": ">=6.5"
2064 }
2065 },
1947 "node_modules/accepts": {
2066 "node_modules/accepts": {
1948 "version": "1.3.8",
2067 "version": "1.3.8",
1949 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
2068 "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
@@ -2093,6 +2212,161 @@
2093 "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==",
2212 "integrity": "sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==",
2094 "license": "ISC"
2213 "license": "ISC"
2095 },
2214 },
2215 "node_modules/archiver": {
2216 "version": "7.0.1",
2217 "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz",
2218 "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==",
2219 "license": "MIT",
2220 "dependencies": {
2221 "archiver-utils": "^5.0.2",
2222 "async": "^3.2.4",
2223 "buffer-crc32": "^1.0.0",
2224 "readable-stream": "^4.0.0",
2225 "readdir-glob": "^1.1.2",
2226 "tar-stream": "^3.0.0",
2227 "zip-stream": "^6.0.1"
2228 },
2229 "engines": {
2230 "node": ">= 14"
2231 }
2232 },
2233 "node_modules/archiver-utils": {
2234 "version": "5.0.2",
2235 "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.2.tgz",
2236 "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==",
2237 "license": "MIT",
2238 "dependencies": {
2239 "glob": "^10.0.0",
2240 "graceful-fs": "^4.2.0",
2241 "is-stream": "^2.0.1",
2242 "lazystream": "^1.0.0",
2243 "lodash": "^4.17.15",
2244 "normalize-path": "^3.0.0",
2245 "readable-stream": "^4.0.0"
2246 },
2247 "engines": {
2248 "node": ">= 14"
2249 }
2250 },
2251 "node_modules/archiver-utils/node_modules/brace-expansion": {
2252 "version": "2.1.0",
2253 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
2254 "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
2255 "license": "MIT",
2256 "dependencies": {
2257 "balanced-match": "^1.0.0"
2258 }
2259 },
2260 "node_modules/archiver-utils/node_modules/glob": {
2261 "version": "10.5.0",
2262 "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
2263 "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
2264 "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
2265 "license": "ISC",
2266 "dependencies": {
2267 "foreground-child": "^3.1.0",
2268 "jackspeak": "^3.1.2",
2269 "minimatch": "^9.0.4",
2270 "minipass": "^7.1.2",
2271 "package-json-from-dist": "^1.0.0",
2272 "path-scurry": "^1.11.1"
2273 },
2274 "bin": {
2275 "glob": "dist/esm/bin.mjs"
2276 },
2277 "funding": {
2278 "url": "https://github.com/sponsors/isaacs"
2279 }
2280 },
2281 "node_modules/archiver-utils/node_modules/minimatch": {
2282 "version": "9.0.9",
2283 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
2284 "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
2285 "license": "ISC",
2286 "dependencies": {
2287 "brace-expansion": "^2.0.2"
2288 },
2289 "engines": {
2290 "node": ">=16 || 14 >=14.17"
2291 },
2292 "funding": {
2293 "url": "https://github.com/sponsors/isaacs"
2294 }
2295 },
2296 "node_modules/archiver-utils/node_modules/minipass": {
2297 "version": "7.1.3",
2298 "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
2299 "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
2300 "license": "BlueOak-1.0.0",
2301 "engines": {
2302 "node": ">=16 || 14 >=14.17"
2303 }
2304 },
2305 "node_modules/archiver-utils/node_modules/readable-stream": {
2306 "version": "4.7.0",
2307 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
2308 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
2309 "license": "MIT",
2310 "dependencies": {
2311 "abort-controller": "^3.0.0",
2312 "buffer": "^6.0.3",
2313 "events": "^3.3.0",
2314 "process": "^0.11.10",
2315 "string_decoder": "^1.3.0"
2316 },
2317 "engines": {
2318 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
2319 }
2320 },
2321 "node_modules/archiver-utils/node_modules/string_decoder": {
2322 "version": "1.3.0",
2323 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
2324 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
2325 "license": "MIT",
2326 "dependencies": {
2327 "safe-buffer": "~5.2.0"
2328 }
2329 },
2330 "node_modules/archiver/node_modules/async": {
2331 "version": "3.2.6",
2332 "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
2333 "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
2334 "license": "MIT"
2335 },
2336 "node_modules/archiver/node_modules/buffer-crc32": {
2337 "version": "1.0.0",
2338 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz",
2339 "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==",
2340 "license": "MIT",
2341 "engines": {
2342 "node": ">=8.0.0"
2343 }
2344 },
2345 "node_modules/archiver/node_modules/readable-stream": {
2346 "version": "4.7.0",
2347 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
2348 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
2349 "license": "MIT",
2350 "dependencies": {
2351 "abort-controller": "^3.0.0",
2352 "buffer": "^6.0.3",
2353 "events": "^3.3.0",
2354 "process": "^0.11.10",
2355 "string_decoder": "^1.3.0"
2356 },
2357 "engines": {
2358 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
2359 }
2360 },
2361 "node_modules/archiver/node_modules/string_decoder": {
2362 "version": "1.3.0",
2363 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
2364 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
2365 "license": "MIT",
2366 "dependencies": {
2367 "safe-buffer": "~5.2.0"
2368 }
2369 },
2096 "node_modules/are-we-there-yet": {
2370 "node_modules/are-we-there-yet": {
2097 "version": "2.0.0",
2371 "version": "2.0.0",
2098 "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
2372 "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz",
@@ -2158,6 +2432,20 @@
2158 "dev": true,
2432 "dev": true,
2159 "license": "MIT"
2433 "license": "MIT"
2160 },
2434 },
2435 "node_modules/b4a": {
2436 "version": "1.8.1",
2437 "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.8.1.tgz",
2438 "integrity": "sha512-aiqre1Nr0B/6DgE2N5vwTc+2/oQZ4Wh1t4NznYY4E00y8LCt6NqdRv81so00oo27D8MVKTpUa/MwUUtBLXCoDw==",
2439 "license": "Apache-2.0",
2440 "peerDependencies": {
2441 "react-native-b4a": "*"
2442 },
2443 "peerDependenciesMeta": {
2444 "react-native-b4a": {
2445 "optional": true
2446 }
2447 }
2448 },
2161 "node_modules/babel-jest": {
2449 "node_modules/babel-jest": {
2162 "version": "29.7.0",
2450 "version": "29.7.0",
2163 "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz",
2451 "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz",
@@ -2283,6 +2571,117 @@
2283 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
2571 "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
2284 "license": "MIT"
2572 "license": "MIT"
2285 },
2573 },
2574 "node_modules/bare-events": {
2575 "version": "2.8.2",
2576 "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
2577 "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
2578 "license": "Apache-2.0",
2579 "peerDependencies": {
2580 "bare-abort-controller": "*"
2581 },
2582 "peerDependenciesMeta": {
2583 "bare-abort-controller": {
2584 "optional": true
2585 }
2586 }
2587 },
2588 "node_modules/bare-fs": {
2589 "version": "4.7.1",
2590 "resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.7.1.tgz",
2591 "integrity": "sha512-WDRsyVN52eAx/lBamKD6uyw8H4228h/x0sGGGegOamM2cd7Pag88GfMQalobXI+HaEUxpCkbKQUDOQqt9wawRw==",
2592 "license": "Apache-2.0",
2593 "dependencies": {
2594 "bare-events": "^2.5.4",
2595 "bare-path": "^3.0.0",
2596 "bare-stream": "^2.6.4",
2597 "bare-url": "^2.2.2",
2598 "fast-fifo": "^1.3.2"
2599 },
2600 "engines": {
2601 "bare": ">=1.16.0"
2602 },
2603 "peerDependencies": {
2604 "bare-buffer": "*"
2605 },
2606 "peerDependenciesMeta": {
2607 "bare-buffer": {
2608 "optional": true
2609 }
2610 }
2611 },
2612 "node_modules/bare-os": {
2613 "version": "3.9.1",
2614 "resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.9.1.tgz",
2615 "integrity": "sha512-6M5XjcnsygQNPMCMPXSK379xrJFiZ/AEMNBmFEmQW8d/789VQATvriyi5r0HYTL9TkQ26rn3kgdTG3aisbrXkQ==",
2616 "license": "Apache-2.0",
2617 "engines": {
2618 "bare": ">=1.14.0"
2619 }
2620 },
2621 "node_modules/bare-path": {
2622 "version": "3.0.0",
2623 "resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz",
2624 "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==",
2625 "license": "Apache-2.0",
2626 "dependencies": {
2627 "bare-os": "^3.0.1"
2628 }
2629 },
2630 "node_modules/bare-stream": {
2631 "version": "2.13.1",
2632 "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.13.1.tgz",
2633 "integrity": "sha512-Vp0cnjYyrEC4whYTymQ+YZi6pBpfiICZO3cfRG8sy67ZNWe951urv1x4eW1BKNngw3U+3fPYb5JQvHbCtxH7Ow==",
2634 "license": "Apache-2.0",
2635 "dependencies": {
2636 "streamx": "^2.25.0",
2637 "teex": "^1.0.1"
2638 },
2639 "peerDependencies": {
2640 "bare-abort-controller": "*",
2641 "bare-buffer": "*",
2642 "bare-events": "*"
2643 },
2644 "peerDependenciesMeta": {
2645 "bare-abort-controller": {
2646 "optional": true
2647 },
2648 "bare-buffer": {
2649 "optional": true
2650 },
2651 "bare-events": {
2652 "optional": true
2653 }
2654 }
2655 },
2656 "node_modules/bare-url": {
2657 "version": "2.4.3",
2658 "resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.4.3.tgz",
2659 "integrity": "sha512-Kccpc7ACfXaxfeInfqKcZtW4pT5YBn1mesc4sCsun6sRwtbJ4h+sNOaksUpYEJUKfN65YWC6Bw2OJEFiKxq8nQ==",
2660 "license": "Apache-2.0",
2661 "dependencies": {
2662 "bare-path": "^3.0.0"
2663 }
2664 },
2665 "node_modules/base64-js": {
2666 "version": "1.5.1",
2667 "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
2668 "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
2669 "funding": [
2670 {
2671 "type": "github",
2672 "url": "https://github.com/sponsors/feross"
2673 },
2674 {
2675 "type": "patreon",
2676 "url": "https://www.patreon.com/feross"
2677 },
2678 {
2679 "type": "consulting",
2680 "url": "https://feross.org/support"
2681 }
2682 ],
2683 "license": "MIT"
2684 },
2286 "node_modules/baseline-browser-mapping": {
2685 "node_modules/baseline-browser-mapping": {
2287 "version": "2.10.27",
2686 "version": "2.10.27",
2288 "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.27.tgz",
2687 "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.27.tgz",
@@ -2412,6 +2811,30 @@
2412 "node-int64": "^0.4.0"
2811 "node-int64": "^0.4.0"
2413 }
2812 }
2414 },
2813 },
2814 "node_modules/buffer": {
2815 "version": "6.0.3",
2816 "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz",
2817 "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==",
2818 "funding": [
2819 {
2820 "type": "github",
2821 "url": "https://github.com/sponsors/feross"
2822 },
2823 {
2824 "type": "patreon",
2825 "url": "https://www.patreon.com/feross"
2826 },
2827 {
2828 "type": "consulting",
2829 "url": "https://feross.org/support"
2830 }
2831 ],
2832 "license": "MIT",
2833 "dependencies": {
2834 "base64-js": "^1.3.1",
2835 "ieee754": "^1.2.1"
2836 }
2837 },
2415 "node_modules/buffer-crc32": {
2838 "node_modules/buffer-crc32": {
2416 "version": "0.2.13",
2839 "version": "0.2.13",
2417 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
2840 "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
@@ -2645,6 +3068,47 @@
2645 "node": ">= 0.8"
3068 "node": ">= 0.8"
2646 }
3069 }
2647 },
3070 },
3071 "node_modules/compress-commons": {
3072 "version": "6.0.2",
3073 "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz",
3074 "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==",
3075 "license": "MIT",
3076 "dependencies": {
3077 "crc-32": "^1.2.0",
3078 "crc32-stream": "^6.0.0",
3079 "is-stream": "^2.0.1",
3080 "normalize-path": "^3.0.0",
3081 "readable-stream": "^4.0.0"
3082 },
3083 "engines": {
3084 "node": ">= 14"
3085 }
3086 },
3087 "node_modules/compress-commons/node_modules/readable-stream": {
3088 "version": "4.7.0",
3089 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
3090 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
3091 "license": "MIT",
3092 "dependencies": {
3093 "abort-controller": "^3.0.0",
3094 "buffer": "^6.0.3",
3095 "events": "^3.3.0",
3096 "process": "^0.11.10",
3097 "string_decoder": "^1.3.0"
3098 },
3099 "engines": {
3100 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3101 }
3102 },
3103 "node_modules/compress-commons/node_modules/string_decoder": {
3104 "version": "1.3.0",
3105 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
3106 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
3107 "license": "MIT",
3108 "dependencies": {
3109 "safe-buffer": "~5.2.0"
3110 }
3111 },
2648 "node_modules/concat-map": {
3112 "node_modules/concat-map": {
2649 "version": "0.0.1",
3113 "version": "0.0.1",
2650 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
3114 "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -2720,6 +3184,56 @@
2720 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
3184 "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
2721 "license": "MIT"
3185 "license": "MIT"
2722 },
3186 },
3187 "node_modules/crc-32": {
3188 "version": "1.2.2",
3189 "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
3190 "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
3191 "license": "Apache-2.0",
3192 "bin": {
3193 "crc32": "bin/crc32.njs"
3194 },
3195 "engines": {
3196 "node": ">=0.8"
3197 }
3198 },
3199 "node_modules/crc32-stream": {
3200 "version": "6.0.0",
3201 "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz",
3202 "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==",
3203 "license": "MIT",
3204 "dependencies": {
3205 "crc-32": "^1.2.0",
3206 "readable-stream": "^4.0.0"
3207 },
3208 "engines": {
3209 "node": ">= 14"
3210 }
3211 },
3212 "node_modules/crc32-stream/node_modules/readable-stream": {
3213 "version": "4.7.0",
3214 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
3215 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
3216 "license": "MIT",
3217 "dependencies": {
3218 "abort-controller": "^3.0.0",
3219 "buffer": "^6.0.3",
3220 "events": "^3.3.0",
3221 "process": "^0.11.10",
3222 "string_decoder": "^1.3.0"
3223 },
3224 "engines": {
3225 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
3226 }
3227 },
3228 "node_modules/crc32-stream/node_modules/string_decoder": {
3229 "version": "1.3.0",
3230 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
3231 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
3232 "license": "MIT",
3233 "dependencies": {
3234 "safe-buffer": "~5.2.0"
3235 }
3236 },
2723 "node_modules/create-jest": {
3237 "node_modules/create-jest": {
2724 "version": "29.7.0",
3238 "version": "29.7.0",
2725 "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz",
3239 "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz",
@@ -2973,6 +3487,12 @@
2973 "node": ">= 0.4"
3487 "node": ">= 0.4"
2974 }
3488 }
2975 },
3489 },
3490 "node_modules/eastasianwidth": {
3491 "version": "0.2.0",
3492 "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
3493 "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
3494 "license": "MIT"
3495 },
2976 "node_modules/ecdsa-sig-formatter": {
3496 "node_modules/ecdsa-sig-formatter": {
2977 "version": "1.0.11",
3497 "version": "1.0.11",
2978 "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
3498 "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz",
@@ -3177,6 +3697,33 @@
3177 "node": ">= 0.6"
3697 "node": ">= 0.6"
3178 }
3698 }
3179 },
3699 },
3700 "node_modules/event-target-shim": {
3701 "version": "5.0.1",
3702 "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
3703 "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==",
3704 "license": "MIT",
3705 "engines": {
3706 "node": ">=6"
3707 }
3708 },
3709 "node_modules/events": {
3710 "version": "3.3.0",
3711 "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
3712 "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
3713 "license": "MIT",
3714 "engines": {
3715 "node": ">=0.8.x"
3716 }
3717 },
3718 "node_modules/events-universal": {
3719 "version": "1.0.1",
3720 "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
3721 "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
3722 "license": "Apache-2.0",
3723 "dependencies": {
3724 "bare-events": "^2.7.0"
3725 }
3726 },
3180 "node_modules/execa": {
3727 "node_modules/execa": {
3181 "version": "5.1.1",
3728 "version": "5.1.1",
3182 "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
3729 "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz",
@@ -3270,6 +3817,12 @@
3270 "url": "https://opencollective.com/express"
3817 "url": "https://opencollective.com/express"
3271 }
3818 }
3272 },
3819 },
3820 "node_modules/fast-fifo": {
3821 "version": "1.3.2",
3822 "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
3823 "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
3824 "license": "MIT"
3825 },
3273 "node_modules/fast-json-stable-stringify": {
3826 "node_modules/fast-json-stable-stringify": {
3274 "version": "2.1.0",
3827 "version": "2.1.0",
3275 "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
3828 "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -3337,6 +3890,34 @@
3337 "node": ">=8"
3890 "node": ">=8"
3338 }
3891 }
3339 },
3892 },
3893 "node_modules/foreground-child": {
3894 "version": "3.3.1",
3895 "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
3896 "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
3897 "license": "ISC",
3898 "dependencies": {
3899 "cross-spawn": "^7.0.6",
3900 "signal-exit": "^4.0.1"
3901 },
3902 "engines": {
3903 "node": ">=14"
3904 },
3905 "funding": {
3906 "url": "https://github.com/sponsors/isaacs"
3907 }
3908 },
3909 "node_modules/foreground-child/node_modules/signal-exit": {
3910 "version": "4.1.0",
3911 "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
3912 "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
3913 "license": "ISC",
3914 "engines": {
3915 "node": ">=14"
3916 },
3917 "funding": {
3918 "url": "https://github.com/sponsors/isaacs"
3919 }
3920 },
3340 "node_modules/form-data": {
3921 "node_modules/form-data": {
3341 "version": "4.0.5",
3922 "version": "4.0.5",
3342 "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
3923 "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
@@ -3789,6 +4370,26 @@
3789 "node": ">=0.10.0"
4370 "node": ">=0.10.0"
3790 }
4371 }
3791 },
4372 },
4373 "node_modules/ieee754": {
4374 "version": "1.2.1",
4375 "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
4376 "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
4377 "funding": [
4378 {
4379 "type": "github",
4380 "url": "https://github.com/sponsors/feross"
4381 },
4382 {
4383 "type": "patreon",
4384 "url": "https://www.patreon.com/feross"
4385 },
4386 {
4387 "type": "consulting",
4388 "url": "https://feross.org/support"
4389 }
4390 ],
4391 "license": "BSD-3-Clause"
4392 },
3792 "node_modules/import-local": {
4393 "node_modules/import-local": {
3793 "version": "3.2.0",
4394 "version": "3.2.0",
3794 "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
4395 "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@@ -4040,6 +4641,21 @@
4040 "node": ">=8"
4641 "node": ">=8"
4041 }
4642 }
4042 },
4643 },
4644 "node_modules/jackspeak": {
4645 "version": "3.4.3",
4646 "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
4647 "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
4648 "license": "BlueOak-1.0.0",
4649 "dependencies": {
4650 "@isaacs/cliui": "^8.0.2"
4651 },
4652 "funding": {
4653 "url": "https://github.com/sponsors/isaacs"
4654 },
4655 "optionalDependencies": {
4656 "@pkgjs/parseargs": "^0.11.0"
4657 }
4658 },
4043 "node_modules/jest": {
4659 "node_modules/jest": {
4044 "version": "29.7.0",
4660 "version": "29.7.0",
4045 "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
4661 "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz",
@@ -5271,6 +5887,18 @@
5271 "node": ">=0.2.0"
5887 "node": ">=0.2.0"
5272 }
5888 }
5273 },
5889 },
5890 "node_modules/lazystream": {
5891 "version": "1.0.1",
5892 "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz",
5893 "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==",
5894 "license": "MIT",
5895 "dependencies": {
5896 "readable-stream": "^2.0.5"
5897 },
5898 "engines": {
5899 "node": ">= 0.6.3"
5900 }
5901 },
5274 "node_modules/leven": {
5902 "node_modules/leven": {
5275 "version": "3.1.0",
5903 "version": "3.1.0",
5276 "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
5904 "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@@ -5806,6 +6434,12 @@
5806 "node": ">=6"
6434 "node": ">=6"
5807 }
6435 }
5808 },
6436 },
6437 "node_modules/package-json-from-dist": {
6438 "version": "1.0.1",
6439 "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
6440 "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
6441 "license": "BlueOak-1.0.0"
6442 },
5809 "node_modules/parse-json": {
6443 "node_modules/parse-json": {
5810 "version": "5.2.0",
6444 "version": "5.2.0",
5811 "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
6445 "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz",
@@ -5879,6 +6513,28 @@
5879 "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
6513 "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
5880 "license": "MIT"
6514 "license": "MIT"
5881 },
6515 },
6516 "node_modules/path-scurry": {
6517 "version": "1.11.1",
6518 "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
6519 "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
6520 "license": "BlueOak-1.0.0",
6521 "dependencies": {
6522 "lru-cache": "^10.2.0",
6523 "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
6524 },
6525 "engines": {
6526 "node": ">=16 || 14 >=14.18"
6527 },
6528 "funding": {
6529 "url": "https://github.com/sponsors/isaacs"
6530 }
6531 },
6532 "node_modules/path-scurry/node_modules/lru-cache": {
6533 "version": "10.4.3",
6534 "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
6535 "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
6536 "license": "ISC"
6537 },
5882 "node_modules/path-to-regexp": {
6538 "node_modules/path-to-regexp": {
5883 "version": "0.1.13",
6539 "version": "0.1.13",
5884 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
6540 "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
@@ -5956,6 +6612,15 @@
5956 "url": "https://github.com/chalk/ansi-styles?sponsor=1"
6612 "url": "https://github.com/chalk/ansi-styles?sponsor=1"
5957 }
6613 }
5958 },
6614 },
6615 "node_modules/process": {
6616 "version": "0.11.10",
6617 "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
6618 "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==",
6619 "license": "MIT",
6620 "engines": {
6621 "node": ">= 0.6.0"
6622 }
6623 },
5959 "node_modules/process-nextick-args": {
6624 "node_modules/process-nextick-args": {
5960 "version": "2.0.1",
6625 "version": "2.0.1",
5961 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
6626 "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -6100,6 +6765,36 @@
6100 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
6765 "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
6101 "license": "MIT"
6766 "license": "MIT"
6102 },
6767 },
6768 "node_modules/readdir-glob": {
6769 "version": "1.1.3",
6770 "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz",
6771 "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==",
6772 "license": "Apache-2.0",
6773 "dependencies": {
6774 "minimatch": "^5.1.0"
6775 }
6776 },
6777 "node_modules/readdir-glob/node_modules/brace-expansion": {
6778 "version": "2.1.0",
6779 "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.0.tgz",
6780 "integrity": "sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==",
6781 "license": "MIT",
6782 "dependencies": {
6783 "balanced-match": "^1.0.0"
6784 }
6785 },
6786 "node_modules/readdir-glob/node_modules/minimatch": {
6787 "version": "5.1.9",
6788 "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz",
6789 "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==",
6790 "license": "ISC",
6791 "dependencies": {
6792 "brace-expansion": "^2.0.1"
6793 },
6794 "engines": {
6795 "node": ">=10"
6796 }
6797 },
6103 "node_modules/require-directory": {
6798 "node_modules/require-directory": {
6104 "version": "2.1.1",
6799 "version": "2.1.1",
6105 "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
6800 "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -6510,6 +7205,17 @@
6510 "node": ">=10.0.0"
7205 "node": ">=10.0.0"
6511 }
7206 }
6512 },
7207 },
7208 "node_modules/streamx": {
7209 "version": "2.25.0",
7210 "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.25.0.tgz",
7211 "integrity": "sha512-0nQuG6jf1w+wddNEEXCF4nTg3LtufWINB5eFEN+5TNZW7KWJp6x87+JFL43vaAUPyCfH1wID+mNVyW6OHtFamg==",
7212 "license": "MIT",
7213 "dependencies": {
7214 "events-universal": "^1.0.0",
7215 "fast-fifo": "^1.3.2",
7216 "text-decoder": "^1.1.0"
7217 }
7218 },
6513 "node_modules/string_decoder": {
7219 "node_modules/string_decoder": {
6514 "version": "1.1.1",
7220 "version": "1.1.1",
6515 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
7221 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
@@ -6552,6 +7258,21 @@
6552 "node": ">=8"
7258 "node": ">=8"
6553 }
7259 }
6554 },
7260 },
7261 "node_modules/string-width-cjs": {
7262 "name": "string-width",
7263 "version": "4.2.3",
7264 "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
7265 "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
7266 "license": "MIT",
7267 "dependencies": {
7268 "emoji-regex": "^8.0.0",
7269 "is-fullwidth-code-point": "^3.0.0",
7270 "strip-ansi": "^6.0.1"
7271 },
7272 "engines": {
7273 "node": ">=8"
7274 }
7275 },
6555 "node_modules/strip-ansi": {
7276 "node_modules/strip-ansi": {
6556 "version": "6.0.1",
7277 "version": "6.0.1",
6557 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
7278 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
@@ -6564,6 +7285,19 @@
6564 "node": ">=8"
7285 "node": ">=8"
6565 }
7286 }
6566 },
7287 },
7288 "node_modules/strip-ansi-cjs": {
7289 "name": "strip-ansi",
7290 "version": "6.0.1",
7291 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
7292 "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
7293 "license": "MIT",
7294 "dependencies": {
7295 "ansi-regex": "^5.0.1"
7296 },
7297 "engines": {
7298 "node": ">=8"
7299 }
7300 },
6567 "node_modules/strip-bom": {
7301 "node_modules/strip-bom": {
6568 "version": "4.0.0",
7302 "version": "4.0.0",
6569 "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",
7303 "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz",
@@ -6643,6 +7377,18 @@
6643 "node": ">=10"
7377 "node": ">=10"
6644 }
7378 }
6645 },
7379 },
7380 "node_modules/tar-stream": {
7381 "version": "3.2.0",
7382 "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.2.0.tgz",
7383 "integrity": "sha512-ojzvCvVaNp6aOTFmG7jaRD0meowIAuPc3cMMhSgKiVWws1GyHbGd/xvnyuRKcKlMpt3qvxx6r0hreCNITP9hIg==",
7384 "license": "MIT",
7385 "dependencies": {
7386 "b4a": "^1.6.4",
7387 "bare-fs": "^4.5.5",
7388 "fast-fifo": "^1.2.0",
7389 "streamx": "^2.15.0"
7390 }
7391 },
6646 "node_modules/tar/node_modules/mkdirp": {
7392 "node_modules/tar/node_modules/mkdirp": {
6647 "version": "1.0.4",
7393 "version": "1.0.4",
6648 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
7394 "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
@@ -6661,6 +7407,15 @@
6661 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
7407 "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
6662 "license": "ISC"
7408 "license": "ISC"
6663 },
7409 },
7410 "node_modules/teex": {
7411 "version": "1.0.1",
7412 "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz",
7413 "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==",
7414 "license": "MIT",
7415 "dependencies": {
7416 "streamx": "^2.12.5"
7417 }
7418 },
6664 "node_modules/test-exclude": {
7419 "node_modules/test-exclude": {
6665 "version": "6.0.0",
7420 "version": "6.0.0",
6666 "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
7421 "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz",
@@ -6675,6 +7430,15 @@
6675 "node": ">=8"
7430 "node": ">=8"
6676 }
7431 }
6677 },
7432 },
7433 "node_modules/text-decoder": {
7434 "version": "1.2.7",
7435 "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.7.tgz",
7436 "integrity": "sha512-vlLytXkeP4xvEq2otHeJfSQIRyWxo/oZGEbXrtEEF9Hnmrdly59sUbzZ/QgyWuLYHctCHxFF4tRQZNQ9k60ExQ==",
7437 "license": "Apache-2.0",
7438 "dependencies": {
7439 "b4a": "^1.6.4"
7440 }
7441 },
6678 "node_modules/tldts": {
7442 "node_modules/tldts": {
6679 "version": "6.1.86",
7443 "version": "6.1.86",
6680 "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
7444 "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
@@ -7025,6 +7789,24 @@
7025 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
7789 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
7026 }
7790 }
7027 },
7791 },
7792 "node_modules/wrap-ansi-cjs": {
7793 "name": "wrap-ansi",
7794 "version": "7.0.0",
7795 "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
7796 "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
7797 "license": "MIT",
7798 "dependencies": {
7799 "ansi-styles": "^4.0.0",
7800 "string-width": "^4.1.0",
7801 "strip-ansi": "^6.0.0"
7802 },
7803 "engines": {
7804 "node": ">=10"
7805 },
7806 "funding": {
7807 "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
7808 }
7809 },
7028 "node_modules/wrappy": {
7810 "node_modules/wrappy": {
7029 "version": "1.0.2",
7811 "version": "1.0.2",
7030 "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
7812 "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
@@ -7155,6 +7937,45 @@
7155 "funding": {
7937 "funding": {
7156 "url": "https://github.com/sponsors/sindresorhus"
7938 "url": "https://github.com/sponsors/sindresorhus"
7157 }
7939 }
7940 },
7941 "node_modules/zip-stream": {
7942 "version": "6.0.1",
7943 "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.1.tgz",
7944 "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==",
7945 "license": "MIT",
7946 "dependencies": {
7947 "archiver-utils": "^5.0.0",
7948 "compress-commons": "^6.0.2",
7949 "readable-stream": "^4.0.0"
7950 },
7951 "engines": {
7952 "node": ">= 14"
7953 }
7954 },
7955 "node_modules/zip-stream/node_modules/readable-stream": {
7956 "version": "4.7.0",
7957 "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz",
7958 "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==",
7959 "license": "MIT",
7960 "dependencies": {
7961 "abort-controller": "^3.0.0",
7962 "buffer": "^6.0.3",
7963 "events": "^3.3.0",
7964 "process": "^0.11.10",
7965 "string_decoder": "^1.3.0"
7966 },
7967 "engines": {
7968 "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
7969 }
7970 },
7971 "node_modules/zip-stream/node_modules/string_decoder": {
7972 "version": "1.3.0",
7973 "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
7974 "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
7975 "license": "MIT",
7976 "dependencies": {
7977 "safe-buffer": "~5.2.0"
7978 }
7158 }
7979 }
7159 }
7980 }
7160}
7981}
package.json +1 −0
@@ -8,6 +8,7 @@
8 8 "test": "jest --runInBand"
9 9 },
10 10 "dependencies": {
11 "archiver": "^7.0.1",
11 12 "bcrypt": "^5.1.1",
12 13 "express": "^4.18.2",
13 14 "geoip-lite": "^1.4.10",
@@ -8,6 +8,7 @@
8 "test": "jest --runInBand"
8 "test": "jest --runInBand"
9 },
9 },
10 "dependencies": {
10 "dependencies": {
11 "archiver": "^7.0.1",
11 "bcrypt": "^5.1.1",
12 "bcrypt": "^5.1.1",
12 "express": "^4.18.2",
13 "express": "^4.18.2",
13 "geoip-lite": "^1.4.10",
14 "geoip-lite": "^1.4.10",
public/app.js +93 −0
@@ -590,6 +590,74 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')
590 590 });
591 591 }
592 592
593 // ───────────────────────────────────────────────────────────────────────────
594 // SHARE MODAL
595 // ───────────────────────────────────────────────────────────────────────────
596
597 async function openShareModal (item)
598 {
599 const overlay = document.getElementById('share-modal');
600 const urlInput = document.getElementById('share-url-input');
601 const copyBtn = document.getElementById('share-copy-btn');
602 const okBtn = document.getElementById('share-modal-ok');
603 const closeBtn = document.getElementById('share-modal-close');
604 const msgEl = document.getElementById('share-modal-msg');
605
606 urlInput.value = 'Link aanmaken…';
607 copyBtn.disabled = true;
608 msgEl.textContent = 'De link is 24 uur geldig.';
609 overlay.classList.remove('hidden');
610
611 let data;
612 try
613 {
614 data = await api('POST', '/share/create', { filePath: item.path });
615 } catch (err)
616 {
617 msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');
618 urlInput.value = '';
619 return;
620 }
621
622 if (!data || !data.token)
623 {
624 msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';
625 urlInput.value = '';
626 return;
627 }
628
629 const shareUrl = `${location.origin}/share/${data.token}`;
630 urlInput.value = shareUrl;
631 copyBtn.disabled = false;
632
633 function close ()
634 {
635 overlay.classList.add('hidden');
636 okBtn.removeEventListener('click', close);
637 closeBtn.removeEventListener('click', close);
638 copyBtn.removeEventListener('click', onCopy);
639 }
640
641 function onCopy ()
642 {
643 navigator.clipboard.writeText(shareUrl).then(() =>
644 {
645 const orig = copyBtn.textContent;
646 copyBtn.textContent = 'Gekopieerd!';
647 setTimeout(() => { copyBtn.textContent = orig; }, 1500);
648 }).catch(() =>
649 {
650 // Fallback: select the text
651 urlInput.select();
652 });
653 }
654
655 okBtn.addEventListener('click', close);
656 closeBtn.addEventListener('click', close);
657 copyBtn.addEventListener('click', onCopy);
658 okBtn.focus();
659 }
660
593 661 // ───────────────────────────────────────────────────────────────────────────
594 662 // AUTH FLOW
595 663 // ───────────────────────────────────────────────────────────────────────────
@@ -1204,6 +1272,12 @@ async function openSidebar (item)
1204 1272 downloadOrView(item, source);
1205 1273 });
1206 1274 actions.appendChild(btnDl);
1275
1276 // Share button (file)
1277 const btnShareFile = document.createElement('button');
1278 btnShareFile.textContent = 'Delen';
1279 btnShareFile.addEventListener('click', () => openShareModal(item));
1280 actions.appendChild(btnShareFile);
1207 1281 } else
1208 1282 {
1209 1283 dl.innerHTML = `<dt>Type</dt><dd>${item._root ? 'Root folder' : 'Folder'}</dd>`;
@@ -1240,6 +1314,25 @@ async function openSidebar (item)
1240 1314 btnOpen.addEventListener('click', () => navigateTo(item.path, item._root || STATE.currentRoot));
1241 1315 actions.appendChild(btnOpen);
1242 1316
1317 // Download as zip button (folder)
1318 const btnZip = document.createElement('button');
1319 btnZip.textContent = 'Download als zip';
1320 btnZip.addEventListener('click', () =>
1321 {
1322 const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1323 const a = document.createElement('a');
1324 a.href = url;
1325 a.download = item.name + '.zip';
1326 a.click();
1327 });
1328 actions.appendChild(btnZip);
1329
1330 // Share button (folder)
1331 const btnShareFolder = document.createElement('button');
1332 btnShareFolder.textContent = 'Delen';
1333 btnShareFolder.addEventListener('click', () => openShareModal(item));
1334 actions.appendChild(btnShareFolder);
1335
1243 1336 // Load folder icon thumbnail into the sidebar icon element.
1244 1337 void loadOneFolderIcon(document.getElementById('sidebar-icon'));
1245 1338 }
@@ -590,6 +590,74 @@ function showFileConflictChoice (filename, renameTo, mode = 'upload')
590 });
590 });
591}
591}
592
592
593// ───────────────────────────────────────────────────────────────────────────
594// SHARE MODAL
595// ───────────────────────────────────────────────────────────────────────────
596
597async function openShareModal (item)
598{
599 const overlay = document.getElementById('share-modal');
600 const urlInput = document.getElementById('share-url-input');
601 const copyBtn = document.getElementById('share-copy-btn');
602 const okBtn = document.getElementById('share-modal-ok');
603 const closeBtn = document.getElementById('share-modal-close');
604 const msgEl = document.getElementById('share-modal-msg');
605
606 urlInput.value = 'Link aanmaken…';
607 copyBtn.disabled = true;
608 msgEl.textContent = 'De link is 24 uur geldig.';
609 overlay.classList.remove('hidden');
610
611 let data;
612 try
613 {
614 data = await api('POST', '/share/create', { filePath: item.path });
615 } catch (err)
616 {
617 msgEl.textContent = 'Fout: ' + (err.message || 'Kon geen link aanmaken.');
618 urlInput.value = '';
619 return;
620 }
621
622 if (!data || !data.token)
623 {
624 msgEl.textContent = 'Onbekende fout bij aanmaken van de link.';
625 urlInput.value = '';
626 return;
627 }
628
629 const shareUrl = `${location.origin}/share/${data.token}`;
630 urlInput.value = shareUrl;
631 copyBtn.disabled = false;
632
633 function close ()
634 {
635 overlay.classList.add('hidden');
636 okBtn.removeEventListener('click', close);
637 closeBtn.removeEventListener('click', close);
638 copyBtn.removeEventListener('click', onCopy);
639 }
640
641 function onCopy ()
642 {
643 navigator.clipboard.writeText(shareUrl).then(() =>
644 {
645 const orig = copyBtn.textContent;
646 copyBtn.textContent = 'Gekopieerd!';
647 setTimeout(() => { copyBtn.textContent = orig; }, 1500);
648 }).catch(() =>
649 {
650 // Fallback: select the text
651 urlInput.select();
652 });
653 }
654
655 okBtn.addEventListener('click', close);
656 closeBtn.addEventListener('click', close);
657 copyBtn.addEventListener('click', onCopy);
658 okBtn.focus();
659}
660
593// ───────────────────────────────────────────────────────────────────────────
661// ───────────────────────────────────────────────────────────────────────────
594// AUTH FLOW
662// AUTH FLOW
595// ───────────────────────────────────────────────────────────────────────────
663// ───────────────────────────────────────────────────────────────────────────
@@ -1204,6 +1272,12 @@ async function openSidebar (item)
1204 downloadOrView(item, source);
1272 downloadOrView(item, source);
1205 });
1273 });
1206 actions.appendChild(btnDl);
1274 actions.appendChild(btnDl);
1275
1276 // Share button (file)
1277 const btnShareFile = document.createElement('button');
1278 btnShareFile.textContent = 'Delen';
1279 btnShareFile.addEventListener('click', () => openShareModal(item));
1280 actions.appendChild(btnShareFile);
1207 } else
1281 } else
1208 {
1282 {
1209 dl.innerHTML = `<dt>Type</dt><dd>${item._root ? 'Root folder' : 'Folder'}</dd>`;
1283 dl.innerHTML = `<dt>Type</dt><dd>${item._root ? 'Root folder' : 'Folder'}</dd>`;
@@ -1240,6 +1314,25 @@ async function openSidebar (item)
1240 btnOpen.addEventListener('click', () => navigateTo(item.path, item._root || STATE.currentRoot));
1314 btnOpen.addEventListener('click', () => navigateTo(item.path, item._root || STATE.currentRoot));
1241 actions.appendChild(btnOpen);
1315 actions.appendChild(btnOpen);
1242
1316
1317 // Download as zip button (folder)
1318 const btnZip = document.createElement('button');
1319 btnZip.textContent = 'Download als zip';
1320 btnZip.addEventListener('click', () =>
1321 {
1322 const url = `/api/files/download-zip?dir=${encodeURIComponent(item.path)}`;
1323 const a = document.createElement('a');
1324 a.href = url;
1325 a.download = item.name + '.zip';
1326 a.click();
1327 });
1328 actions.appendChild(btnZip);
1329
1330 // Share button (folder)
1331 const btnShareFolder = document.createElement('button');
1332 btnShareFolder.textContent = 'Delen';
1333 btnShareFolder.addEventListener('click', () => openShareModal(item));
1334 actions.appendChild(btnShareFolder);
1335
1243 // Load folder icon thumbnail into the sidebar icon element.
1336 // Load folder icon thumbnail into the sidebar icon element.
1244 void loadOneFolderIcon(document.getElementById('sidebar-icon'));
1337 void loadOneFolderIcon(document.getElementById('sidebar-icon'));
1245 }
1338 }
public/index.html +18 −0
@@ -272,6 +272,24 @@
272 272 <!-- TOAST -->
273 273 <div id="toast" aria-live="assertive" aria-atomic="true"></div>
274 274
275 <!-- SHARE MODAL -->
276 <div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
277 aria-labelledby="share-modal-title">
278 <div class="modal small">
279 <button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>
280 <h2 id="share-modal-title">Delen</h2>
281 <p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>
282 <div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
283 <input id="share-url-input" type="text" readonly
284 style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
285 <button id="share-copy-btn" title="Kopieer link">Kopieer</button>
286 </div>
287 <div class="dialog-actions">
288 <button class="primary" id="share-modal-ok">OK</button>
289 </div>
290 </div>
291 </div>
292
275 293 <link rel="stylesheet" href="drag-move.css" />
276 294 <script src="drag-move.js"></script>
277 295 <script src="app.js"></script>
@@ -272,6 +272,24 @@
272 <!-- TOAST -->
272 <!-- TOAST -->
273 <div id="toast" aria-live="assertive" aria-atomic="true"></div>
273 <div id="toast" aria-live="assertive" aria-atomic="true"></div>
274
274
275 <!-- SHARE MODAL -->
276 <div id="share-modal" class="modal-overlay hidden" role="dialog" aria-modal="true"
277 aria-labelledby="share-modal-title">
278 <div class="modal small">
279 <button class="modal-close" id="share-modal-close" aria-label="Sluiten">✕</button>
280 <h2 id="share-modal-title">Delen</h2>
281 <p class="dialog-message" id="share-modal-msg">De link is 24 uur geldig.</p>
282 <div id="share-url-row" style="display:flex;gap:0.5rem;margin:0.8rem 0">
283 <input id="share-url-input" type="text" readonly
284 style="flex:1;font-size:0.82rem;background:var(--surface2);border:1px solid var(--border);border-radius:6px;padding:0.45rem 0.65rem;color:var(--text);min-width:0" />
285 <button id="share-copy-btn" title="Kopieer link">Kopieer</button>
286 </div>
287 <div class="dialog-actions">
288 <button class="primary" id="share-modal-ok">OK</button>
289 </div>
290 </div>
291 </div>
292
275 <link rel="stylesheet" href="drag-move.css" />
293 <link rel="stylesheet" href="drag-move.css" />
276 <script src="drag-move.js"></script>
294 <script src="drag-move.js"></script>
277 <script src="app.js"></script>
295 <script src="app.js"></script>
public/share.html added +353 −0
@@ -0,0 +1,353 @@
1 <!DOCTYPE html>
2 <html lang="nl">
3 <head>
4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <title>Gedeeld bestand</title>
7 <style>
8 *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
9
10 :root {
11 --bg: #0f1117;
12 --surface: #1a1d27;
13 --surface2: #21242f;
14 --border: #2e3247;
15 --accent: #5b7fff;
16 --accent-hover: #7b9fff;
17 --text: #e8eaf0;
18 --text-muted: #7880a0;
19 --danger: #e05c6e;
20 --success: #3fcf8e;
21 --radius: 10px;
22 }
23
24 html, body { height: 100%; font-family: system-ui, -apple-system, sans-serif; }
25 body { background: var(--bg); color: var(--text); min-height: 100vh; }
26
27 /* ── Timer bar ── */
28 #timer-bar {
29 position: sticky;
30 top: 0;
31 z-index: 10;
32 background: var(--surface);
33 border-bottom: 1px solid var(--border);
34 display: flex;
35 align-items: center;
36 justify-content: center;
37 gap: 0.6rem;
38 padding: 0.55rem 1rem;
39 font-size: 0.9rem;
40 color: var(--text-muted);
41 }
42 #timer-bar .timer-clock {
43 font-variant-numeric: tabular-nums;
44 font-weight: 600;
45 color: var(--text);
46 letter-spacing: 0.05em;
47 }
48 #timer-bar.expired { color: var(--danger); }
49 #timer-bar.expired .timer-clock { color: var(--danger); }
50
51 /* ── Main card ── */
52 #main {
53 max-width: 760px;
54 margin: 3rem auto;
55 padding: 0 1rem;
56 }
57
58 .card {
59 background: var(--surface);
60 border: 1px solid var(--border);
61 border-radius: var(--radius);
62 padding: 2rem;
63 margin-bottom: 1.5rem;
64 }
65
66 .card h1 {
67 font-size: 1.3rem;
68 font-weight: 600;
69 margin-bottom: 0.3rem;
70 word-break: break-all;
71 }
72 .card .meta {
73 font-size: 0.85rem;
74 color: var(--text-muted);
75 margin-bottom: 1.4rem;
76 }
77
78 /* ── Download button ── */
79 .btn {
80 display: inline-flex;
81 align-items: center;
82 gap: 0.5rem;
83 padding: 0.6rem 1.2rem;
84 border-radius: 7px;
85 font-size: 0.92rem;
86 font-weight: 500;
87 cursor: pointer;
88 border: none;
89 transition: background 0.15s;
90 }
91 .btn-primary {
92 background: var(--accent);
93 color: #fff;
94 }
95 .btn-primary:hover { background: var(--accent-hover); }
96 .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
97
98 /* ── Preview area ── */
99 #preview-wrap {
100 background: var(--surface2);
101 border: 1px solid var(--border);
102 border-radius: var(--radius);
103 overflow: hidden;
104 margin-bottom: 1.5rem;
105 min-height: 80px;
106 display: flex;
107 align-items: center;
108 justify-content: center;
109 }
110
111 #preview-wrap img,
112 #preview-wrap video,
113 #preview-wrap audio {
114 max-width: 100%;
115 max-height: 60vh;
116 display: block;
117 }
118 #preview-wrap audio { padding: 1rem; width: 100%; }
119
120 #preview-wrap pre {
121 padding: 1.2rem;
122 overflow: auto;
123 max-height: 60vh;
124 width: 100%;
125 font-size: 0.82rem;
126 font-family: monospace;
127 color: var(--text);
128 white-space: pre-wrap;
129 word-break: break-word;
130 }
131
132 #preview-wrap .no-preview {
133 padding: 2rem;
134 color: var(--text-muted);
135 font-size: 0.9rem;
136 text-align: center;
137 }
138
139 /* ── Error / expired states ── */
140 #error-state {
141 text-align: center;
142 padding: 4rem 1rem;
143 }
144 #error-state h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
145 #error-state p { color: var(--text-muted); }
146
147 /* ── Loading spinner ── */
148 #loading {
149 text-align: center;
150 padding: 6rem 1rem;
151 color: var(--text-muted);
152 }
153 </style>
154 </head>
155 <body>
156
157 <div id="timer-bar" style="display:none">
158 <span>Geldig nog</span>
159 <span id="timer-clock" class="timer-clock">--:--:--</span>
160 </div>
161
162 <div id="main">
163 <div id="loading">Laden…</div>
164 <div id="error-state" style="display:none">
165 <h2 id="error-title">Niet gevonden</h2>
166 <p id="error-msg">De link bestaat niet of is verlopen.</p>
167 </div>
168
169 <div id="content" style="display:none">
170 <div class="card">
171 <h1 id="file-name"></h1>
172 <p id="file-meta" class="meta"></p>
173 <a id="btn-download" class="btn btn-primary" href="#" download>
174 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
175 stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
176 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
177 <polyline points="7 10 12 15 17 10" />
178 <line x1="12" y1="15" x2="12" y2="3" />
179 </svg>
180 <span id="btn-download-label">Downloaden</span>
181 </a>
182 </div>
183
184 <div id="preview-wrap" style="display:none"></div>
185 </div>
186 </div>
187
188 <script>
189 (function () {
190 'use strict';
191
192 const token = location.pathname.split('/').pop();
193 let expiresAt = null;
194 let timerInterval = null;
195
196 // ── Timer ───────────────────────────────────────────────────────────────
197 function startTimer ()
198 {
199 const bar = document.getElementById('timer-bar');
200 const clock = document.getElementById('timer-clock');
201 bar.style.display = '';
202
203 function tick ()
204 {
205 const remaining = expiresAt - Date.now();
206 if (remaining <= 0)
207 {
208 clock.textContent = '00:00:00';
209 bar.classList.add('expired');
210 bar.querySelector('span').textContent = 'Verlopen —';
211 const dlBtn = document.getElementById('btn-download');
212 if (dlBtn) dlBtn.setAttribute('disabled', 'disabled');
213 clearInterval(timerInterval);
214 return;
215 }
216 const totalSecs = Math.floor(remaining / 1000);
217 const hh = String(Math.floor(totalSecs / 3600)).padStart(2, '0');
218 const mm = String(Math.floor((totalSecs % 3600) / 60)).padStart(2, '0');
219 const ss = String(totalSecs % 60).padStart(2, '0');
220 clock.textContent = `${hh}:${mm}:${ss}`;
221 }
222
223 tick();
224 timerInterval = setInterval(tick, 1000);
225 }
226
227 // ── Preview ──────────────────────────────────────────────────────────────
228 function tryPreview (name, isDir)
229 {
230 if (isDir) return; // no preview for folders
231
232 const wrap = document.getElementById('preview-wrap');
233 const ext = name.split('.').pop().toLowerCase();
234
235 const imageExts = ['jpg','jpeg','png','gif','webp','svg','bmp','avif','ico'];
236 const videoExts = ['mp4','webm','ogg','mov'];
237 const audioExts = ['mp3','wav','ogg','flac','aac','opus','m4a'];
238 const textExts = ['txt','md','json','js','ts','html','css','xml','csv','yaml','yml','sh','log','ini','toml','py','rb','go','java','c','cpp','h','rs'];
239
240 const previewUrl = `/api/share/preview/${token}`;
241 let el;
242
243 if (imageExts.includes(ext))
244 {
245 el = document.createElement('img');
246 el.src = previewUrl;
247 el.alt = name;
248 } else if (videoExts.includes(ext))
249 {
250 el = document.createElement('video');
251 el.src = previewUrl;
252 el.controls = true;
253 } else if (audioExts.includes(ext))
254 {
255 el = document.createElement('audio');
256 el.src = previewUrl;
257 el.controls = true;
258 } else if (textExts.includes(ext))
259 {
260 fetch(previewUrl)
261 .then(r =>
262 {
263 if (!r.ok) throw new Error('preview failed');
264 return r.text();
265 })
266 .then(text =>
267 {
268 const pre = document.createElement('pre');
269 pre.textContent = text;
270 wrap.innerHTML = '';
271 wrap.appendChild(pre);
272 wrap.style.display = '';
273 })
274 .catch(() => { /* no preview available */ });
275 return;
276 } else
277 {
278 return; // no preview
279 }
280
281 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">Geen voorbeeldweergave beschikbaar.</div>'; wrap.style.display = ''; });
282 wrap.innerHTML = '';
283 wrap.appendChild(el);
284 wrap.style.display = '';
285 }
286
287 // ── Boot ─────────────────────────────────────────────────────────────────
288 function showError (title, msg)
289 {
290 document.getElementById('loading').style.display = 'none';
291 document.getElementById('content').style.display = 'none';
292 document.getElementById('error-title').textContent = title;
293 document.getElementById('error-msg').textContent = msg;
294 document.getElementById('error-state').style.display = '';
295 }
296
297 function formatBytes (bytes)
298 {
299 if (bytes == null) return '';
300 if (bytes < 1024) return bytes + ' B';
301 if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
302 if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
303 return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
304 }
305
306 fetch(`/api/share/info/${token}`)
307 .then(r => r.json().then(d => ({ ok: r.ok, status: r.status, data: d })))
308 .then(({ ok, status, data }) =>
309 {
310 document.getElementById('loading').style.display = 'none';
311
312 if (status === 410)
313 {
314 showError('Link verlopen', 'Deze deellink is niet meer geldig.');
315 return;
316 }
317 if (!ok)
318 {
319 showError('Niet gevonden', data.error || 'De link bestaat niet.');
320 return;
321 }
322
323 expiresAt = data.expiresAt;
324 startTimer();
325
326 document.getElementById('file-name').textContent = data.name;
327 const metaLine = data.isDir ? 'Map (download als .zip)' : 'Bestand';
328 document.getElementById('file-meta').textContent = metaLine;
329
330 const dlBtn = document.getElementById('btn-download');
331 dlBtn.href = `/api/share/download/${token}`;
332 if (data.isDir)
333 {
334 document.getElementById('btn-download-label').textContent = 'Downloaden als .zip';
335 dlBtn.download = data.name + '.zip';
336 } else
337 {
338 document.getElementById('btn-download-label').textContent = 'Downloaden';
339 dlBtn.download = data.name;
340 }
341
342 document.getElementById('content').style.display = '';
343
344 tryPreview(data.name, data.isDir);
345 })
346 .catch(() =>
347 {
348 showError('Fout', 'Kon de server niet bereiken.');
349 });
350 }());
351 </script>
352 </body>
353 </html>
@@ -0,0 +1,353 @@
1<!DOCTYPE html>
2<html lang="nl">
3<head>
4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 <title>Gedeeld bestand</title>
7 <style>
8 *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
9
10 :root {
11 --bg: #0f1117;
12 --surface: #1a1d27;
13 --surface2: #21242f;
14 --border: #2e3247;
15 --accent: #5b7fff;
16 --accent-hover: #7b9fff;
17 --text: #e8eaf0;
18 --text-muted: #7880a0;
19 --danger: #e05c6e;
20 --success: #3fcf8e;
21 --radius: 10px;
22 }
23
24 html, body { height: 100%; font-family: system-ui, -apple-system, sans-serif; }
25 body { background: var(--bg); color: var(--text); min-height: 100vh; }
26
27 /* ── Timer bar ── */
28 #timer-bar {
29 position: sticky;
30 top: 0;
31 z-index: 10;
32 background: var(--surface);
33 border-bottom: 1px solid var(--border);
34 display: flex;
35 align-items: center;
36 justify-content: center;
37 gap: 0.6rem;
38 padding: 0.55rem 1rem;
39 font-size: 0.9rem;
40 color: var(--text-muted);
41 }
42 #timer-bar .timer-clock {
43 font-variant-numeric: tabular-nums;
44 font-weight: 600;
45 color: var(--text);
46 letter-spacing: 0.05em;
47 }
48 #timer-bar.expired { color: var(--danger); }
49 #timer-bar.expired .timer-clock { color: var(--danger); }
50
51 /* ── Main card ── */
52 #main {
53 max-width: 760px;
54 margin: 3rem auto;
55 padding: 0 1rem;
56 }
57
58 .card {
59 background: var(--surface);
60 border: 1px solid var(--border);
61 border-radius: var(--radius);
62 padding: 2rem;
63 margin-bottom: 1.5rem;
64 }
65
66 .card h1 {
67 font-size: 1.3rem;
68 font-weight: 600;
69 margin-bottom: 0.3rem;
70 word-break: break-all;
71 }
72 .card .meta {
73 font-size: 0.85rem;
74 color: var(--text-muted);
75 margin-bottom: 1.4rem;
76 }
77
78 /* ── Download button ── */
79 .btn {
80 display: inline-flex;
81 align-items: center;
82 gap: 0.5rem;
83 padding: 0.6rem 1.2rem;
84 border-radius: 7px;
85 font-size: 0.92rem;
86 font-weight: 500;
87 cursor: pointer;
88 border: none;
89 transition: background 0.15s;
90 }
91 .btn-primary {
92 background: var(--accent);
93 color: #fff;
94 }
95 .btn-primary:hover { background: var(--accent-hover); }
96 .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
97
98 /* ── Preview area ── */
99 #preview-wrap {
100 background: var(--surface2);
101 border: 1px solid var(--border);
102 border-radius: var(--radius);
103 overflow: hidden;
104 margin-bottom: 1.5rem;
105 min-height: 80px;
106 display: flex;
107 align-items: center;
108 justify-content: center;
109 }
110
111 #preview-wrap img,
112 #preview-wrap video,
113 #preview-wrap audio {
114 max-width: 100%;
115 max-height: 60vh;
116 display: block;
117 }
118 #preview-wrap audio { padding: 1rem; width: 100%; }
119
120 #preview-wrap pre {
121 padding: 1.2rem;
122 overflow: auto;
123 max-height: 60vh;
124 width: 100%;
125 font-size: 0.82rem;
126 font-family: monospace;
127 color: var(--text);
128 white-space: pre-wrap;
129 word-break: break-word;
130 }
131
132 #preview-wrap .no-preview {
133 padding: 2rem;
134 color: var(--text-muted);
135 font-size: 0.9rem;
136 text-align: center;
137 }
138
139 /* ── Error / expired states ── */
140 #error-state {
141 text-align: center;
142 padding: 4rem 1rem;
143 }
144 #error-state h2 { font-size: 1.4rem; margin-bottom: 0.5rem; }
145 #error-state p { color: var(--text-muted); }
146
147 /* ── Loading spinner ── */
148 #loading {
149 text-align: center;
150 padding: 6rem 1rem;
151 color: var(--text-muted);
152 }
153 </style>
154</head>
155<body>
156
157<div id="timer-bar" style="display:none">
158 <span>Geldig nog</span>
159 <span id="timer-clock" class="timer-clock">--:--:--</span>
160</div>
161
162<div id="main">
163 <div id="loading">Laden…</div>
164 <div id="error-state" style="display:none">
165 <h2 id="error-title">Niet gevonden</h2>
166 <p id="error-msg">De link bestaat niet of is verlopen.</p>
167 </div>
168
169 <div id="content" style="display:none">
170 <div class="card">
171 <h1 id="file-name"></h1>
172 <p id="file-meta" class="meta"></p>
173 <a id="btn-download" class="btn btn-primary" href="#" download>
174 <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"
175 stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
176 <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
177 <polyline points="7 10 12 15 17 10" />
178 <line x1="12" y1="15" x2="12" y2="3" />
179 </svg>
180 <span id="btn-download-label">Downloaden</span>
181 </a>
182 </div>
183
184 <div id="preview-wrap" style="display:none"></div>
185 </div>
186</div>
187
188<script>
189(function () {
190 'use strict';
191
192 const token = location.pathname.split('/').pop();
193 let expiresAt = null;
194 let timerInterval = null;
195
196 // ── Timer ───────────────────────────────────────────────────────────────
197 function startTimer ()
198 {
199 const bar = document.getElementById('timer-bar');
200 const clock = document.getElementById('timer-clock');
201 bar.style.display = '';
202
203 function tick ()
204 {
205 const remaining = expiresAt - Date.now();
206 if (remaining <= 0)
207 {
208 clock.textContent = '00:00:00';
209 bar.classList.add('expired');
210 bar.querySelector('span').textContent = 'Verlopen —';
211 const dlBtn = document.getElementById('btn-download');
212 if (dlBtn) dlBtn.setAttribute('disabled', 'disabled');
213 clearInterval(timerInterval);
214 return;
215 }
216 const totalSecs = Math.floor(remaining / 1000);
217 const hh = String(Math.floor(totalSecs / 3600)).padStart(2, '0');
218 const mm = String(Math.floor((totalSecs % 3600) / 60)).padStart(2, '0');
219 const ss = String(totalSecs % 60).padStart(2, '0');
220 clock.textContent = `${hh}:${mm}:${ss}`;
221 }
222
223 tick();
224 timerInterval = setInterval(tick, 1000);
225 }
226
227 // ── Preview ──────────────────────────────────────────────────────────────
228 function tryPreview (name, isDir)
229 {
230 if (isDir) return; // no preview for folders
231
232 const wrap = document.getElementById('preview-wrap');
233 const ext = name.split('.').pop().toLowerCase();
234
235 const imageExts = ['jpg','jpeg','png','gif','webp','svg','bmp','avif','ico'];
236 const videoExts = ['mp4','webm','ogg','mov'];
237 const audioExts = ['mp3','wav','ogg','flac','aac','opus','m4a'];
238 const textExts = ['txt','md','json','js','ts','html','css','xml','csv','yaml','yml','sh','log','ini','toml','py','rb','go','java','c','cpp','h','rs'];
239
240 const previewUrl = `/api/share/preview/${token}`;
241 let el;
242
243 if (imageExts.includes(ext))
244 {
245 el = document.createElement('img');
246 el.src = previewUrl;
247 el.alt = name;
248 } else if (videoExts.includes(ext))
249 {
250 el = document.createElement('video');
251 el.src = previewUrl;
252 el.controls = true;
253 } else if (audioExts.includes(ext))
254 {
255 el = document.createElement('audio');
256 el.src = previewUrl;
257 el.controls = true;
258 } else if (textExts.includes(ext))
259 {
260 fetch(previewUrl)
261 .then(r =>
262 {
263 if (!r.ok) throw new Error('preview failed');
264 return r.text();
265 })
266 .then(text =>
267 {
268 const pre = document.createElement('pre');
269 pre.textContent = text;
270 wrap.innerHTML = '';
271 wrap.appendChild(pre);
272 wrap.style.display = '';
273 })
274 .catch(() => { /* no preview available */ });
275 return;
276 } else
277 {
278 return; // no preview
279 }
280
281 el.addEventListener('error', () => { wrap.innerHTML = '<div class="no-preview">Geen voorbeeldweergave beschikbaar.</div>'; wrap.style.display = ''; });
282 wrap.innerHTML = '';
283 wrap.appendChild(el);
284 wrap.style.display = '';
285 }
286
287 // ── Boot ─────────────────────────────────────────────────────────────────
288 function showError (title, msg)
289 {
290 document.getElementById('loading').style.display = 'none';
291 document.getElementById('content').style.display = 'none';
292 document.getElementById('error-title').textContent = title;
293 document.getElementById('error-msg').textContent = msg;
294 document.getElementById('error-state').style.display = '';
295 }
296
297 function formatBytes (bytes)
298 {
299 if (bytes == null) return '';
300 if (bytes < 1024) return bytes + ' B';
301 if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
302 if (bytes < 1024 * 1024 * 1024) return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
303 return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB';
304 }
305
306 fetch(`/api/share/info/${token}`)
307 .then(r => r.json().then(d => ({ ok: r.ok, status: r.status, data: d })))
308 .then(({ ok, status, data }) =>
309 {
310 document.getElementById('loading').style.display = 'none';
311
312 if (status === 410)
313 {
314 showError('Link verlopen', 'Deze deellink is niet meer geldig.');
315 return;
316 }
317 if (!ok)
318 {
319 showError('Niet gevonden', data.error || 'De link bestaat niet.');
320 return;
321 }
322
323 expiresAt = data.expiresAt;
324 startTimer();
325
326 document.getElementById('file-name').textContent = data.name;
327 const metaLine = data.isDir ? 'Map (download als .zip)' : 'Bestand';
328 document.getElementById('file-meta').textContent = metaLine;
329
330 const dlBtn = document.getElementById('btn-download');
331 dlBtn.href = `/api/share/download/${token}`;
332 if (data.isDir)
333 {
334 document.getElementById('btn-download-label').textContent = 'Downloaden als .zip';
335 dlBtn.download = data.name + '.zip';
336 } else
337 {
338 document.getElementById('btn-download-label').textContent = 'Downloaden';
339 dlBtn.download = data.name;
340 }
341
342 document.getElementById('content').style.display = '';
343
344 tryPreview(data.name, data.isDir);
345 })
346 .catch(() =>
347 {
348 showError('Fout', 'Kon de server niet bereiken.');
349 });
350}());
351</script>
352</body>
353</html>
server/db.js +11 −0
@@ -49,6 +49,17 @@ function initDb ()
49 49
50 50 CREATE INDEX IF NOT EXISTS idx_auth_sessions_username ON auth_sessions(username);
51 51 CREATE INDEX IF NOT EXISTS idx_auth_sessions_last_seen ON auth_sessions(last_seen_at);
52
53 CREATE TABLE IF NOT EXISTS share_tokens (
54 token TEXT PRIMARY KEY,
55 file_path TEXT NOT NULL,
56 is_dir INTEGER NOT NULL DEFAULT 0,
57 created_by TEXT NOT NULL,
58 created_at INTEGER NOT NULL,
59 expires_at INTEGER NOT NULL
60 );
61
62 CREATE INDEX IF NOT EXISTS idx_share_tokens_expires ON share_tokens(expires_at);
52 63 `);
53 64 }
54 65
@@ -49,6 +49,17 @@ function initDb ()
49
49
50 CREATE INDEX IF NOT EXISTS idx_auth_sessions_username ON auth_sessions(username);
50 CREATE INDEX IF NOT EXISTS idx_auth_sessions_username ON auth_sessions(username);
51 CREATE INDEX IF NOT EXISTS idx_auth_sessions_last_seen ON auth_sessions(last_seen_at);
51 CREATE INDEX IF NOT EXISTS idx_auth_sessions_last_seen ON auth_sessions(last_seen_at);
52
53 CREATE TABLE IF NOT EXISTS share_tokens (
54 token TEXT PRIMARY KEY,
55 file_path TEXT NOT NULL,
56 is_dir INTEGER NOT NULL DEFAULT 0,
57 created_by TEXT NOT NULL,
58 created_at INTEGER NOT NULL,
59 expires_at INTEGER NOT NULL
60 );
61
62 CREATE INDEX IF NOT EXISTS idx_share_tokens_expires ON share_tokens(expires_at);
52 `);
63 `);
53}
64}
54
65
server/index.js +8 −0
@@ -12,6 +12,7 @@ const { startThumbnailCacheLoop, stopThumbnailCacheLoop } = require('./thumbnail
12 12 const authRoutes = require('./routes/auth');
13 13 const filesRoutes = require('./routes/files');
14 14 const adminRoutes = require('./routes/admin');
15 const shareRoutes = require('./routes/share');
15 16
16 17 const app = express();
17 18
@@ -21,6 +22,13 @@ app.use(express.static(path.join(__dirname, '../public')));
21 22 app.use('/api/auth', authRoutes);
22 23 app.use('/api/files', filesRoutes);
23 24 app.use('/api/admin', adminRoutes);
25 app.use('/api/share', shareRoutes);
26
27 // Share page — served without authentication.
28 app.get('/share/:token', (req, res) =>
29 {
30 res.sendFile(path.join(__dirname, '../public/share.html'));
31 });
24 32
25 33 // SPA catch-all (only for non-API routes)
26 34 app.get('*', (req, res) =>
@@ -12,6 +12,7 @@ const { startThumbnailCacheLoop, stopThumbnailCacheLoop } = require('./thumbnail
12const authRoutes = require('./routes/auth');
12const authRoutes = require('./routes/auth');
13const filesRoutes = require('./routes/files');
13const filesRoutes = require('./routes/files');
14const adminRoutes = require('./routes/admin');
14const adminRoutes = require('./routes/admin');
15const shareRoutes = require('./routes/share');
15
16
16const app = express();
17const app = express();
17
18
@@ -21,6 +22,13 @@ app.use(express.static(path.join(__dirname, '../public')));
21app.use('/api/auth', authRoutes);
22app.use('/api/auth', authRoutes);
22app.use('/api/files', filesRoutes);
23app.use('/api/files', filesRoutes);
23app.use('/api/admin', adminRoutes);
24app.use('/api/admin', adminRoutes);
25app.use('/api/share', shareRoutes);
26
27// Share page — served without authentication.
28app.get('/share/:token', (req, res) =>
29{
30 res.sendFile(path.join(__dirname, '../public/share.html'));
31});
24
32
25// SPA catch-all (only for non-API routes)
33// SPA catch-all (only for non-API routes)
26app.get('*', (req, res) =>
34app.get('*', (req, res) =>
server/routes/files.js +35 −0
@@ -11,6 +11,7 @@ const { getDb } = require('../db');
11 11 const { loadConfig, saveConfig, getEffectivePaths, getAllowedRoot } = require('../config');
12 12 const { requireAuth } = require('../auth');
13 13 const { getCachedThumbnailInfo, getImagesWithThumbnailsInDir, getFolderIconSourceFile, setFolderIconAssignment } = require('../thumbnail-cache');
14 const { buildZip } = require('./share');
14 15
15 16 // ---------------------------------------------------------------------------
16 17 // Multer storage — files are staged into temporary files and only promoted
@@ -622,6 +623,40 @@ router.get('/download', requireAuth, (req, res) =>
622 623 res.download(file, path.basename(file));
623 624 });
624 625
626 // ---------------------------------------------------------------------------
627 // GET /api/files/download-zip?dir=<absolute-path>
628 // Authenticated. Streams a zip of the given directory.
629 // ---------------------------------------------------------------------------
630 router.get('/download-zip', requireAuth, async (req, res) =>
631 {
632 const dir = req.query.dir;
633 if (!dir) return res.status(400).json({ error: 'dir is required.' });
634
635 const roots = effectivePaths();
636 const info = resolveRoot(dir, roots);
637 if (!info || !canRead(req.user, info.label))
638 {
639 return res.status(403).json({ error: 'Access denied.' });
640 }
641
642 if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory())
643 {
644 return res.status(404).json({ error: 'Directory not found.' });
645 }
646
647 // Use a hash of the dir path as cache key so concurrent users share the cache.
648 const cacheKey = crypto.createHash('sha256').update(dir).digest('hex');
649 try
650 {
651 const zipPath = await buildZip(dir, cacheKey);
652 const zipName = `${path.basename(dir)}.zip`;
653 res.download(zipPath, zipName);
654 } catch (err)
655 {
656 res.status(500).json({ error: 'Failed to create zip archive.' });
657 }
658 });
659
625 660 // ---------------------------------------------------------------------------
626 661 // GET /api/files/thumbnail?file=<absolute-path>
627 662 // Returns a pre-generated cached thumbnail if present.
@@ -11,6 +11,7 @@ const { getDb } = require('../db');
11const { loadConfig, saveConfig, getEffectivePaths, getAllowedRoot } = require('../config');
11const { loadConfig, saveConfig, getEffectivePaths, getAllowedRoot } = require('../config');
12const { requireAuth } = require('../auth');
12const { requireAuth } = require('../auth');
13const { getCachedThumbnailInfo, getImagesWithThumbnailsInDir, getFolderIconSourceFile, setFolderIconAssignment } = require('../thumbnail-cache');
13const { getCachedThumbnailInfo, getImagesWithThumbnailsInDir, getFolderIconSourceFile, setFolderIconAssignment } = require('../thumbnail-cache');
14const { buildZip } = require('./share');
14
15
15// ---------------------------------------------------------------------------
16// ---------------------------------------------------------------------------
16// Multer storage — files are staged into temporary files and only promoted
17// Multer storage — files are staged into temporary files and only promoted
@@ -622,6 +623,40 @@ router.get('/download', requireAuth, (req, res) =>
622 res.download(file, path.basename(file));
623 res.download(file, path.basename(file));
623});
624});
624
625
626// ---------------------------------------------------------------------------
627// GET /api/files/download-zip?dir=<absolute-path>
628// Authenticated. Streams a zip of the given directory.
629// ---------------------------------------------------------------------------
630router.get('/download-zip', requireAuth, async (req, res) =>
631{
632 const dir = req.query.dir;
633 if (!dir) return res.status(400).json({ error: 'dir is required.' });
634
635 const roots = effectivePaths();
636 const info = resolveRoot(dir, roots);
637 if (!info || !canRead(req.user, info.label))
638 {
639 return res.status(403).json({ error: 'Access denied.' });
640 }
641
642 if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory())
643 {
644 return res.status(404).json({ error: 'Directory not found.' });
645 }
646
647 // Use a hash of the dir path as cache key so concurrent users share the cache.
648 const cacheKey = crypto.createHash('sha256').update(dir).digest('hex');
649 try
650 {
651 const zipPath = await buildZip(dir, cacheKey);
652 const zipName = `${path.basename(dir)}.zip`;
653 res.download(zipPath, zipName);
654 } catch (err)
655 {
656 res.status(500).json({ error: 'Failed to create zip archive.' });
657 }
658});
659
625// ---------------------------------------------------------------------------
660// ---------------------------------------------------------------------------
626// GET /api/files/thumbnail?file=<absolute-path>
661// GET /api/files/thumbnail?file=<absolute-path>
627// Returns a pre-generated cached thumbnail if present.
662// Returns a pre-generated cached thumbnail if present.
server/routes/share.js added +298 −0
@@ -0,0 +1,298 @@
1 'use strict';
2
3 const express = require('express');
4 const path = require('path');
5 const fs = require('fs');
6 const crypto = require('crypto');
7 const archiver = require('archiver');
8 const router = express.Router();
9
10 const { getDb } = require('../db');
11 const { requireAuth } = require('../auth');
12 const { loadConfig, getEffectivePaths, getAllowedRoot } = require('../config');
13
14 const SHARE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
15 const ZIP_CACHE_DIR = path.join(__dirname, '../../zip-cache');
16 const ZIP_MAX_AGE_MS = 24 * 60 * 60 * 1000; // 1 day
17
18 // ---------------------------------------------------------------------------
19 // Helpers
20 // ---------------------------------------------------------------------------
21
22 function effectivePaths ()
23 {
24 return getEffectivePaths(loadConfig().paths || []);
25 }
26
27 /** Returns the configured root that contains absPath, or null. */
28 function resolveRoot (absPath)
29 {
30 return getAllowedRoot(absPath, effectivePaths());
31 }
32
33 /** Generate a cryptographically random token. */
34 function generateToken ()
35 {
36 return crypto.randomBytes(32).toString('hex');
37 }
38
39 /** Ensure the zip cache directory exists. */
40 function ensureZipCacheDir ()
41 {
42 if (!fs.existsSync(ZIP_CACHE_DIR))
43 {
44 fs.mkdirSync(ZIP_CACHE_DIR, { recursive: true });
45 }
46 }
47
48 /**
49 * Delete zip files in ZIP_CACHE_DIR that are older than ZIP_MAX_AGE_MS.
50 * Also delete zip files whose corresponding share token has expired.
51 */
52 function pruneZipCache ()
53 {
54 ensureZipCacheDir();
55 const now = Date.now();
56 let entries;
57 try
58 {
59 entries = fs.readdirSync(ZIP_CACHE_DIR);
60 } catch
61 {
62 return;
63 }
64
65 for (const name of entries)
66 {
67 if (!name.endsWith('.zip')) continue;
68 const fullPath = path.join(ZIP_CACHE_DIR, name);
69 try
70 {
71 const stat = fs.statSync(fullPath);
72 const age = now - stat.mtimeMs;
73 if (age > ZIP_MAX_AGE_MS)
74 {
75 fs.unlinkSync(fullPath);
76 }
77 } catch
78 {
79 // Ignore files that disappeared.
80 }
81 }
82 }
83
84 /**
85 * Create (or return cached) zip for the given directory.
86 * cacheKey is used as the filename stem.
87 * Returns the full path to the zip file.
88 */
89 function buildZip (dirPath, cacheKey)
90 {
91 return new Promise((resolve, reject) =>
92 {
93 ensureZipCacheDir();
94 pruneZipCache();
95
96 const zipPath = path.join(ZIP_CACHE_DIR, `${cacheKey}.zip`);
97
98 // Serve cached version if it exists and is not too old.
99 if (fs.existsSync(zipPath))
100 {
101 try
102 {
103 const stat = fs.statSync(zipPath);
104 if (Date.now() - stat.mtimeMs < ZIP_MAX_AGE_MS)
105 {
106 return resolve(zipPath);
107 }
108 fs.unlinkSync(zipPath);
109 } catch { /* fall through to rebuild */ }
110 }
111
112 const tmpPath = zipPath + '.tmp';
113 const output = fs.createWriteStream(tmpPath);
114 const archive = archiver('zip', { zlib: { level: 6 } });
115
116 output.on('close', () =>
117 {
118 try
119 {
120 fs.renameSync(tmpPath, zipPath);
121 resolve(zipPath);
122 } catch (err)
123 {
124 reject(err);
125 }
126 });
127
128 archive.on('error', (err) =>
129 {
130 try { fs.unlinkSync(tmpPath); } catch { /* ignore */ }
131 reject(err);
132 });
133
134 archive.pipe(output);
135 archive.directory(dirPath, path.basename(dirPath));
136 archive.finalize();
137 });
138 }
139
140 // ---------------------------------------------------------------------------
141 // POST /api/share/create
142 // Body: { filePath: <absolute-path> }
143 // Authenticated. Creates a 24-hour share token for a file or directory.
144 // ---------------------------------------------------------------------------
145 router.post('/create', requireAuth, (req, res) =>
146 {
147 const filePath = String((req.body && req.body.filePath) || '').trim();
148 if (!filePath)
149 {
150 return res.status(400).json({ error: 'filePath is required.' });
151 }
152
153 const root = resolveRoot(filePath);
154 if (!root)
155 {
156 return res.status(403).json({ error: 'Access denied.' });
157 }
158
159 // Verify the user can read that root.
160 const rootLabel = path.basename(root);
161 const user = req.user;
162 const canRead = user.isAdmin
163 || !!(user.permissions[rootLabel] && user.permissions[rootLabel].read);
164 if (!canRead)
165 {
166 return res.status(403).json({ error: 'Access denied.' });
167 }
168
169 let stat;
170 try
171 {
172 stat = fs.statSync(filePath);
173 } catch
174 {
175 return res.status(404).json({ error: 'File or folder not found.' });
176 }
177
178 const isDir = stat.isDirectory() ? 1 : 0;
179 const now = Date.now();
180 const expiresAt = now + SHARE_TTL_MS;
181 const token = generateToken();
182
183 const db = getDb();
184 db.prepare(`
185 INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at)
186 VALUES (?, ?, ?, ?, ?, ?)
187 `).run([token, filePath, isDir, user.username, now, expiresAt]);
188
189 res.json({ token, expiresAt });
190 });
191
192 // ---------------------------------------------------------------------------
193 // GET /api/share/info/:token
194 // Public (no auth). Returns metadata about the shared item.
195 // ---------------------------------------------------------------------------
196 router.get('/info/:token', (req, res) =>
197 {
198 const token = String(req.params.token || '').trim();
199 if (!token) return res.status(400).json({ error: 'Token is required.' });
200
201 const db = getDb();
202 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
203
204 if (!row) return res.status(404).json({ error: 'Share link not found.' });
205 if (Date.now() > row.expires_at)
206 {
207 return res.status(410).json({ error: 'Share link has expired.' });
208 }
209
210 const name = path.basename(row.file_path);
211 res.json({
212 name,
213 isDir: !!row.is_dir,
214 expiresAt: row.expires_at,
215 });
216 });
217
218 // ---------------------------------------------------------------------------
219 // GET /api/share/preview/:token
220 // Public (no auth). Streams a file for inline preview (non-directory only).
221 // ---------------------------------------------------------------------------
222 router.get('/preview/:token', (req, res) =>
223 {
224 const token = String(req.params.token || '').trim();
225 if (!token) return res.status(400).json({ error: 'Token is required.' });
226
227 const db = getDb();
228 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
229
230 if (!row) return res.status(404).json({ error: 'Share link not found.' });
231 if (Date.now() > row.expires_at) return res.status(410).json({ error: 'Share link has expired.' });
232 if (row.is_dir) return res.status(400).json({ error: 'Cannot preview a directory.' });
233
234 if (!fs.existsSync(row.file_path))
235 {
236 return res.status(404).json({ error: 'File not found.' });
237 }
238
239 // Limit preview size to 50 MB to prevent accidental large file streaming.
240 const MAX_PREVIEW_BYTES = 50 * 1024 * 1024;
241 let stat;
242 try { stat = fs.statSync(row.file_path); } catch { return res.status(404).json({ error: 'File not found.' }); }
243
244 if (stat.size > MAX_PREVIEW_BYTES)
245 {
246 return res.status(413).json({ error: 'File too large for inline preview.' });
247 }
248
249 res.set('Cache-Control', 'private, no-store');
250 res.sendFile(row.file_path);
251 });
252
253 // ---------------------------------------------------------------------------
254 // GET /api/share/download/:token
255 // Public (no auth). Streams the file or a zip of the directory.
256 // ---------------------------------------------------------------------------
257 router.get('/download/:token', async (req, res) =>
258 {
259 const token = String(req.params.token || '').trim();
260 if (!token) return res.status(400).json({ error: 'Token is required.' });
261
262 const db = getDb();
263 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
264
265 if (!row) return res.status(404).json({ error: 'Share link not found.' });
266 if (Date.now() > row.expires_at) return res.status(410).json({ error: 'Share link has expired.' });
267
268 if (row.is_dir)
269 {
270 if (!fs.existsSync(row.file_path) || !fs.statSync(row.file_path).isDirectory())
271 {
272 return res.status(404).json({ error: 'Directory not found.' });
273 }
274
275 try
276 {
277 const zipPath = await buildZip(row.file_path, token);
278 const zipName = `${path.basename(row.file_path)}.zip`;
279 res.download(zipPath, zipName);
280 } catch (err)
281 {
282 res.status(500).json({ error: 'Failed to create zip archive.' });
283 }
284 } else
285 {
286 if (!fs.existsSync(row.file_path))
287 {
288 return res.status(404).json({ error: 'File not found.' });
289 }
290
291 res.download(row.file_path, path.basename(row.file_path));
292 }
293 });
294
295 module.exports = router;
296 module.exports.buildZip = buildZip;
297 module.exports.pruneZipCache = pruneZipCache;
298 module.exports.ZIP_CACHE_DIR = ZIP_CACHE_DIR;
@@ -0,0 +1,298 @@
1'use strict';
2
3const express = require('express');
4const path = require('path');
5const fs = require('fs');
6const crypto = require('crypto');
7const archiver = require('archiver');
8const router = express.Router();
9
10const { getDb } = require('../db');
11const { requireAuth } = require('../auth');
12const { loadConfig, getEffectivePaths, getAllowedRoot } = require('../config');
13
14const SHARE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
15const ZIP_CACHE_DIR = path.join(__dirname, '../../zip-cache');
16const ZIP_MAX_AGE_MS = 24 * 60 * 60 * 1000; // 1 day
17
18// ---------------------------------------------------------------------------
19// Helpers
20// ---------------------------------------------------------------------------
21
22function effectivePaths ()
23{
24 return getEffectivePaths(loadConfig().paths || []);
25}
26
27/** Returns the configured root that contains absPath, or null. */
28function resolveRoot (absPath)
29{
30 return getAllowedRoot(absPath, effectivePaths());
31}
32
33/** Generate a cryptographically random token. */
34function generateToken ()
35{
36 return crypto.randomBytes(32).toString('hex');
37}
38
39/** Ensure the zip cache directory exists. */
40function ensureZipCacheDir ()
41{
42 if (!fs.existsSync(ZIP_CACHE_DIR))
43 {
44 fs.mkdirSync(ZIP_CACHE_DIR, { recursive: true });
45 }
46}
47
48/**
49 * Delete zip files in ZIP_CACHE_DIR that are older than ZIP_MAX_AGE_MS.
50 * Also delete zip files whose corresponding share token has expired.
51 */
52function pruneZipCache ()
53{
54 ensureZipCacheDir();
55 const now = Date.now();
56 let entries;
57 try
58 {
59 entries = fs.readdirSync(ZIP_CACHE_DIR);
60 } catch
61 {
62 return;
63 }
64
65 for (const name of entries)
66 {
67 if (!name.endsWith('.zip')) continue;
68 const fullPath = path.join(ZIP_CACHE_DIR, name);
69 try
70 {
71 const stat = fs.statSync(fullPath);
72 const age = now - stat.mtimeMs;
73 if (age > ZIP_MAX_AGE_MS)
74 {
75 fs.unlinkSync(fullPath);
76 }
77 } catch
78 {
79 // Ignore files that disappeared.
80 }
81 }
82}
83
84/**
85 * Create (or return cached) zip for the given directory.
86 * cacheKey is used as the filename stem.
87 * Returns the full path to the zip file.
88 */
89function buildZip (dirPath, cacheKey)
90{
91 return new Promise((resolve, reject) =>
92 {
93 ensureZipCacheDir();
94 pruneZipCache();
95
96 const zipPath = path.join(ZIP_CACHE_DIR, `${cacheKey}.zip`);
97
98 // Serve cached version if it exists and is not too old.
99 if (fs.existsSync(zipPath))
100 {
101 try
102 {
103 const stat = fs.statSync(zipPath);
104 if (Date.now() - stat.mtimeMs < ZIP_MAX_AGE_MS)
105 {
106 return resolve(zipPath);
107 }
108 fs.unlinkSync(zipPath);
109 } catch { /* fall through to rebuild */ }
110 }
111
112 const tmpPath = zipPath + '.tmp';
113 const output = fs.createWriteStream(tmpPath);
114 const archive = archiver('zip', { zlib: { level: 6 } });
115
116 output.on('close', () =>
117 {
118 try
119 {
120 fs.renameSync(tmpPath, zipPath);
121 resolve(zipPath);
122 } catch (err)
123 {
124 reject(err);
125 }
126 });
127
128 archive.on('error', (err) =>
129 {
130 try { fs.unlinkSync(tmpPath); } catch { /* ignore */ }
131 reject(err);
132 });
133
134 archive.pipe(output);
135 archive.directory(dirPath, path.basename(dirPath));
136 archive.finalize();
137 });
138}
139
140// ---------------------------------------------------------------------------
141// POST /api/share/create
142// Body: { filePath: <absolute-path> }
143// Authenticated. Creates a 24-hour share token for a file or directory.
144// ---------------------------------------------------------------------------
145router.post('/create', requireAuth, (req, res) =>
146{
147 const filePath = String((req.body && req.body.filePath) || '').trim();
148 if (!filePath)
149 {
150 return res.status(400).json({ error: 'filePath is required.' });
151 }
152
153 const root = resolveRoot(filePath);
154 if (!root)
155 {
156 return res.status(403).json({ error: 'Access denied.' });
157 }
158
159 // Verify the user can read that root.
160 const rootLabel = path.basename(root);
161 const user = req.user;
162 const canRead = user.isAdmin
163 || !!(user.permissions[rootLabel] && user.permissions[rootLabel].read);
164 if (!canRead)
165 {
166 return res.status(403).json({ error: 'Access denied.' });
167 }
168
169 let stat;
170 try
171 {
172 stat = fs.statSync(filePath);
173 } catch
174 {
175 return res.status(404).json({ error: 'File or folder not found.' });
176 }
177
178 const isDir = stat.isDirectory() ? 1 : 0;
179 const now = Date.now();
180 const expiresAt = now + SHARE_TTL_MS;
181 const token = generateToken();
182
183 const db = getDb();
184 db.prepare(`
185 INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at)
186 VALUES (?, ?, ?, ?, ?, ?)
187 `).run([token, filePath, isDir, user.username, now, expiresAt]);
188
189 res.json({ token, expiresAt });
190});
191
192// ---------------------------------------------------------------------------
193// GET /api/share/info/:token
194// Public (no auth). Returns metadata about the shared item.
195// ---------------------------------------------------------------------------
196router.get('/info/:token', (req, res) =>
197{
198 const token = String(req.params.token || '').trim();
199 if (!token) return res.status(400).json({ error: 'Token is required.' });
200
201 const db = getDb();
202 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
203
204 if (!row) return res.status(404).json({ error: 'Share link not found.' });
205 if (Date.now() > row.expires_at)
206 {
207 return res.status(410).json({ error: 'Share link has expired.' });
208 }
209
210 const name = path.basename(row.file_path);
211 res.json({
212 name,
213 isDir: !!row.is_dir,
214 expiresAt: row.expires_at,
215 });
216});
217
218// ---------------------------------------------------------------------------
219// GET /api/share/preview/:token
220// Public (no auth). Streams a file for inline preview (non-directory only).
221// ---------------------------------------------------------------------------
222router.get('/preview/:token', (req, res) =>
223{
224 const token = String(req.params.token || '').trim();
225 if (!token) return res.status(400).json({ error: 'Token is required.' });
226
227 const db = getDb();
228 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
229
230 if (!row) return res.status(404).json({ error: 'Share link not found.' });
231 if (Date.now() > row.expires_at) return res.status(410).json({ error: 'Share link has expired.' });
232 if (row.is_dir) return res.status(400).json({ error: 'Cannot preview a directory.' });
233
234 if (!fs.existsSync(row.file_path))
235 {
236 return res.status(404).json({ error: 'File not found.' });
237 }
238
239 // Limit preview size to 50 MB to prevent accidental large file streaming.
240 const MAX_PREVIEW_BYTES = 50 * 1024 * 1024;
241 let stat;
242 try { stat = fs.statSync(row.file_path); } catch { return res.status(404).json({ error: 'File not found.' }); }
243
244 if (stat.size > MAX_PREVIEW_BYTES)
245 {
246 return res.status(413).json({ error: 'File too large for inline preview.' });
247 }
248
249 res.set('Cache-Control', 'private, no-store');
250 res.sendFile(row.file_path);
251});
252
253// ---------------------------------------------------------------------------
254// GET /api/share/download/:token
255// Public (no auth). Streams the file or a zip of the directory.
256// ---------------------------------------------------------------------------
257router.get('/download/:token', async (req, res) =>
258{
259 const token = String(req.params.token || '').trim();
260 if (!token) return res.status(400).json({ error: 'Token is required.' });
261
262 const db = getDb();
263 const row = db.prepare('SELECT * FROM share_tokens WHERE token = ?').get([token]);
264
265 if (!row) return res.status(404).json({ error: 'Share link not found.' });
266 if (Date.now() > row.expires_at) return res.status(410).json({ error: 'Share link has expired.' });
267
268 if (row.is_dir)
269 {
270 if (!fs.existsSync(row.file_path) || !fs.statSync(row.file_path).isDirectory())
271 {
272 return res.status(404).json({ error: 'Directory not found.' });
273 }
274
275 try
276 {
277 const zipPath = await buildZip(row.file_path, token);
278 const zipName = `${path.basename(row.file_path)}.zip`;
279 res.download(zipPath, zipName);
280 } catch (err)
281 {
282 res.status(500).json({ error: 'Failed to create zip archive.' });
283 }
284 } else
285 {
286 if (!fs.existsSync(row.file_path))
287 {
288 return res.status(404).json({ error: 'File not found.' });
289 }
290
291 res.download(row.file_path, path.basename(row.file_path));
292 }
293});
294
295module.exports = router;
296module.exports.buildZip = buildZip;
297module.exports.pruneZipCache = pruneZipCache;
298module.exports.ZIP_CACHE_DIR = ZIP_CACHE_DIR;
tests/files.routes.test.js +47 −0
@@ -618,3 +618,50 @@ describe('folder icon endpoints', () =>
618 618 expect(status).toBe(403);
619 619 });
620 620 });
621
622 // ---------------------------------------------------------------------------
623 // GET /api/files/download-zip
624 // ---------------------------------------------------------------------------
625 describe('GET /api/files/download-zip', () =>
626 {
627 beforeEach(() =>
628 {
629 mockUser = { username: 'admin', isAdmin: true, permissions: {} };
630 });
631
632 test('streams a valid zip for an accessible directory', async () =>
633 {
634 const subDir = path.join(rootDir, 'zipme');
635 fs.mkdirSync(subDir);
636 fs.writeFileSync(path.join(subDir, 'file.txt'), 'content');
637
638 const { status, headers, body: buf } = await reqRaw('GET', `/api/files/download-zip?dir=${encodeURIComponent(subDir)}`);
639 expect(status).toBe(200);
640
641 const ct = headers['content-type'] || '';
642 expect(ct.includes('zip') || ct.includes('octet')).toBe(true);
643
644 // ZIP magic bytes PK\x03\x04
645 expect(buf[0]).toBe(0x50);
646 expect(buf[1]).toBe(0x4b);
647 }, 20000);
648
649 test('returns 400 when dir param is missing', async () =>
650 {
651 const { status } = await req('GET', '/api/files/download-zip');
652 expect(status).toBe(400);
653 });
654
655 test('returns 404 for a non-existent directory', async () =>
656 {
657 const missing = path.join(rootDir, 'ghost');
658 const { status } = await req('GET', `/api/files/download-zip?dir=${encodeURIComponent(missing)}`);
659 expect(status).toBe(404);
660 });
661
662 test('returns 403 for path outside configured roots', async () =>
663 {
664 const { status } = await req('GET', `/api/files/download-zip?dir=${encodeURIComponent(os.tmpdir())}`);
665 expect(status).toBe(403);
666 });
667 });
@@ -618,3 +618,50 @@ describe('folder icon endpoints', () =>
618 expect(status).toBe(403);
618 expect(status).toBe(403);
619 });
619 });
620});
620});
621
622// ---------------------------------------------------------------------------
623// GET /api/files/download-zip
624// ---------------------------------------------------------------------------
625describe('GET /api/files/download-zip', () =>
626{
627 beforeEach(() =>
628 {
629 mockUser = { username: 'admin', isAdmin: true, permissions: {} };
630 });
631
632 test('streams a valid zip for an accessible directory', async () =>
633 {
634 const subDir = path.join(rootDir, 'zipme');
635 fs.mkdirSync(subDir);
636 fs.writeFileSync(path.join(subDir, 'file.txt'), 'content');
637
638 const { status, headers, body: buf } = await reqRaw('GET', `/api/files/download-zip?dir=${encodeURIComponent(subDir)}`);
639 expect(status).toBe(200);
640
641 const ct = headers['content-type'] || '';
642 expect(ct.includes('zip') || ct.includes('octet')).toBe(true);
643
644 // ZIP magic bytes PK\x03\x04
645 expect(buf[0]).toBe(0x50);
646 expect(buf[1]).toBe(0x4b);
647 }, 20000);
648
649 test('returns 400 when dir param is missing', async () =>
650 {
651 const { status } = await req('GET', '/api/files/download-zip');
652 expect(status).toBe(400);
653 });
654
655 test('returns 404 for a non-existent directory', async () =>
656 {
657 const missing = path.join(rootDir, 'ghost');
658 const { status } = await req('GET', `/api/files/download-zip?dir=${encodeURIComponent(missing)}`);
659 expect(status).toBe(404);
660 });
661
662 test('returns 403 for path outside configured roots', async () =>
663 {
664 const { status } = await req('GET', `/api/files/download-zip?dir=${encodeURIComponent(os.tmpdir())}`);
665 expect(status).toBe(403);
666 });
667});
tests/share.routes.test.js added +342 −0
@@ -0,0 +1,342 @@
1 'use strict';
2
3 const express = require('express');
4 const fs = require('fs');
5 const http = require('http');
6 const os = require('os');
7 const path = require('path');
8 const { once } = require('events');
9
10 let mockPaths = [];
11 let mockUser = { username: 'testuser', isAdmin: true, permissions: {} };
12
13 jest.mock('../server/db', () =>
14 {
15 const { Database } = require('node-sqlite3-wasm');
16 let db;
17 function getDb ()
18 {
19 if (!db)
20 {
21 db = new Database(':memory:');
22 db.exec(`
23 CREATE TABLE IF NOT EXISTS share_tokens (
24 token TEXT PRIMARY KEY,
25 file_path TEXT NOT NULL,
26 is_dir INTEGER NOT NULL DEFAULT 0,
27 created_by TEXT NOT NULL,
28 created_at INTEGER NOT NULL,
29 expires_at INTEGER NOT NULL
30 );
31 `);
32 }
33 return db;
34 }
35 return { getDb, initDb: getDb };
36 });
37
38 jest.mock('../server/config', () => ({
39 loadConfig: () => ({ port: 3000, paths: [...mockPaths], rootAliases: {} }),
40 saveConfig: jest.fn(),
41 getEffectivePaths: (paths) => paths,
42 getAllowedRoot: (targetPath, roots) =>
43 {
44 const pathMod = require('path');
45 const absTarget = pathMod.resolve(String(targetPath || ''));
46 return roots.find((root) =>
47 {
48 const absRoot = pathMod.resolve(root);
49 return absTarget === absRoot || absTarget.startsWith(absRoot + pathMod.sep);
50 }) || null;
51 },
52 }));
53
54 jest.mock('../server/auth', () => ({
55 requireAuth: (req, res, next) => { req.user = mockUser; next(); },
56 }));
57
58 const shareRoutes = require('../server/routes/share');
59 const { getDb } = require('../server/db');
60
61 let server;
62 let baseUrl;
63 let rootDir;
64
65 function get (p) { return fetch(baseUrl + p); }
66 function post (p, body) {
67 return fetch(baseUrl + p, {
68 method: 'POST',
69 headers: { 'Content-Type': 'application/json' },
70 body: JSON.stringify(body),
71 });
72 }
73
74 beforeAll(async () =>
75 {
76 rootDir = fs.mkdtempSync(path.join(os.tmpdir(), 'filemanager-share-test-'));
77 mockPaths = [rootDir];
78
79 const app = express();
80 app.use(express.json());
81 app.use('/api/share', shareRoutes);
82 app.use((err, req, res, _next) =>
83 {
84 res.status(err.status || 500).json({ error: err.message || 'Internal error' });
85 });
86
87 server = http.createServer(app);
88 server.listen(0);
89 await once(server, 'listening');
90 baseUrl = `http://127.0.0.1:${server.address().port}`;
91 });
92
93 afterAll(() =>
94 {
95 server.close();
96 fs.rmSync(rootDir, { recursive: true, force: true });
97 });
98
99 beforeEach(() =>
100 {
101 fs.rmSync(rootDir, { recursive: true, force: true });
102 fs.mkdirSync(rootDir, { recursive: true });
103 // Reset DB between tests
104 const db = getDb();
105 db.exec('DELETE FROM share_tokens');
106 });
107
108 // ---------------------------------------------------------------------------
109 // POST /api/share/create
110 // ---------------------------------------------------------------------------
111 describe('POST /api/share/create', () =>
112 {
113 test('creates a token for a file', async () =>
114 {
115 const filePath = path.join(rootDir, 'hello.txt');
116 fs.writeFileSync(filePath, 'hello');
117
118 const res = await post('/api/share/create', { filePath });
119 expect(res.status).toBe(200);
120 const body = await res.json();
121 expect(typeof body.token).toBe('string');
122 expect(body.token).toHaveLength(64); // 32 bytes hex
123 expect(typeof body.expiresAt).toBe('number');
124 expect(body.expiresAt).toBeGreaterThan(Date.now());
125 });
126
127 test('creates a token for a directory', async () =>
128 {
129 const dirPath = path.join(rootDir, 'subdir');
130 fs.mkdirSync(dirPath);
131
132 const res = await post('/api/share/create', { filePath: dirPath });
133 expect(res.status).toBe(200);
134 const body = await res.json();
135 expect(typeof body.token).toBe('string');
136 });
137
138 test('returns 400 when filePath is missing', async () =>
139 {
140 const res = await post('/api/share/create', {});
141 expect(res.status).toBe(400);
142 });
143
144 test('returns 403 when path is outside configured roots', async () =>
145 {
146 const res = await post('/api/share/create', { filePath: os.tmpdir() });
147 expect(res.status).toBe(403);
148 });
149
150 test('returns 404 when file does not exist', async () =>
151 {
152 const res = await post('/api/share/create', { filePath: path.join(rootDir, 'missing.txt') });
153 expect(res.status).toBe(404);
154 });
155 });
156
157 // ---------------------------------------------------------------------------
158 // GET /api/share/info/:token
159 // ---------------------------------------------------------------------------
160 describe('GET /api/share/info/:token', () =>
161 {
162 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
163 {
164 getDb().prepare(
165 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
166 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
167 }
168
169 test('returns file info for a valid token', async () =>
170 {
171 const filePath = path.join(rootDir, 'info.txt');
172 fs.writeFileSync(filePath, 'data');
173 insertToken({ token: 'aaaa', filePath });
174
175 const res = await get('/api/share/info/aaaa');
176 expect(res.status).toBe(200);
177 const body = await res.json();
178 expect(body.name).toBe('info.txt');
179 expect(body.isDir).toBe(false);
180 expect(typeof body.expiresAt).toBe('number');
181 });
182
183 test('returns isDir=true for directory tokens', async () =>
184 {
185 const dirPath = path.join(rootDir, 'mydir');
186 fs.mkdirSync(dirPath);
187 insertToken({ token: 'bbbb', filePath: dirPath, isDir: 1 });
188
189 const res = await get('/api/share/info/bbbb');
190 expect(res.status).toBe(200);
191 const body = await res.json();
192 expect(body.isDir).toBe(true);
193 });
194
195 test('returns 404 for unknown token', async () =>
196 {
197 const res = await get('/api/share/info/unknowntoken');
198 expect(res.status).toBe(404);
199 });
200
201 test('returns 410 for expired token', async () =>
202 {
203 const filePath = path.join(rootDir, 'exp.txt');
204 fs.writeFileSync(filePath, 'x');
205 insertToken({ token: 'cccc', filePath, expiresAt: Date.now() - 1000 });
206
207 const res = await get('/api/share/info/cccc');
208 expect(res.status).toBe(410);
209 });
210 });
211
212 // ---------------------------------------------------------------------------
213 // GET /api/share/preview/:token
214 // ---------------------------------------------------------------------------
215 describe('GET /api/share/preview/:token', () =>
216 {
217 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
218 {
219 getDb().prepare(
220 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
221 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
222 }
223
224 test('streams file content for a valid file token', async () =>
225 {
226 const filePath = path.join(rootDir, 'preview.txt');
227 fs.writeFileSync(filePath, 'preview content');
228 insertToken({ token: 'prev1', filePath });
229
230 const res = await get('/api/share/preview/prev1');
231 expect(res.status).toBe(200);
232 const text = await res.text();
233 expect(text).toBe('preview content');
234 });
235
236 test('returns 400 when token points to a directory', async () =>
237 {
238 const dirPath = path.join(rootDir, 'previewdir');
239 fs.mkdirSync(dirPath);
240 insertToken({ token: 'prev2', filePath: dirPath, isDir: 1 });
241
242 const res = await get('/api/share/preview/prev2');
243 expect(res.status).toBe(400);
244 });
245
246 test('returns 410 for expired token', async () =>
247 {
248 const filePath = path.join(rootDir, 'ep.txt');
249 fs.writeFileSync(filePath, 'x');
250 insertToken({ token: 'prev3', filePath, expiresAt: Date.now() - 1 });
251
252 const res = await get('/api/share/preview/prev3');
253 expect(res.status).toBe(410);
254 });
255 });
256
257 // ---------------------------------------------------------------------------
258 // GET /api/share/download/:token
259 // ---------------------------------------------------------------------------
260 describe('GET /api/share/download/:token', () =>
261 {
262 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
263 {
264 getDb().prepare(
265 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
266 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
267 }
268
269 test('downloads a file', async () =>
270 {
271 const filePath = path.join(rootDir, 'dl.txt');
272 fs.writeFileSync(filePath, 'download me');
273 insertToken({ token: 'dl01', filePath });
274
275 const res = await get('/api/share/download/dl01');
276 expect(res.status).toBe(200);
277 const text = await res.text();
278 expect(text).toBe('download me');
279 });
280
281 test('downloads a directory as zip', async () =>
282 {
283 const dirPath = path.join(rootDir, 'zipit');
284 fs.mkdirSync(dirPath);
285 fs.writeFileSync(path.join(dirPath, 'a.txt'), 'aaa');
286 insertToken({ token: 'dl02', filePath: dirPath, isDir: 1 });
287
288 const res = await get('/api/share/download/dl02');
289 expect(res.status).toBe(200);
290 const ct = res.headers.get('content-type') || '';
291 // Express sends application/zip or application/octet-stream for .zip downloads
292 expect(ct.includes('zip') || ct.includes('octet')).toBe(true);
293 const buf = await res.arrayBuffer();
294 // ZIP magic bytes: PK\x03\x04
295 expect(new Uint8Array(buf.slice(0, 4))).toEqual(new Uint8Array([0x50, 0x4b, 0x03, 0x04]));
296 });
297
298 test('returns 410 for expired token', async () =>
299 {
300 const filePath = path.join(rootDir, 'edl.txt');
301 fs.writeFileSync(filePath, 'x');
302 insertToken({ token: 'dl03', filePath, expiresAt: Date.now() - 1 });
303
304 const res = await get('/api/share/download/dl03');
305 expect(res.status).toBe(410);
306 });
307
308 test('returns 404 for unknown token', async () =>
309 {
310 const res = await get('/api/share/download/nosuchtoken');
311 expect(res.status).toBe(404);
312 });
313 });
314
315 // ---------------------------------------------------------------------------
316 // pruneZipCache
317 // ---------------------------------------------------------------------------
318 describe('pruneZipCache', () =>
319 {
320 test('deletes zip files older than 1 day', () =>
321 {
322 const { pruneZipCache, ZIP_CACHE_DIR } = require('../server/routes/share');
323 fs.mkdirSync(ZIP_CACHE_DIR, { recursive: true });
324
325 const oldZip = path.join(ZIP_CACHE_DIR, 'old.zip');
326 fs.writeFileSync(oldZip, 'fake zip');
327 // Back-date the mtime by 25 hours
328 const pastTime = new Date(Date.now() - 25 * 60 * 60 * 1000);
329 fs.utimesSync(oldZip, pastTime, pastTime);
330
331 const freshZip = path.join(ZIP_CACHE_DIR, 'fresh.zip');
332 fs.writeFileSync(freshZip, 'fake fresh zip');
333
334 pruneZipCache();
335
336 expect(fs.existsSync(oldZip)).toBe(false);
337 expect(fs.existsSync(freshZip)).toBe(true);
338
339 // Cleanup
340 try { fs.unlinkSync(freshZip); } catch { /* ignore */ }
341 });
342 });
@@ -0,0 +1,342 @@
1'use strict';
2
3const express = require('express');
4const fs = require('fs');
5const http = require('http');
6const os = require('os');
7const path = require('path');
8const { once } = require('events');
9
10let mockPaths = [];
11let mockUser = { username: 'testuser', isAdmin: true, permissions: {} };
12
13jest.mock('../server/db', () =>
14{
15 const { Database } = require('node-sqlite3-wasm');
16 let db;
17 function getDb ()
18 {
19 if (!db)
20 {
21 db = new Database(':memory:');
22 db.exec(`
23 CREATE TABLE IF NOT EXISTS share_tokens (
24 token TEXT PRIMARY KEY,
25 file_path TEXT NOT NULL,
26 is_dir INTEGER NOT NULL DEFAULT 0,
27 created_by TEXT NOT NULL,
28 created_at INTEGER NOT NULL,
29 expires_at INTEGER NOT NULL
30 );
31 `);
32 }
33 return db;
34 }
35 return { getDb, initDb: getDb };
36});
37
38jest.mock('../server/config', () => ({
39 loadConfig: () => ({ port: 3000, paths: [...mockPaths], rootAliases: {} }),
40 saveConfig: jest.fn(),
41 getEffectivePaths: (paths) => paths,
42 getAllowedRoot: (targetPath, roots) =>
43 {
44 const pathMod = require('path');
45 const absTarget = pathMod.resolve(String(targetPath || ''));
46 return roots.find((root) =>
47 {
48 const absRoot = pathMod.resolve(root);
49 return absTarget === absRoot || absTarget.startsWith(absRoot + pathMod.sep);
50 }) || null;
51 },
52}));
53
54jest.mock('../server/auth', () => ({
55 requireAuth: (req, res, next) => { req.user = mockUser; next(); },
56}));
57
58const shareRoutes = require('../server/routes/share');
59const { getDb } = require('../server/db');
60
61let server;
62let baseUrl;
63let rootDir;
64
65function get (p) { return fetch(baseUrl + p); }
66function post (p, body) {
67 return fetch(baseUrl + p, {
68 method: 'POST',
69 headers: { 'Content-Type': 'application/json' },
70 body: JSON.stringify(body),
71 });
72}
73
74beforeAll(async () =>
75{
76 rootDir = fs.mkdtempSync(path.join(os.tmpdir(), 'filemanager-share-test-'));
77 mockPaths = [rootDir];
78
79 const app = express();
80 app.use(express.json());
81 app.use('/api/share', shareRoutes);
82 app.use((err, req, res, _next) =>
83 {
84 res.status(err.status || 500).json({ error: err.message || 'Internal error' });
85 });
86
87 server = http.createServer(app);
88 server.listen(0);
89 await once(server, 'listening');
90 baseUrl = `http://127.0.0.1:${server.address().port}`;
91});
92
93afterAll(() =>
94{
95 server.close();
96 fs.rmSync(rootDir, { recursive: true, force: true });
97});
98
99beforeEach(() =>
100{
101 fs.rmSync(rootDir, { recursive: true, force: true });
102 fs.mkdirSync(rootDir, { recursive: true });
103 // Reset DB between tests
104 const db = getDb();
105 db.exec('DELETE FROM share_tokens');
106});
107
108// ---------------------------------------------------------------------------
109// POST /api/share/create
110// ---------------------------------------------------------------------------
111describe('POST /api/share/create', () =>
112{
113 test('creates a token for a file', async () =>
114 {
115 const filePath = path.join(rootDir, 'hello.txt');
116 fs.writeFileSync(filePath, 'hello');
117
118 const res = await post('/api/share/create', { filePath });
119 expect(res.status).toBe(200);
120 const body = await res.json();
121 expect(typeof body.token).toBe('string');
122 expect(body.token).toHaveLength(64); // 32 bytes hex
123 expect(typeof body.expiresAt).toBe('number');
124 expect(body.expiresAt).toBeGreaterThan(Date.now());
125 });
126
127 test('creates a token for a directory', async () =>
128 {
129 const dirPath = path.join(rootDir, 'subdir');
130 fs.mkdirSync(dirPath);
131
132 const res = await post('/api/share/create', { filePath: dirPath });
133 expect(res.status).toBe(200);
134 const body = await res.json();
135 expect(typeof body.token).toBe('string');
136 });
137
138 test('returns 400 when filePath is missing', async () =>
139 {
140 const res = await post('/api/share/create', {});
141 expect(res.status).toBe(400);
142 });
143
144 test('returns 403 when path is outside configured roots', async () =>
145 {
146 const res = await post('/api/share/create', { filePath: os.tmpdir() });
147 expect(res.status).toBe(403);
148 });
149
150 test('returns 404 when file does not exist', async () =>
151 {
152 const res = await post('/api/share/create', { filePath: path.join(rootDir, 'missing.txt') });
153 expect(res.status).toBe(404);
154 });
155});
156
157// ---------------------------------------------------------------------------
158// GET /api/share/info/:token
159// ---------------------------------------------------------------------------
160describe('GET /api/share/info/:token', () =>
161{
162 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
163 {
164 getDb().prepare(
165 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
166 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
167 }
168
169 test('returns file info for a valid token', async () =>
170 {
171 const filePath = path.join(rootDir, 'info.txt');
172 fs.writeFileSync(filePath, 'data');
173 insertToken({ token: 'aaaa', filePath });
174
175 const res = await get('/api/share/info/aaaa');
176 expect(res.status).toBe(200);
177 const body = await res.json();
178 expect(body.name).toBe('info.txt');
179 expect(body.isDir).toBe(false);
180 expect(typeof body.expiresAt).toBe('number');
181 });
182
183 test('returns isDir=true for directory tokens', async () =>
184 {
185 const dirPath = path.join(rootDir, 'mydir');
186 fs.mkdirSync(dirPath);
187 insertToken({ token: 'bbbb', filePath: dirPath, isDir: 1 });
188
189 const res = await get('/api/share/info/bbbb');
190 expect(res.status).toBe(200);
191 const body = await res.json();
192 expect(body.isDir).toBe(true);
193 });
194
195 test('returns 404 for unknown token', async () =>
196 {
197 const res = await get('/api/share/info/unknowntoken');
198 expect(res.status).toBe(404);
199 });
200
201 test('returns 410 for expired token', async () =>
202 {
203 const filePath = path.join(rootDir, 'exp.txt');
204 fs.writeFileSync(filePath, 'x');
205 insertToken({ token: 'cccc', filePath, expiresAt: Date.now() - 1000 });
206
207 const res = await get('/api/share/info/cccc');
208 expect(res.status).toBe(410);
209 });
210});
211
212// ---------------------------------------------------------------------------
213// GET /api/share/preview/:token
214// ---------------------------------------------------------------------------
215describe('GET /api/share/preview/:token', () =>
216{
217 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
218 {
219 getDb().prepare(
220 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
221 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
222 }
223
224 test('streams file content for a valid file token', async () =>
225 {
226 const filePath = path.join(rootDir, 'preview.txt');
227 fs.writeFileSync(filePath, 'preview content');
228 insertToken({ token: 'prev1', filePath });
229
230 const res = await get('/api/share/preview/prev1');
231 expect(res.status).toBe(200);
232 const text = await res.text();
233 expect(text).toBe('preview content');
234 });
235
236 test('returns 400 when token points to a directory', async () =>
237 {
238 const dirPath = path.join(rootDir, 'previewdir');
239 fs.mkdirSync(dirPath);
240 insertToken({ token: 'prev2', filePath: dirPath, isDir: 1 });
241
242 const res = await get('/api/share/preview/prev2');
243 expect(res.status).toBe(400);
244 });
245
246 test('returns 410 for expired token', async () =>
247 {
248 const filePath = path.join(rootDir, 'ep.txt');
249 fs.writeFileSync(filePath, 'x');
250 insertToken({ token: 'prev3', filePath, expiresAt: Date.now() - 1 });
251
252 const res = await get('/api/share/preview/prev3');
253 expect(res.status).toBe(410);
254 });
255});
256
257// ---------------------------------------------------------------------------
258// GET /api/share/download/:token
259// ---------------------------------------------------------------------------
260describe('GET /api/share/download/:token', () =>
261{
262 function insertToken ({ token, filePath, isDir = 0, expiresAt = Date.now() + 86400000 })
263 {
264 getDb().prepare(
265 'INSERT INTO share_tokens (token, file_path, is_dir, created_by, created_at, expires_at) VALUES (?,?,?,?,?,?)',
266 ).run([token, filePath, isDir, 'testuser', Date.now(), expiresAt]);
267 }
268
269 test('downloads a file', async () =>
270 {
271 const filePath = path.join(rootDir, 'dl.txt');
272 fs.writeFileSync(filePath, 'download me');
273 insertToken({ token: 'dl01', filePath });
274
275 const res = await get('/api/share/download/dl01');
276 expect(res.status).toBe(200);
277 const text = await res.text();
278 expect(text).toBe('download me');
279 });
280
281 test('downloads a directory as zip', async () =>
282 {
283 const dirPath = path.join(rootDir, 'zipit');
284 fs.mkdirSync(dirPath);
285 fs.writeFileSync(path.join(dirPath, 'a.txt'), 'aaa');
286 insertToken({ token: 'dl02', filePath: dirPath, isDir: 1 });
287
288 const res = await get('/api/share/download/dl02');
289 expect(res.status).toBe(200);
290 const ct = res.headers.get('content-type') || '';
291 // Express sends application/zip or application/octet-stream for .zip downloads
292 expect(ct.includes('zip') || ct.includes('octet')).toBe(true);
293 const buf = await res.arrayBuffer();
294 // ZIP magic bytes: PK\x03\x04
295 expect(new Uint8Array(buf.slice(0, 4))).toEqual(new Uint8Array([0x50, 0x4b, 0x03, 0x04]));
296 });
297
298 test('returns 410 for expired token', async () =>
299 {
300 const filePath = path.join(rootDir, 'edl.txt');
301 fs.writeFileSync(filePath, 'x');
302 insertToken({ token: 'dl03', filePath, expiresAt: Date.now() - 1 });
303
304 const res = await get('/api/share/download/dl03');
305 expect(res.status).toBe(410);
306 });
307
308 test('returns 404 for unknown token', async () =>
309 {
310 const res = await get('/api/share/download/nosuchtoken');
311 expect(res.status).toBe(404);
312 });
313});
314
315// ---------------------------------------------------------------------------
316// pruneZipCache
317// ---------------------------------------------------------------------------
318describe('pruneZipCache', () =>
319{
320 test('deletes zip files older than 1 day', () =>
321 {
322 const { pruneZipCache, ZIP_CACHE_DIR } = require('../server/routes/share');
323 fs.mkdirSync(ZIP_CACHE_DIR, { recursive: true });
324
325 const oldZip = path.join(ZIP_CACHE_DIR, 'old.zip');
326 fs.writeFileSync(oldZip, 'fake zip');
327 // Back-date the mtime by 25 hours
328 const pastTime = new Date(Date.now() - 25 * 60 * 60 * 1000);
329 fs.utimesSync(oldZip, pastTime, pastTime);
330
331 const freshZip = path.join(ZIP_CACHE_DIR, 'fresh.zip');
332 fs.writeFileSync(freshZip, 'fake fresh zip');
333
334 pruneZipCache();
335
336 expect(fs.existsSync(oldZip)).toBe(false);
337 expect(fs.existsSync(freshZip)).toBe(true);
338
339 // Cleanup
340 try { fs.unlinkSync(freshZip); } catch { /* ignore */ }
341 });
342});
zip-cache/067407da199ba531a0668763e09af8ff3d941bb199e1be039de594b7644d9d5f.zip added Binary file +0 −0

The contents of this binary file are not shown.

zip-cache/dl02.zip added Binary file +0 −0

The contents of this binary file are not shown.