Typing all the types

This commit is contained in:
2024-10-23 00:27:20 +02:00
parent edaf5f5c71
commit 46ad9813eb
15 changed files with 97 additions and 105 deletions

View File

@@ -1,5 +1,4 @@
import { Context } from "@oak/oak";
import { log } from "../log.ts";
import { lookupPubkeyByUsername } from "../directory.ts";
import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts";
import Article from "../models/article.ts";
@@ -8,7 +7,7 @@ import { profilePageHtml } from "../html.ts";
import notFoundHandler from "../handlers/not-found.ts";
const userProfileHandler = async function (ctx: Context) {
const username = ctx.params.path.replace(/^(@|~)/, "");
const username = ctx.state.path.replace(/^(@|~)/, "");
const pubkey = await lookupPubkeyByUsername(username);
if (!pubkey) {
@@ -27,11 +26,9 @@ const userProfileHandler = async function (ctx: Context) {
ctx.response.body = html;
} else {
log(`No profile event found for @${username}`, "yellow");
notFoundHandler(ctx);
}
} catch (e) {
log(e, "yellow");
} catch (_e) {
notFoundHandler(ctx);
}
};