Add associatedRecord to external embeds, if available (#10445)

This commit is contained in:
Eric Bailey
2026-05-07 19:08:29 -05:00
committed by GitHub
parent 9a2cabf64c
commit fa8c2224b7
6 changed files with 24 additions and 11 deletions
+1
View File
@@ -422,6 +422,7 @@ async function resolveMedia(
title: resolvedLink.title,
description: resolvedLink.description,
thumb: blob,
associatedRecord: resolvedLink.associatedRecord,
},
}
}
+7 -1
View File
@@ -7,7 +7,7 @@ import {
import {AtUri} from '@atproto/api'
import {POST_IMG_MAX} from '#/lib/constants'
import {getLinkMeta} from '#/lib/link-meta/link-meta'
import {getLinkMeta, type LinkMeta} from '#/lib/link-meta/link-meta'
import {resolveShortLink} from '#/lib/link-meta/resolve-short-link'
import {downloadAndResize} from '#/lib/media/manip'
import {
@@ -35,6 +35,11 @@ type ResolvedExternalLink = {
title: string
description: string
thumb: ComposerImage | undefined
/**
* The AT-URI of the Atmosphere record representing this external content, if
* it exists. Example: a site.standard.document record.
*/
associatedRecord?: LinkMeta['associatedRecord']
}
type ResolvedPostRecord = {
@@ -240,6 +245,7 @@ async function resolveExternal(
title: result.title ?? '',
description: result.description ?? '',
thumb: result.image ? await imageToThumb(result.image) : undefined,
associatedRecord: result.associatedRecord,
}
}
+5 -5
View File
@@ -2,7 +2,7 @@ import {type Insets, Platform} from 'react-native'
import {type AppBskyActorDefs, BSKY_LABELER_DID} from '@atproto/api'
import {type ProxyHeaderValue} from '#/state/session/agent'
import {BLUESKY_PROXY_DID, CHAT_PROXY_DID} from '#/env'
import {BLUESKY_PROXY_DID, CHAT_PROXY_DID, IS_DEV} from '#/env'
export const LOCAL_DEV_SERVICE =
Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583'
@@ -107,12 +107,12 @@ export const STAGING_LINK_META_PROXY =
export const PROD_LINK_META_PROXY = 'https://cardyb.bsky.app/v1/extract?url='
export function LINK_META_PROXY(serviceUrl: string) {
if (IS_PROD_SERVICE(serviceUrl)) {
return PROD_LINK_META_PROXY
export function LINK_META_PROXY(_serviceUrl: string) {
if (IS_DEV) {
return STAGING_LINK_META_PROXY
}
return STAGING_LINK_META_PROXY
return PROD_LINK_META_PROXY
}
export const STATUS_PAGE_URL = 'https://status.bsky.app/'
+6
View File
@@ -22,6 +22,11 @@ export interface LinkMeta {
title?: string
description?: string
image?: string
/**
* The AT-URI of the Atmosphere record representing this external content, if
* it exists. Example: a site.standard.document record.
*/
associatedRecord?: string
}
export async function getLinkMeta(
@@ -89,6 +94,7 @@ export async function getLinkMeta(
meta.description = body.description
meta.image = body.image
meta.title = body.title
meta.associatedRecord = body.associated_record
if (shouldFollowRedirect) {
meta.url = body.url
}