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 naddrHandler = async function (ctx: Context) {
const naddr = ctx.params.path;
@@ -13,13 +14,11 @@ const naddrHandler = async function (ctx: Context) {
if (username && r.data.identifier) {
ctx.response.redirect(`/@${username}/${r.data.identifier}`);
} 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);
}
};