This commit is contained in:
2024-10-21 15:17:14 +02:00
parent 87792c5089
commit fa98e90210
20 changed files with 462 additions and 91 deletions

View File

@@ -1,10 +1,9 @@
import { Context } from "@oak/oak";
import { log } from "../log.ts";
import { lookupPubkeyByUsername } from "../ldap.ts";
import {
fetchProfileEvent,
fetchReplaceableEvent,
} from "../nostr.ts";
import { fetchProfileEvent, fetchReplaceableEvent } from "../nostr.ts";
import Article from "../models/article.ts";
import Profile from "../models/profile.ts";
import { articleHtml } from "../html.ts";
const userEventHandler = async function (ctx: Context) {
@@ -24,11 +23,11 @@ const userEventHandler = async function (ctx: Context) {
identifier,
);
const profileEvent = await fetchProfileEvent(pubkey);
let profile;
if (articleEvent && profileEvent) {
profile = JSON.parse(profileEvent.content);
const html = articleHtml(articleEvent, profile);
const article = new Article(articleEvent);
const profile = new Profile(profileEvent, username);
const html = articleHtml(article, profile);
ctx.response.body = html;
} else {