diff --git a/src/servers/api/file-browser/router.ts b/src/servers/api/file-browser/router.ts index 8f4bfc88..a3a03534 100644 --- a/src/servers/api/file-browser/router.ts +++ b/src/servers/api/file-browser/router.ts @@ -9,6 +9,7 @@ import * as errors from '@@/custom-errors'; import { readTtsConfig } from '@@/api/server-settings/tts'; import { readOcrConfig } from '@@/api/server-settings/ocr'; import { getUserSettings } from 'officerdb'; +import { buildThumbnail, clampSize, thumbnailKind } from './thumbnails'; async function getUserTtsVoice(userId: number): Promise { try { @@ -210,11 +211,24 @@ router.get('/ls', async (ctx) => { if (!isInside(rootDir, fullPath)) return null; const s = await stat(fullPath).catch(() => null); if (!s) return null; + const isDirectory = s.isDirectory(); return { name, - type: s.isDirectory() ? 'directory' : 'file', + type: isDirectory ? 'directory' : 'file', size: s.size, modifiedAt: s.mtimeMs, + /* + Whether `/thumb` will produce something, decided HERE so there is one list of extensions + rather than one on each side of the wire. + + The client had no way to know without its own copy, and the copies would have drifted — the + browser's `NATIVE_VIDEO_EXTS` is deliberately only the formats a