Show list of linked articles on profile page
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import { Context } from "@oak/oak";
|
||||
import { nip19 } from "@nostr/tools";
|
||||
import { log } from "../log.ts";
|
||||
import { articleHtml } from "../html.ts"
|
||||
import {
|
||||
fetchReplaceableEvent,
|
||||
fetchProfileEvent
|
||||
} from "../nostr.ts";
|
||||
import { articleHtml } from "../html.ts";
|
||||
import { fetchProfileEvent, fetchReplaceableEvent } from "../nostr.ts";
|
||||
|
||||
const naddrHandler = async function (ctx: Context) {
|
||||
const { request } = ctx;
|
||||
@@ -13,7 +10,10 @@ const naddrHandler = async function (ctx: Context) {
|
||||
|
||||
try {
|
||||
const r = nip19.decode(naddr);
|
||||
const articleEvent = await fetchReplaceableEvent(r.data.pubkey, r.data.identifier);
|
||||
const articleEvent = await fetchReplaceableEvent(
|
||||
r.data.pubkey,
|
||||
r.data.identifier,
|
||||
);
|
||||
const profileEvent = await fetchProfileEvent(r.data.pubkey);
|
||||
let profile;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { nip19 } from "@nostr/tools";
|
||||
import { log } from "../log.ts";
|
||||
import { lookupUsernameByPubkey } from "../ldap.ts";
|
||||
import { fetchProfileEvent } from "../nostr.ts";
|
||||
import { profilePageHtml } from "../html.ts"
|
||||
import { profilePageHtml } from "../html.ts";
|
||||
|
||||
const nprofileHandler = async function (ctx: Context) {
|
||||
const { request } = ctx;
|
||||
|
||||
@@ -3,7 +3,7 @@ import { nip19 } from "@nostr/tools";
|
||||
import { log } from "../log.ts";
|
||||
import { lookupUsernameByPubkey } from "../ldap.ts";
|
||||
import { fetchProfileEvent } from "../nostr.ts";
|
||||
import { profilePageHtml } from "../html.ts"
|
||||
import { profilePageHtml } from "../html.ts";
|
||||
|
||||
const npubHandler = async function (ctx: Context) {
|
||||
const { request } = ctx;
|
||||
|
||||
@@ -2,8 +2,8 @@ import { Context } from "@oak/oak";
|
||||
import { nip19 } from "@nostr/tools";
|
||||
import { log } from "../log.ts";
|
||||
import { lookupPubkeyByUsername } from "../ldap.ts";
|
||||
import { fetchProfileEvent } from "../nostr.ts";
|
||||
import { profilePageHtml } from "../html.ts"
|
||||
import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts";
|
||||
import { profilePageHtml } from "../html.ts";
|
||||
|
||||
const usernameHandler = async function (ctx: Context) {
|
||||
const { request } = ctx;
|
||||
@@ -20,7 +20,8 @@ const usernameHandler = async function (ctx: Context) {
|
||||
const profileEvent = await fetchProfileEvent(pubkey);
|
||||
|
||||
if (profileEvent) {
|
||||
const html = profilePageHtml(profileEvent);
|
||||
const articleEvents = await fetchArticlesByAuthor(pubkey);
|
||||
const html = profilePageHtml(profileEvent, articleEvents);
|
||||
|
||||
ctx.response.body = html;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user