Bluesky app fork with some witchin' additions 💫

fix(pds badge): favicon fetching & dialog link

xan.lol 4f10f44e 719154b3

verified
+17 -11
+2 -3
src/components/PdsBadge.tsx
··· 1 1 import {View} from 'react-native' 2 - import {msg} from '@lingui/macro' 2 + import {msg} from '@lingui/core/macro' 3 3 import {useLingui} from '@lingui/react' 4 4 5 5 import { ··· 32 32 ) 33 33 34 34 const isBskyHandle = 35 - !!handle && 36 - (handle.endsWith('.bsky.social') || handle === 'bsky.social') 35 + !!handle && (handle.endsWith('.bsky.social') || handle === 'bsky.social') 37 36 38 37 if (!enabled) return null 39 38 if (isLoading) return <PdsBadgeLoading size={size} isBsky={isBskyHandle} />
+7 -5
src/components/PdsDialog.tsx
··· 84 84 {isBridged ? <Trans>Fediverse</Trans> : displayName} 85 85 </Text> 86 86 } 87 - <Text style={[a.text_sm, a.leading_tight]}> 88 - {isBsky && <Trans>Bluesky Social</Trans>} 89 - </Text> 87 + {isBsky && 88 + <Text style={[a.text_sm, a.leading_tight]}> 89 + <Trans>Bluesky Social</Trans> 90 + </Text> 91 + } 90 92 </View> 91 93 </View> 92 94 ··· 138 140 </InlineLinkText>{' '} 139 141 about what a PDS is and how to{' '} 140 142 <InlineLinkText 141 - to="https://atproto.com/guides/glossary#pds-personal-data-server" 142 - label="PDS Glossary definition" 143 + to="https://atproto.com/guides/self-hosting#pds" 144 + label="Self-hosting PDS documentation" 143 145 style={[a.text_md, a.font_semi_bold]}> 144 146 self-host 145 147 </InlineLinkText>{' '}
+8 -3
src/state/queries/pds-label.ts
··· 55 55 return `${origin}/${href}` 56 56 } 57 57 58 - async function fetchFaviconUrl(pdsUrl: string): Promise<string | undefined> { 58 + async function getFaviconUrl(pdsUrl: string): Promise<string | undefined> { 59 59 let origin = '' 60 60 try { 61 61 origin = new URL(pdsUrl).origin ··· 136 136 if (ok) return url 137 137 } 138 138 139 - return undefined 139 + try { 140 + const hostname = new URL(pdsUrl).hostname 141 + return `https://favicon.im/${hostname}?throw-error-on-404=true` 142 + } catch { 143 + return undefined 144 + } 140 145 } 141 146 142 147 export const RQKEY_ROOT = 'pds-label' ··· 165 170 queryKey: RQKEY_FAVICON(pdsUrl ?? ''), 166 171 queryFn: async () => { 167 172 if (!pdsUrl) return undefined 168 - return await fetchFaviconUrl(pdsUrl) 173 + return await getFaviconUrl(pdsUrl) 169 174 }, 170 175 enabled: !!pdsUrl, 171 176 staleTime: 1000 * 60 * 60, // 1 hour