1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2025-12-16 11:08:49 +00:00

404 page allows you to visit that user

Closes #43
This commit is contained in:
Cadence Ember
2020-03-22 17:10:50 +13:00
parent a903647eb1
commit 49ad9ee434
6 changed files with 32 additions and 25 deletions

10
src/site/api/404.js Normal file
View File

@@ -0,0 +1,10 @@
const {render} = require("pinski/plugins")
const constants = require("../../lib/constants")
module.exports = [
{route: "/404", methods: ["GET", "POST", "PATCH", "DELETE"], code: async ({url}) => {
const path = url.searchParams.get("pathname")
const couldBeUsername = path.match(`^/${constants.external.username_regex}$`)
return render(404, "pug/404.pug", {path, couldBeUsername})
}}
]