diff options
author | Hailey <me@haileyok.com> | 2024-02-29 15:23:28 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 15:23:28 -0800 |
commit | 39d324ab8bd99ca0e19f3e8f4dea5a61d54e6bb4 (patch) | |
tree | e6276c84d60886234df8f8363a37bbedaab6ca5f /src/lib/strings/url-helpers.ts | |
parent | 1a5afccdb809d7a8a2e9ebb356b499135a5ff175 (diff) | |
download | voidsky-39d324ab8bd99ca0e19f3e8f4dea5a61d54e6bb4.tar.zst |
Fix link warnings (#3058)
* fix problems where www.bsky.app shows as a potential danger * never default to disabling warning * remove more defaults * update storybook cases * oops * reverse
Diffstat (limited to 'src/lib/strings/url-helpers.ts')
-rw-r--r-- | src/lib/strings/url-helpers.ts | 12 |
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 |