Compare commits

..

2 Commits

Author SHA1 Message Date
Leo Vasanko
ccad83b8ec Fixed gallery auto mode 2025-08-14 11:25:14 -07:00
Leo Vasanko
24eb852822 Update file extensions for previews. 2025-08-14 11:23:07 -07:00
2 changed files with 6 additions and 9 deletions

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')

View File

@ -77,8 +77,8 @@ watchEffect(() => {
store.query = props.query
})
watch(() => props.path, () => {
store.prefs.gallery = documents.value.some(d => d.previewable)
watch(documents, (docs) => {
store.prefs.gallery = docs.some(d => d.previewable)
}, { immediate: true })
</script>