a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle quotes in recordWithMedia embeds

+13 -3
+13 -3
appview/index.ts
··· 12 12 } from "lexicons/api"; 13 13 import { 14 14 AppBskyEmbedExternal, 15 + AppBskyEmbedRecordWithMedia, 15 16 AppBskyFeedPost, 16 17 AppBskyRichtextFacet, 17 18 } from "@atproto/api"; ··· 186 187 let record = AppBskyFeedPost.validateRecord(evt.record); 187 188 if (!record.success) return; 188 189 189 - let embed = 190 + let embed: string | null = null; 191 + if ( 190 192 AppBskyEmbedExternal.isMain(record.value.embed) && 191 193 record.value.embed.external.uri.includes(QUOTE_PARAM) 192 - ? record.value.embed.external.uri 193 - : null; 194 + ) { 195 + embed = record.value.embed.external.uri; 196 + } 197 + if ( 198 + AppBskyEmbedRecordWithMedia.isMain(record.value.embed) && 199 + AppBskyEmbedExternal.isMain(record.value.embed.media) && 200 + record.value.embed.media?.external?.uri.includes(QUOTE_PARAM) 201 + ) { 202 + embed = record.value.embed.media.external.uri; 203 + } 194 204 if (embed) { 195 205 console.log( 196 206 "processing post mention: " + embed + " in " + evt.uri.toString(),