mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
use Object.assign to fill template opts
This commit is contained in:
parent
af70065d84
commit
f48d8e0a66
1 changed files with 10 additions and 7 deletions
|
|
@ -43,17 +43,20 @@ async function buildTemplateOpts(params: PathParams, url: string): Promise<OpenG
|
||||||
console.log(key);
|
console.log(key);
|
||||||
const profile = await fetchProfile({ [key]: params.acct });
|
const profile = await fetchProfile({ [key]: params.acct });
|
||||||
const handle = await getHandle(params.acct, profile);
|
const handle = await getHandle(params.acct, profile);
|
||||||
res.type = 'profile';
|
|
||||||
res.title = `View @${handle}'s profile on Ditto`;
|
Object.assign(res, {
|
||||||
res.description = profile.meta.about || `@${handle}'s Nostr profile`;
|
type: 'profile',
|
||||||
|
title: `View @${handle}'s profile on Ditto`,
|
||||||
|
description: profile.meta.about || `@${handle}'s Nostr profile`,
|
||||||
|
});
|
||||||
|
|
||||||
if (profile.meta.picture) {
|
if (profile.meta.picture) {
|
||||||
res.image = { url: profile.meta.picture, h: 150, w: 150 };
|
Object.assign(res, { image: { url: profile.meta.picture, h: 150, w: 150 } });
|
||||||
}
|
}
|
||||||
} else if (params.statusId) {
|
} else if (params.statusId) {
|
||||||
const { description, image, title } = await getStatusInfo(params.statusId);
|
const { description, image, title } = await getStatusInfo(params.statusId);
|
||||||
res.description = description;
|
Object.assign(res, { description, title });
|
||||||
res.image = image;
|
if (image) Object.assign(res, { image });
|
||||||
res.title = title;
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.debug('Error getting OpenGraph metadata information:');
|
console.debug('Error getting OpenGraph metadata information:');
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue