card: sane defaults

This commit is contained in:
Alex Gleason 2023-05-06 20:09:33 -05:00
parent b6ce22cfaf
commit 78b1c24ee0
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 2 deletions

View File

@ -173,7 +173,7 @@ interface PreviewCard {
async function unfurlCard(url: string): Promise<PreviewCard | null> {
console.log(`Unfurling ${url}...`);
try {
const result = await unfurl(url, { fetch });
const result = await unfurl(url, { fetch, follow: 2, timeout: 1000, size: 1024 * 1024 });
return {
type: result.oEmbed?.type || 'link',
url: result.canonical_url || url,
@ -187,7 +187,7 @@ async function unfurlCard(url: string): Promise<PreviewCard | null> {
html: result.oEmbed?.html || '',
width: result.oEmbed?.width || 0,
height: result.oEmbed?.height || 0,
image: result.oEmbed?.thumbnails?.[0].url || null,
image: result.oEmbed?.thumbnails?.[0].url || result.open_graph.images?.[0].url || null,
embed_url: '',
blurhash: null,
};