« get me outta code hell

Merge branch 'preview' into track-data-cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-23 20:19:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-23 20:19:12 -0300
commit61a3fad9cde8fa3809ccf26465f69dd050e6c669 (patch)
tree5c5c90d452c5aa7c023174bddc1a08f3f0acd75f /src
parent64476074cbc7375afe2388ddd6e9e3275c25f3bd (diff)
parenta53d53e1f95d84b23cffb9a5d43f1a70a412b6fe (diff)
Merge branch 'preview' into track-data-cleanup
Diffstat (limited to 'src')
-rw-r--r--src/content/dependencies/linkThing.js6
-rw-r--r--src/content/dependencies/listTracksWithExtra.js12
-rw-r--r--src/gen-thumbs.js8
-rw-r--r--src/page/artist-alias.js6
-rw-r--r--src/strings-default.json9
5 files changed, 29 insertions, 12 deletions
diff --git a/src/content/dependencies/linkThing.js b/src/content/dependencies/linkThing.js
index 643bf4b1..e661ca7c 100644
--- a/src/content/dependencies/linkThing.js
+++ b/src/content/dependencies/linkThing.js
@@ -1,6 +1,6 @@
 export default {
   contentDependencies: ['linkTemplate'],
-  extraDependencies: ['html'],
+  extraDependencies: ['html', 'language'],
 
   relations(relation) {
     return {
@@ -41,7 +41,7 @@ export default {
     hash: {type: 'string'},
   },
 
-  generate(data, relations, slots, {html}) {
+  generate(data, relations, slots, {html, language}) {
     const path = [data.pathKey, data.directory];
 
     const name =
@@ -51,7 +51,7 @@ export default {
 
     const content =
       (html.isBlank(slots.content)
-        ? name
+        ? language.sanitize(name)
         : slots.content);
 
     let color = null;
diff --git a/src/content/dependencies/listTracksWithExtra.js b/src/content/dependencies/listTracksWithExtra.js
index 73d25e3d..c9f80f35 100644
--- a/src/content/dependencies/listTracksWithExtra.js
+++ b/src/content/dependencies/listTracksWithExtra.js
@@ -65,10 +65,14 @@ export default {
         stitchArrays({
           albumLink: relations.albumLinks,
           date: data.dates,
-        }).map(({albumLink, date}) => ({
-            album: albumLink,
-            date: language.formatDate(date),
-          })),
+        }).map(({albumLink, date}) =>
+            (date
+              ? {
+                  stringsKey: 'withDate',
+                  album: albumLink,
+                  date: language.formatDate(date),
+                }
+              : {album: albumLink})),
 
       chunkRows:
         relations.trackLinks
diff --git a/src/gen-thumbs.js b/src/gen-thumbs.js
index e99b9602..3d441bc9 100644
--- a/src/gen-thumbs.js
+++ b/src/gen-thumbs.js
@@ -251,7 +251,11 @@ async function getImageMagickVersion(binary) {
     allData += data.toString();
   });
 
-  await promisifyProcess(proc, false);
+  try {
+    await promisifyProcess(proc, false);
+  } catch (error) {
+    return null;
+  }
 
   if (!allData.match(/ImageMagick/i)) {
     return null;
@@ -283,7 +287,7 @@ async function getSpawnMagick(tool) {
   }
 
   if (fn === null && await commandExists('magick')) {
-    version = await getImageMagickVersion(fn);
+    version = await getImageMagickVersion('magick');
     if (version !== null) {
       fn = (args) => spawn('magick', [tool, ...args]);
       description = `magick ${tool}`;
diff --git a/src/page/artist-alias.js b/src/page/artist-alias.js
index 1da2af41..d2305229 100644
--- a/src/page/artist-alias.js
+++ b/src/page/artist-alias.js
@@ -7,6 +7,12 @@ export function targets({wikiData}) {
 export function pathsForTarget(aliasArtist) {
   const {aliasedArtist} = aliasArtist;
 
+  // Don't generate a redirect page if this aliased name resolves to the same
+  // directory as the original artist! See issue #280.
+  if (aliasArtist.directory === aliasedArtist.directory) {
+    return [];
+  }
+
   return [
     {
       type: 'redirect',
diff --git a/src/strings-default.json b/src/strings-default.json
index b5e39e97..0ad7a516 100644
--- a/src/strings-default.json
+++ b/src/strings-default.json
@@ -437,15 +437,18 @@
   "listingPage.listTracks.inFlashes.byFlash.chunk.item": "{TRACK} (from {ALBUM})",
   "listingPage.listTracks.withLyrics.title": "Tracks - with Lyrics",
   "listingPage.listTracks.withLyrics.title.short": "...with Lyrics",
-  "listingPage.listTracks.withLyrics.chunk.title": "{ALBUM} ({DATE})",
+  "listingPage.listTracks.withLyrics.chunk.title": "{ALBUM}",
+  "listingPage.listTracks.withLyrics.chunk.title.withDate": "{ALBUM} ({DATE})",
   "listingPage.listTracks.withLyrics.chunk.item": "{TRACK}",
   "listingPage.listTracks.withSheetMusicFiles.title": "Tracks - with Sheet Music Files",
   "listingPage.listTracks.withSheetMusicFiles.title.short": "...with Sheet Music Files",
-  "listingPage.listTracks.withSheetMusicFiles.chunk.title": "{ALBUM} ({DATE})",
+  "listingPage.listTracks.withSheetMusicFiles.chunk.title": "{ALBUM}",
+  "listingPage.listTracks.withSheetMusicFiles.chunk.title.withDate": "{ALBUM} ({DATE})",
   "listingPage.listTracks.withSheetMusicFiles.chunk.item": "{TRACK}",
   "listingPage.listTracks.withMidiProjectFiles.title": "Tracks - with MIDI & Project Files",
   "listingPage.listTracks.withMidiProjectFiles.title.short": "...with MIDI & Project Files",
-  "listingPage.listTracks.withMidiProjectFiles.chunk.title": "{ALBUM} ({DATE})",
+  "listingPage.listTracks.withMidiProjectFiles.chunk.title": "{ALBUM}",
+  "listingPage.listTracks.withMidiProjectFiles.chunk.title.withDate": "{ALBUM} ({DATE})",
   "listingPage.listTracks.withMidiProjectFiles.chunk.item": "{TRACK}",
   "listingPage.listTags.byName.title": "Tags - by Name",
   "listingPage.listTags.byName.title.short": "...by Name",