Allow old-school username routes with ~
This commit is contained in:
parent
0e5b4b1807
commit
e14adffbc8
@ -7,7 +7,7 @@ import { profilePageHtml } from "../html.ts"
|
||||
|
||||
const usernameHandler = async function (ctx: Context) {
|
||||
const { request } = ctx;
|
||||
const username = ctx.params.path.replace(/^@/, '');;
|
||||
const username = ctx.params.path.replace(/^(@|~)/, "");
|
||||
const pubkey = await lookupPubkeyByUsername(username);
|
||||
|
||||
if (!pubkey) {
|
||||
|
2
main.ts
2
main.ts
@ -16,7 +16,7 @@ router.get("/:path", async (ctx: ctx) => {
|
||||
await nprofileHandler(ctx);
|
||||
} else if (path.startsWith("npub")) {
|
||||
await npubHandler(ctx);
|
||||
} else if (path.startsWith("@")) {
|
||||
} else if (path.startsWith("@") || path.startsWith("~")) {
|
||||
await usernameHandler(ctx);
|
||||
} else {
|
||||
ctx.response.status = 404;
|
||||
|
Loading…
x
Reference in New Issue
Block a user