about summary refs log tree commit diff
path: root/src/lib/strings/url-helpers.ts
diff options
context:
space:
mode:
authorJan-Olof Eriksson <jan-olof.eriksson@iki.fi>2024-03-04 18:11:00 +0200
committerGitHub <noreply@github.com>2024-03-04 18:11:00 +0200
commite724ab812346b4224b3efb2de0960f2cda88861b (patch)
tree9192c98b2b0b4be3388019b15b02a5d7df7fcce2 /src/lib/strings/url-helpers.ts
parent963a44ab872a1044d6997a8fcf7b2fc754ac618a (diff)
parentb70c404d4b369d6fab0dfbafd6b31390ffd20014 (diff)
downloadvoidsky-e724ab812346b4224b3efb2de0960f2cda88861b.tar.zst
Merge branch 'bluesky-social:main' into main
Diffstat (limited to 'src/lib/strings/url-helpers.ts')
-rw-r--r--src/lib/strings/url-helpers.ts12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts
index ef341154d..ba2cdb39b 100644
--- a/src/lib/strings/url-helpers.ts
+++ b/src/lib/strings/url-helpers.ts
@@ -157,17 +157,11 @@ export function linkRequiresWarning(uri: string, label: string) {
 
   const host = urip.hostname.toLowerCase()
 
-  if (host === 'bsky.app') {
+  // Hosts that end with bsky.app or bsky.social should be trusted by default.
+  if (host.endsWith('bsky.app') || host.endsWith('bsky.social')) {
     // if this is a link to internal content,
     // warn if it represents itself as a URL to another app
-    if (
-      labelDomain &&
-      labelDomain !== 'bsky.app' &&
-      isPossiblyAUrl(labelDomain)
-    ) {
-      return true
-    }
-    return false
+    return !!labelDomain && labelDomain !== host && isPossiblyAUrl(labelDomain)
   } else {
     // if this is a link to external content,
     // warn if the label doesnt match the target