Render error pages as HTML

This commit is contained in:
2024-10-22 12:49:14 +02:00
parent ea58c1f60b
commit ba7336b4ee
9 changed files with 53 additions and 38 deletions

View File

@@ -2,6 +2,7 @@ import { Context } from "@oak/oak";
import { nip19 } from "@nostr/tools";
import { log } from "../log.ts";
import { lookupUsernameByPubkey } from "../ldap.ts";
import notFoundHandler from "../handlers/not-found.ts";
const npubHandler = async function (ctx: Context) {
const npub = ctx.params.path;
@@ -13,13 +14,11 @@ const npubHandler = async function (ctx: Context) {
if (username) {
ctx.response.redirect(`/@${username}`);
} else {
ctx.response.status = 404;
ctx.response.body = "Not Found";
notFoundHandler(ctx);
}
} catch (e) {
log(e, "yellow");
ctx.response.status = 404;
ctx.response.body = "Not Found";
notFoundHandler(ctx);
}
};