about summary refs log tree commit diff
path: root/src/lib/strings/url-helpers.ts
diff options
context:
space:
mode:
authorMinseo Lee <itoupluk427@gmail.com>2024-03-07 11:19:50 +0900
committerGitHub <noreply@github.com>2024-03-07 11:19:50 +0900
commite74c46e9ab480959c4416f83a78289e460bdeec7 (patch)
treec770265051354782bb6e779905e0351cc8f8abd9 /src/lib/strings/url-helpers.ts
parentf3db23a3b14e9444cb499c727b9d62c414e5a840 (diff)
parent8b0e575f6423575c08e9a6748be41c888611d631 (diff)
downloadvoidsky-e74c46e9ab480959c4416f83a78289e460bdeec7.tar.zst
Merge branch 'main' into patch-3
Diffstat (limited to 'src/lib/strings/url-helpers.ts')
-rw-r--r--src/lib/strings/url-helpers.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/strings/url-helpers.ts b/src/lib/strings/url-helpers.ts
index ba2cdb39b..7729e4a38 100644
--- a/src/lib/strings/url-helpers.ts
+++ b/src/lib/strings/url-helpers.ts
@@ -148,6 +148,11 @@ export function feedUriToHref(url: string): string {
 export function linkRequiresWarning(uri: string, label: string) {
   const labelDomain = labelToDomain(label)
 
+  // If the uri started with a / we know it is internal.
+  if (uri.startsWith('/')) {
+    return false
+  }
+
   let urip
   try {
     urip = new URL(uri)
@@ -156,9 +161,12 @@ export function linkRequiresWarning(uri: string, label: string) {
   }
 
   const host = urip.hostname.toLowerCase()
-
   // Hosts that end with bsky.app or bsky.social should be trusted by default.
-  if (host.endsWith('bsky.app') || host.endsWith('bsky.social')) {
+  if (
+    host.endsWith('bsky.app') ||
+    host.endsWith('bsky.social') ||
+    host.endsWith('blueskyweb.xyz')
+  ) {
     // if this is a link to internal content,
     // warn if it represents itself as a URL to another app
     return !!labelDomain && labelDomain !== host && isPossiblyAUrl(labelDomain)