CBZ: add support for AVIF

Also throw when there are no images to show
This commit is contained in:
John Factotum
2024-01-20 12:09:02 +08:00
parent 35f749dd7c
commit d9da576611
+2 -1
View File
@@ -16,11 +16,12 @@ export const makeComicBook = ({ entries, loadBlob, getSize }, file) => {
cache.delete(name) cache.delete(name)
} }
const exts = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg', '.jxl'] const exts = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.webp', '.svg', '.jxl', '.avif']
const files = entries const files = entries
.map(entry => entry.filename) .map(entry => entry.filename)
.filter(name => exts.some(ext => name.endsWith(ext))) .filter(name => exts.some(ext => name.endsWith(ext)))
.sort() .sort()
if (!files.length) throw new Error('No supported image files in archive')
const book = {} const book = {}
book.getCover = () => loadBlob(files[0]) book.getCover = () => loadBlob(files[0])