« get me outta code hell

preload, map and format sizes of additional files - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/page
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-12 23:23:17 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-12 23:23:17 -0300
commit3b770c69507ef139cd07f5335aefba33217d43ad (patch)
tree8168c79d18163418b8bedad227ecff436c5d5917 /src/page
parent589273c5e1d63e5f68ecedd68c9d4b49c36b25f4 (diff)
preload, map and format sizes of additional files
Diffstat (limited to 'src/page')
-rw-r--r--src/page/album.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/page/album.js b/src/page/album.js
index 8df8a678..76c9c5f0 100644
--- a/src/page/album.js
+++ b/src/page/album.js
@@ -109,10 +109,12 @@ export function write(album, {wikiData}) {
             getAlbumStylesheet,
             getArtistString,
             getLinkThemeString,
+            getSizeOfAdditionalFile,
             getThemeString,
             link,
             language,
-            transformMultiline
+            transformMultiline,
+            urls,
         }) => {
             const trackToListItem = bindOpts(unbound_trackToListItem, {
                 getArtistString,
@@ -219,7 +221,11 @@ export function write(album, {wikiData}) {
                             </${listTag}>
                         `}
                         ${hasAdditionalFiles && generateAdditionalFilesList(album.additionalFiles, {
-                            linkFile: file => link.albumAdditionalFile({album, file})
+                            // TODO: Kinda near the metal here...
+                            getFileSize: file => getSizeOfAdditionalFile(urls
+                                .from('media.root')
+                                .to('media.albumAdditionalFile', album.directory, file)),
+                            linkFile: file => link.albumAdditionalFile({album, file}),
                         })}
                         ${album.dateAddedToWiki && fixWS`
                             <p>