diff --git a/src/components/PdsBadge.tsx b/src/components/PdsBadge.tsx --- a/src/components/PdsBadge.tsx +++ b/src/components/PdsBadge.tsx @@ -1,5 +1,5 @@ import {View} from 'react-native' -import {msg} from '@lingui/macro' +import {msg} from '@lingui/core/macro' import {useLingui} from '@lingui/react' import { @@ -32,8 +32,7 @@ ) const isBskyHandle = - !!handle && - (handle.endsWith('.bsky.social') || handle === 'bsky.social') + !!handle && (handle.endsWith('.bsky.social') || handle === 'bsky.social') if (!enabled) return null if (isLoading) return diff --git a/src/components/PdsDialog.tsx b/src/components/PdsDialog.tsx --- a/src/components/PdsDialog.tsx +++ b/src/components/PdsDialog.tsx @@ -84,9 +84,11 @@ {isBridged ? Fediverse : displayName} } - - {isBsky && Bluesky Social} - + {isBsky && + + Bluesky Social + + } @@ -138,8 +140,8 @@ {' '} about what a PDS is and how to{' '} self-host {' '} diff --git a/src/state/queries/pds-label.ts b/src/state/queries/pds-label.ts --- a/src/state/queries/pds-label.ts +++ b/src/state/queries/pds-label.ts @@ -55,7 +55,7 @@ return `${origin}/${href}` } -async function fetchFaviconUrl(pdsUrl: string): Promise { +async function getFaviconUrl(pdsUrl: string): Promise { let origin = '' try { origin = new URL(pdsUrl).origin @@ -136,7 +136,12 @@ if (ok) return url } - return undefined + try { + const hostname = new URL(pdsUrl).hostname + return `https://favicon.im/${hostname}?throw-error-on-404=true` + } catch { + return undefined + } } export const RQKEY_ROOT = 'pds-label' @@ -165,7 +170,7 @@ queryKey: RQKEY_FAVICON(pdsUrl ?? ''), queryFn: async () => { if (!pdsUrl) return undefined - return await fetchFaviconUrl(pdsUrl) + return await getFaviconUrl(pdsUrl) }, enabled: !!pdsUrl, staleTime: 1000 * 60 * 60, // 1 hour