a tool for shared writing and social publishing

avoid stringify in appview for embed processing

+9 -4
+9 -4
appview/index.ts
··· 179 179 ) 180 180 return; 181 181 182 - // Quick check if embed might contain our quote param 183 - const embedStr = JSON.stringify(evt.record.embed); 184 - if (!embedStr.includes(QUOTE_PARAM)) return; 182 + // Check if embed contains our quote param using optional chaining 183 + const embedRecord = evt.record as any; 184 + const hasQuoteParam = 185 + embedRecord.embed?.external?.uri?.includes(QUOTE_PARAM) || 186 + embedRecord.embed?.media?.external?.uri?.includes(QUOTE_PARAM); 187 + 188 + if (!hasQuoteParam) return; 189 + console.log("FOUND EMBED!!!"); 185 190 186 - // Now validate the record since we know it might be relevant 191 + // Now validate the record since we know it contains our quote param 187 192 let record = AppBskyFeedPost.validateRecord(evt.record); 188 193 if (!record.success) return; 189 194