@@ -5,6 +5,7 @@ import Article from "../models/article.ts";
|
||||
import Profile from "../models/profile.ts";
|
||||
import { articleHtml } from "../html.ts";
|
||||
import notFoundHandler from "../handlers/not-found.ts";
|
||||
import generateOgProfileImage from "../tasks/generate_og_profile_image.ts";
|
||||
|
||||
const userEventHandler = async function (ctx: Context) {
|
||||
const username = ctx.state.username.replace(/^(@|~)/, "");
|
||||
@@ -27,12 +28,13 @@ const userEventHandler = async function (ctx: Context) {
|
||||
const article = new Article(articleEvent);
|
||||
const profile = new Profile(profileEvent, username);
|
||||
const html = articleHtml(article, profile);
|
||||
generateOgProfileImage(profile);
|
||||
|
||||
ctx.response.body = html;
|
||||
} else {
|
||||
notFoundHandler(ctx);
|
||||
}
|
||||
} catch (_e) {
|
||||
} catch (e) {
|
||||
notFoundHandler(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,6 +5,7 @@ import Article from "../models/article.ts";
|
||||
import Profile from "../models/profile.ts";
|
||||
import { profilePageHtml } from "../html.ts";
|
||||
import notFoundHandler from "../handlers/not-found.ts";
|
||||
import generateOgProfileImage from "../tasks/generate_og_profile_image.ts";
|
||||
|
||||
const userProfileHandler = async function (ctx: Context) {
|
||||
const username = ctx.state.path.replace(/^(@|~)/, "");
|
||||
@@ -23,6 +24,7 @@ const userProfileHandler = async function (ctx: Context) {
|
||||
const articleEvents = await fetchArticlesByAuthor(pubkey);
|
||||
const articles = articleEvents.map((a) => new Article(a));
|
||||
const html = profilePageHtml(profile, articles);
|
||||
generateOgProfileImage(profile);
|
||||
|
||||
ctx.response.body = html;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user