diff --git a/sas/static/bundled/sas/pictures-download-index.ts b/sas/static/bundled/sas/pictures-download-index.ts index 21ee9989..35471dba 100644 --- a/sas/static/bundled/sas/pictures-download-index.ts +++ b/sas/static/bundled/sas/pictures-download-index.ts @@ -5,12 +5,13 @@ import type { PictureSchema } from "#openapi"; document.addEventListener("alpine:init", () => { Alpine.data("pictures_download", () => ({ isDownloading: false, + downloadPictures: [] as PictureSchema[], async downloadZip() { this.isDownloading = true; const bar = this.$refs.progress; bar.value = 0; - bar.max = this.pictures.length; + bar.max = this.downloadPictures.length; const incrementProgressBar = (_total: number): undefined => { bar.value++; @@ -29,7 +30,7 @@ document.addEventListener("alpine:init", () => { const zipWriter = new ZipWriter(await fileHandle.createWritable()); await Promise.all( - this.pictures.map((p: PictureSchema) => { + this.downloadPictures.map(async (p: PictureSchema) => { const imgName = `${p.album}/IMG_${p.date.replace(/[:\-]/g, "_")}${p.name.slice(p.name.lastIndexOf("."))}`; return zipWriter.add(imgName, new HttpReader(p.full_size_url), { level: 9, diff --git a/sas/static/bundled/sas/user/pictures-index.ts b/sas/static/bundled/sas/user/pictures-index.ts index 8d4e4829..7cc941c8 100644 --- a/sas/static/bundled/sas/user/pictures-index.ts +++ b/sas/static/bundled/sas/user/pictures-index.ts @@ -57,5 +57,9 @@ document.addEventListener("alpine:init", () => { } this.loading = false; }, + + allPictures(): PictureSchema[] { + return this.albums.flatMap((album: Album) => album.pictures); + }, })); }); diff --git a/sas/templates/sas/album.jinja b/sas/templates/sas/album.jinja index 18cd6f21..15d46dc4 100644 --- a/sas/templates/sas/album.jinja +++ b/sas/templates/sas/album.jinja @@ -85,7 +85,7 @@