From 30cfee2caaeaaf78da9c11618f67bed5afb98368 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 30 Mar 2024 13:14:12 -0300 Subject: external-links: regex cleanup --- src/util/external-links.js | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/util') diff --git a/src/util/external-links.js b/src/util/external-links.js index 5df4f7d..52309d9 100644 --- a/src/util/external-links.js +++ b/src/util/external-links.js @@ -220,7 +220,7 @@ export const externalLinkSpec = [ match: {domain: 'artstation.com'}, platform: 'artstation', - handle: {pathname: /^[^/]+/}, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'globe', }, @@ -248,7 +248,7 @@ export const externalLinkSpec = [ match: {domain: '.bandcamp.com'}, platform: 'bandcamp', - handle: {domain: /^[^.]*/}, + handle: {domain: /^[^.]+/}, icon: 'bandcamp', }, @@ -266,7 +266,7 @@ export const externalLinkSpec = [ match: {domain: '.carrd.co'}, platform: 'carrd', - handle: {domain: /^[^.]*/}, + handle: {domain: /^[^.]+/}, icon: 'carrd', }, @@ -296,7 +296,7 @@ export const externalLinkSpec = [ match: {domain: 'deviantart.com'}, platform: 'deviantart', - handle: {pathname: /^[^/]+\/?$/}, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'deviantart', }, @@ -397,7 +397,7 @@ export const externalLinkSpec = [ match: {domain: 'instagram.com'}, platform: 'instagram', - handle: {pathname: /^[^/]+/}, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'instagram', }, @@ -419,7 +419,7 @@ export const externalLinkSpec = [ match: {domain: '.itch.io'}, platform: 'itch', - handle: {domain: /^[^.]*/}, + handle: {domain: /^[^.]+/}, icon: 'itch', }, @@ -428,7 +428,7 @@ export const externalLinkSpec = [ match: {domain: 'itch.io'}, platform: 'itch', - handle: {pathname: /^profile\/(.+)\/?$/}, + handle: {pathname: /^profile\/([^/]+)\/?$/}, icon: 'itch', }, @@ -437,7 +437,7 @@ export const externalLinkSpec = [ match: {domain: 'ko-fi.com'}, platform: 'kofi', - handle: {pathname: /^(.+)\/?/}, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'kofi', }, @@ -489,7 +489,7 @@ export const externalLinkSpec = [ match: {domain: 'patreon.com'}, platform: 'patreon', - handle: {pathname: /([^/]+)\/?$/}, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'globe', }, @@ -510,11 +510,17 @@ export const externalLinkSpec = [ match: {domain: 'soundcloud.com'}, platform: 'soundcloud', - handle: /([^/]*)\/?$/, + handle: {pathname: /^([^/]+)\/?$/}, icon: 'soundcloud', }, + { + match: {domain: 'soundcloud.com'}, + platform: 'soundcloud', + icon: 'soundcloud', + }, + { match: {domains: ['spotify.com', 'open.spotify.com']}, platform: 'spotify', @@ -525,7 +531,7 @@ export const externalLinkSpec = [ match: {domain: 'tiktok.com'}, platform: 'tiktok', - handle: {pathname: /^@?([a-zA-Z0-9_]*)\/?$/}, + handle: {pathname: /^@?([^/]+)\/?$/}, icon: 'tiktok', }, @@ -534,7 +540,7 @@ export const externalLinkSpec = [ match: {domain: '.tumblr.com'}, platform: 'tumblr', - handle: {domain: /^[^.]*/}, + handle: {domain: /^[^.]+/}, icon: 'tumblr', }, @@ -567,7 +573,7 @@ export const externalLinkSpec = [ match: {domain: 'twitter.com'}, platform: 'twitter', - handle: {pathname: /^@?([a-zA-Z0-9_]*)\/?$/}, + handle: {pathname: /^@?([^/]+)\/?$/}, icon: 'twitter', }, -- cgit 1.3.0-6-gf8a5