From 7b219c57827f78b5b7783bd1ab4a1d9df78f740f Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 6 Mar 2022 22:36:08 -0400 Subject: move custom bc/masto domains into consts (for now) --- src/misc-templates.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src') 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`${ 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')] : -- cgit 1.3.0-6-gf8a5