mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
fix: return undefined in case unfurlCardCached request fails
This commit is contained in:
parent
b09bcd33df
commit
135657dbb4
1 changed files with 6 additions and 1 deletions
|
|
@ -56,7 +56,12 @@ export const nodeInfoCache = new SimpleLRU<Domain, NodeInfoV1>(
|
||||||
export async function fetchDittoDomain(domain: string): Promise<DittoTables['ditto_domains'] | undefined> {
|
export async function fetchDittoDomain(domain: string): Promise<DittoTables['ditto_domains'] | undefined> {
|
||||||
const total_users = (await nodeInfoCache.fetch(domain)).usage.users.total;
|
const total_users = (await nodeInfoCache.fetch(domain)).usage.users.total;
|
||||||
|
|
||||||
const { title, description, image } = (await unfurlCardCached(`https://${domain}`)) ?? { title: '', description: '' };
|
const result = await unfurlCardCached(`https://${domain}`);
|
||||||
|
if (!result) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { title, description, image } = result;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
domain,
|
domain,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue