« get me outta code hell

additional files - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-05-12 21:55:03 -0300
committer(quasar) nebula <qznebula@protonmail.com>2022-05-12 21:55:41 -0300
commit589273c5e1d63e5f68ecedd68c9d4b49c36b25f4 (patch)
treef63558c64813531496d5306a754b7773e6a2bd95 /src/util
parent9dbc0792c8988e97b1b93b83b27b1aa62dfc1875 (diff)
additional files
These are basically supported for tracks but I've only implemented
them for albums for the moment (read: I'm lazy!).
Diffstat (limited to 'src/util')
-rw-r--r--src/util/link.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/link.js b/src/util/link.js
index 4e611df5..68539621 100644
--- a/src/util/link.js
+++ b/src/util/link.js
@@ -94,6 +94,19 @@ const link = {
     tag: linkDirectory('tag'),
     track: linkDirectory('track', {expose: 'data-track'}),
 
+    // TODO: This is a bit hacky. Files are just strings (not objects), so we
+    // have to manually provide the album alongside the file. They also don't
+    // follow the usual {name: whatever} type shape, so we have to provide that
+    // ourselves.
+    _albumAdditionalFileHelper: linkHelper(
+        ((fakeFileObject, { to }) =>
+            to('media.albumAdditionalFile', fakeFileObject.album.directory, fakeFileObject.name)),
+        {color: false}),
+    albumAdditionalFile: ({ file, album }, { to }) => link._albumAdditionalFileHelper({
+        name: file,
+        album
+    }, {to}),
+
     media: linkPathname('media.path', {color: false}),
     root: linkPathname('shared.path', {color: false}),
     data: linkPathname('data.path', {color: false}),