Update file extensions for previews.

This commit is contained in:
Leo Vasanko 2025-08-14 11:23:07 -07:00
parent e557bedac1
commit 24eb852822

View File

@ -37,17 +37,14 @@ export class Doc {
return this.url.replace(/^\/#/, '')
}
get img(): boolean {
const ext = this.name.split('.').pop()?.toLowerCase()
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'svg'].includes(ext || '')
const ext = this.name.split('.').pop()?.toLowerCase() || ''
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'heic', 'heif', 'svg'].includes(ext)
}
get previewable(): boolean {
if (this.img) return true
const ext = this.name.split('.').pop()?.toLowerCase()
const ext = this.name.split('.').pop()?.toLowerCase() || ''
// Not a comprehensive list, but good enough for now
return [
'mp4', 'mkv', 'webm', 'ogg', 'mp3', 'flac', 'aac', 'pdf',
'avif', 'heic', 'heif', 'jpg', 'jpeg', 'png'
].includes(ext || '')
return ['mp4', 'mkv', 'webm', 'ogg', 'mp3', 'flac', 'aac', 'pdf'].includes(ext)
}
get previewurl(): string {
return this.url.replace(/^\/files/, '/preview')