Compare commits

..

No commits in common. "ccad83b8ec5ee8a760115b04365632596c80cf52" and "e557bedac1070721e6e8ebd5e10d3653758e121c" have entirely different histories.

2 changed files with 9 additions and 6 deletions

View File

@ -37,14 +37,17 @@ export class Doc {
return this.url.replace(/^\/#/, '')
}
get img(): boolean {
const ext = this.name.split('.').pop()?.toLowerCase() || ''
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', 'heic', 'heif', 'svg'].includes(ext)
const ext = this.name.split('.').pop()?.toLowerCase()
return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'avif', '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'].includes(ext)
return [
'mp4', 'mkv', 'webm', 'ogg', 'mp3', 'flac', 'aac', 'pdf',
'avif', 'heic', 'heif', 'jpg', 'jpeg', 'png'
].includes(ext || '')
}
get previewurl(): string {
return this.url.replace(/^\/files/, '/preview')

View File

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