« get me outta code hell

simple support for local track upload URLs - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/misc-templates.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-09-01 10:12:16 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-09-01 10:12:16 -0300
commit1dba85f7db7f221bb285012a25f37193724b19d6 (patch)
treebcef13396803697f93512045a410921756762829 /src/misc-templates.js
parent9ff95d1c338d8a194c91d90b3f8fccf59442da03 (diff)
simple support for local track upload URLs
Diffstat (limited to 'src/misc-templates.js')
-rw-r--r--src/misc-templates.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index 139978d..a6b39b9 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -199,8 +199,17 @@ export function getAlbumStylesheet(album, {to}) {
 // Fancy lookin' links
 
 export function fancifyURL(url, {strings, album = false} = {}) {
-    const domain = new URL(url).hostname;
+    let local = Symbol();
+    let domain;
+    try {
+        domain = new URL(url).hostname;
+    } catch (error) {
+        // No support for relative local URLs yet, sorry! (I.e, local URLs must
+        // be absolute relative to the domain name in order to work.)
+        domain = local;
+    }
     return fixWS`<a href="${url}" class="nowrap">${
+        domain === local ? strings('misc.external.local') :
         domain.includes('bandcamp.com') ? strings('misc.external.bandcamp') :
         [
             'music.solatrux.com'