« get me outta code hell

external-links: regex cleanup - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-03-30 13:14:12 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-03-30 13:19:53 -0300
commit30cfee2caaeaaf78da9c11618f67bed5afb98368 (patch)
tree4c71c27fc0f65d312faed1fad02ecc80c97ac31e /src/util
parent2a2da579eea65cde8dc5ba52421ae0822c729eab (diff)
external-links: regex cleanup
Diffstat (limited to 'src/util')
-rw-r--r--src/util/external-links.js32
1 files changed, 19 insertions, 13 deletions
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,12 +510,18 @@ 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',
     icon: 'globe',
@@ -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',
   },