This commit is contained in:
Eric Bailey
2026-05-21 13:22:17 -05:00
parent 1adfdb4a15
commit 21c9e5c38a
23 changed files with 787 additions and 434 deletions
+1
View File
@@ -442,6 +442,7 @@ async function resolveMedia(
title: resolvedLink.title,
description: resolvedLink.description,
thumb: blob,
associatedRefs: resolvedLink.associatedRefs,
},
}
}
+4 -8
View File
@@ -26,7 +26,6 @@ import {
} from '#/lib/strings/url-helpers'
import {type ComposerImage} from '#/state/gallery'
import {createComposerImage} from '#/state/gallery'
import {type PublicationViewExternalSource} from '#/components/Post/Embed/ExternalEmbed/PublicationEmbed/types'
import {type Gif} from '#/features/gifPicker/types'
import {createGIFDescription} from '../gif-alt-text'
@@ -40,12 +39,8 @@ type ResolvedExternalLink = {
* The AT-URI of the Atmosphere record representing this external content, if
* it exists. Example: a site.standard.document record.
*/
associatedRecord?: LinkMeta['associatedRecord']
// APP-2160 / APP-2155: populated by Cardyb when the URL resolves to a
// standard.site publication. Until APP-2155 ships these stay undefined.
source?: PublicationViewExternalSource
createdAt?: string
readingTime?: number
associatedRefs?: LinkMeta['associatedRefs']
view?: LinkMeta['view']
}
type ResolvedPostRecord = {
@@ -251,7 +246,8 @@ async function resolveExternal(
title: result.title ?? '',
description: result.description ?? '',
thumb: result.image ? await imageToThumb(result.image) : undefined,
associatedRecord: result.associatedRecord,
associatedRefs: result.associatedRefs,
view: result.view,
}
}
+5 -3
View File
@@ -1,4 +1,4 @@
import {type BskyAgent} from '@atproto/api'
import {type AppBskyEmbedExternal, type BskyAgent} from '@atproto/api'
import {LINK_META_PROXY} from '#/lib/constants'
import {getGiphyMetaUri} from '#/lib/strings/embed-player'
@@ -26,7 +26,8 @@ export interface LinkMeta {
* The AT-URI of the Atmosphere record representing this external content, if
* it exists. Example: a site.standard.document record.
*/
associatedRecord?: string
associatedRefs?: AppBskyEmbedExternal.External['associatedRefs']
view?: AppBskyEmbedExternal.View
}
export async function getLinkMeta(
@@ -94,7 +95,8 @@ export async function getLinkMeta(
meta.description = body.description
meta.image = body.image
meta.title = body.title
meta.associatedRecord = body.associated_record
meta.associatedRefs = body.associated_refs
meta.view = body.view || body.external_view
if (shouldFollowRedirect) {
meta.url = body.url
}
+4 -2
View File
@@ -5,21 +5,23 @@ export function niceDate(
i18n: I18n,
date: number | string | Date,
dateStyle: 'short' | 'medium' | 'long' | 'full' | 'dot separated' = 'long',
timeStyle: 'short' | 'medium' | 'long' | 'full' | 'none' = 'short',
) {
const ts = timeStyle === 'none' ? undefined : timeStyle
const d = new Date(date)
if (dateStyle === 'dot separated') {
return i18n._(
msg({
context: 'date and time formatted like this: [time] · [date]',
message: `${i18n.date(d, {timeStyle: 'short'})} · ${i18n.date(d, {dateStyle: 'medium'})}`,
message: `${i18n.date(d, {timeStyle: ts})} · ${i18n.date(d, {dateStyle: 'medium'})}`,
}),
)
}
return i18n.date(d, {
dateStyle,
timeStyle: 'short',
timeStyle: ts,
})
}