« get me outta code hell

move custom bc/masto domains into consts (for now) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2022-03-06 22:36:08 -0400
committer(quasar) nebula <qznebula@protonmail.com>2022-03-06 22:36:20 -0400
commit7b219c57827f78b5b7783bd1ab4a1d9df78f740f (patch)
tree6afb244ac47479c1bd122980ff5e9472da770ee9
parent9f799b4d116ed0fd14fe4a5a03bd8fc16b93c39b (diff)
move custom bc/masto domains into consts (for now)
-rw-r--r--src/misc-templates.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/misc-templates.js b/src/misc-templates.js
index d9b3f33d..306063b9 100644
--- a/src/misc-templates.js
+++ b/src/misc-templates.js
@@ -23,6 +23,15 @@ import {
     sortByDate
 } from './util/wiki-data.js';
 
+const BANDCAMP_DOMAINS = [
+    'bc.s3m.us',
+    'music.solatrux.com',
+];
+
+const MASTODON_DOMAINS = [
+    'types.pl',
+];
+
 // Artist strings
 
 export function getArtistString(artists, {
@@ -211,12 +220,8 @@ export function fancifyURL(url, {strings, album = false} = {}) {
     return fixWS`<a href="${url}" class="nowrap">${
         domain === local ? strings('misc.external.local') :
         domain.includes('bandcamp.com') ? strings('misc.external.bandcamp') :
-        [
-            'music.solatrux.com'
-        ].includes(domain) ? strings('misc.external.bandcamp.domain', {domain}) :
-        [
-            'types.pl'
-        ].includes(domain) ? strings('misc.external.mastodon.domain', {domain}) :
+        BANDCAMP_DOMAINS.includes(domain) ? strings('misc.external.bandcamp.domain', {domain}) :
+        MASTODON_DOMAINS.includes(domain) ? strings('misc.external.mastodon.domain', {domain}) :
         domain.includes('youtu') ? (album
             ? (url.includes('list=')
                 ? strings('misc.external.youtube.playlist')
@@ -250,12 +255,8 @@ export function iconifyURL(url, {strings, to}) {
     const domain = new URL(url).hostname;
     const [ id, msg ] = (
         domain.includes('bandcamp.com') ? ['bandcamp', strings('misc.external.bandcamp')] :
-        (
-            domain.includes('music.solatrus.com')
-        ) ? ['bandcamp', strings('misc.external.bandcamp.domain', {domain})] :
-        (
-            domain.includes('types.pl')
-        ) ? ['mastodon', strings('misc.external.mastodon.domain', {domain})] :
+        BANDCAMP_DOMAINS.includes(domain) ? ['bandcamp', strings('misc.external.bandcamp.domain', {domain})] :
+        MASTODON_DOMAINS.includes(domain) ? ['mastodon', strings('misc.external.mastodon.domain', {domain})] :
         domain.includes('youtu') ? ['youtube', strings('misc.external.youtube')] :
         domain.includes('soundcloud') ? ['soundcloud', strings('misc.external.soundcloud')] :
         domain.includes('tumblr.com') ? ['tumblr', strings('misc.external.tumblr')] :