From 1dba85f7db7f221bb285012a25f37193724b19d6 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 1 Sep 2021 10:12:16 -0300 Subject: simple support for local track upload URLs --- src/misc-templates.js | 11 ++++++++++- src/strings-default.json | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/misc-templates.js b/src/misc-templates.js index 139978d8..a6b39b99 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`${ + domain === local ? strings('misc.external.local') : domain.includes('bandcamp.com') ? strings('misc.external.bandcamp') : [ 'music.solatrux.com' diff --git a/src/strings-default.json b/src/strings-default.json index c5132c0a..b80c99f6 100644 --- a/src/strings-default.json +++ b/src/strings-default.json @@ -114,6 +114,7 @@ "misc.chronology.heading.flash": "{INDEX} flash/game by {ARTIST}", "misc.chronology.heading.track": "{INDEX} track by {ARTIST}", "misc.external.domain": "External ({DOMAIN})", + "misc.external.local": "Wiki Archive (local upload)", "misc.external.bandcamp": "Bandcamp", "misc.external.bandcamp.domain": "Bandcamp ({DOMAIN})", "misc.external.deviantart": "DeviantArt", -- cgit 1.3.0-6-gf8a5