unfurl: fix missing import, debug errors
This commit is contained in:
parent
5cbfbe5eaa
commit
e01383629e
|
@ -1,4 +1,4 @@
|
||||||
import { Debug, TTLCache, unfurl } from '@/deps.ts';
|
import { Debug, sanitizeHtml, TTLCache, unfurl } from '@/deps.ts';
|
||||||
import { Time } from '@/utils/time.ts';
|
import { Time } from '@/utils/time.ts';
|
||||||
import { fetchWorker } from '@/workers/fetch.ts';
|
import { fetchWorker } from '@/workers/fetch.ts';
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
|
||||||
type: result.oEmbed?.type || 'link',
|
type: result.oEmbed?.type || 'link',
|
||||||
url: result.canonical_url || url,
|
url: result.canonical_url || url,
|
||||||
title: result.oEmbed?.title || result.title || '',
|
title: result.oEmbed?.title || result.title || '',
|
||||||
description: result.open_graph.description || result.description || '',
|
description: result.open_graph?.description || result.description || '',
|
||||||
author_name: result.oEmbed?.author_name || '',
|
author_name: result.oEmbed?.author_name || '',
|
||||||
author_url: result.oEmbed?.author_url || '',
|
author_url: result.oEmbed?.author_url || '',
|
||||||
provider_name: result.oEmbed?.provider_name || '',
|
provider_name: result.oEmbed?.provider_name || '',
|
||||||
|
@ -46,11 +46,12 @@ async function unfurlCard(url: string, signal: AbortSignal): Promise<PreviewCard
|
||||||
}),
|
}),
|
||||||
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 || result.open_graph.images?.[0].url || null,
|
image: result.oEmbed?.thumbnails?.[0].url || result.open_graph?.images?.[0].url || null,
|
||||||
embed_url: '',
|
embed_url: '',
|
||||||
blurhash: null,
|
blurhash: null,
|
||||||
};
|
};
|
||||||
} catch (_e) {
|
} catch (e) {
|
||||||
|
debug(e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue