Generate profile image for feeds if missing

This commit is contained in:
Râu Cao 2025-06-03 11:23:46 +04:00
parent 91eff4ad07
commit b307d4de03
Signed by: raucao
GPG Key ID: 37036C356E56CC51

View File

@ -4,6 +4,7 @@ import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts";
import { profileAtomFeed } from "../feeds.ts"; import { profileAtomFeed } from "../feeds.ts";
import Profile from "../models/profile.ts"; import Profile from "../models/profile.ts";
import { notFoundHandler } from "../handlers/errors.ts"; import { notFoundHandler } from "../handlers/errors.ts";
import { generateOgProfileImage } from "../magick.ts";
const userAtomFeedHandler = async function (ctx: Context) { const userAtomFeedHandler = async function (ctx: Context) {
const username = ctx.state.username; const username = ctx.state.username;
@ -20,6 +21,7 @@ const userAtomFeedHandler = async function (ctx: Context) {
const profile = new Profile(profileEvent, username); const profile = new Profile(profileEvent, username);
if (profile.nip05) { if (profile.nip05) {
await generateOgProfileImage(profile);
const articles = await fetchArticlesByAuthor(pubkey, 10); const articles = await fetchArticlesByAuthor(pubkey, 10);
const atom = await profileAtomFeed(profile, articles); const atom = await profileAtomFeed(profile, articles);