card: sane defaults
This commit is contained in:
parent
b6ce22cfaf
commit
78b1c24ee0
|
@ -173,7 +173,7 @@ interface PreviewCard {
|
||||||
async function unfurlCard(url: string): Promise<PreviewCard | null> {
|
async function unfurlCard(url: string): Promise<PreviewCard | null> {
|
||||||
console.log(`Unfurling ${url}...`);
|
console.log(`Unfurling ${url}...`);
|
||||||
try {
|
try {
|
||||||
const result = await unfurl(url, { fetch });
|
const result = await unfurl(url, { fetch, follow: 2, timeout: 1000, size: 1024 * 1024 });
|
||||||
return {
|
return {
|
||||||
type: result.oEmbed?.type || 'link',
|
type: result.oEmbed?.type || 'link',
|
||||||
url: result.canonical_url || url,
|
url: result.canonical_url || url,
|
||||||
|
@ -187,7 +187,7 @@ async function unfurlCard(url: string): Promise<PreviewCard | null> {
|
||||||
html: result.oEmbed?.html || '',
|
html: result.oEmbed?.html || '',
|
||||||
width: result.oEmbed?.width || 0,
|
width: result.oEmbed?.width || 0,
|
||||||
height: result.oEmbed?.height || 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: '',
|
embed_url: '',
|
||||||
blurhash: null,
|
blurhash: null,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue