bibliogram/src/site/api/404.js

13 lines
490 B
JavaScript
Raw Normal View History

const {render} = require("pinski/plugins")
const constants = require("../../lib/constants")
2020-06-16 11:01:40 +00:00
const {getSettings} = require("./utils/getsettings")
module.exports = [
2020-06-16 11:01:40 +00:00
{route: "/404", methods: ["*"], code: async ({req, url}) => {
const path = url.searchParams.get("pathname")
2020-05-17 12:13:08 +00:00
const couldBeUsername = path && path.match(`^/${constants.external.username_regex}(?:/channel)?$`)
2020-06-16 11:01:40 +00:00
const settings = getSettings(req)
return render(404, "pug/404.pug", {settings, path, couldBeUsername})
}}
]