2020-03-22 04:10:50 +00:00
|
|
|
const {render} = require("pinski/plugins")
|
|
|
|
const constants = require("../../lib/constants")
|
2020-06-16 11:01:40 +00:00
|
|
|
const {getSettings} = require("./utils/getsettings")
|
2020-03-22 04:10:50 +00:00
|
|
|
|
|
|
|
module.exports = [
|
2020-06-16 11:01:40 +00:00
|
|
|
{route: "/404", methods: ["*"], code: async ({req, url}) => {
|
2020-03-22 04:10:50 +00:00
|
|
|
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})
|
2020-03-22 04:10:50 +00:00
|
|
|
}}
|
|
|
|
]
|