Apply settings to error pages

This commit is contained in:
Cadence Ember
2020-06-16 23:01:40 +12:00
parent 518403e91e
commit 753b4f4ea4
2 changed files with 16 additions and 12 deletions

View File

@@ -1,10 +1,12 @@
const {render} = require("pinski/plugins")
const constants = require("../../lib/constants")
const {getSettings} = require("./utils/getsettings")
module.exports = [
{route: "/404", methods: ["*"], code: async ({url}) => {
{route: "/404", methods: ["*"], code: async ({req, url}) => {
const path = url.searchParams.get("pathname")
const couldBeUsername = path && path.match(`^/${constants.external.username_regex}(?:/channel)?$`)
return render(404, "pug/404.pug", {path, couldBeUsername})
const settings = getSettings(req)
return render(404, "pug/404.pug", {settings, path, couldBeUsername})
}}
]