2021-04-09 13:04:00 +00:00
|
|
|
const {render} = require("pinski/plugins")
|
2021-12-28 03:32:11 +00:00
|
|
|
const {getUser} = require("../utils/getuser")
|
2021-04-09 13:04:00 +00:00
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
{
|
|
|
|
route: "/", methods: ["GET"], code: async ({req}) => {
|
|
|
|
const userAgent = req.headers["user-agent"] || ""
|
|
|
|
const mobile = userAgent.toLowerCase().includes("mobile")
|
2021-12-28 03:32:11 +00:00
|
|
|
const user = getUser(req)
|
|
|
|
const settings = user.getSettingsOrDefaults()
|
|
|
|
return render(200, "pug/home.pug", {settings, mobile})
|
2021-04-09 13:04:00 +00:00
|
|
|
}
|
2021-04-16 04:31:54 +00:00
|
|
|
},
|
|
|
|
{
|
2021-12-28 03:32:11 +00:00
|
|
|
route: "/(?:js-)?licenses", methods: ["GET"], code: async ({req}) => {
|
|
|
|
const user = getUser(req)
|
|
|
|
const settings = user.getSettingsOrDefaults()
|
|
|
|
return render(200, "pug/licenses.pug", {settings})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
route: "/cant-think", methods: ["GET"], code: async ({req}) => {
|
|
|
|
const user = getUser(req)
|
|
|
|
const settings = user.getSettingsOrDefaults()
|
|
|
|
return render(200, "pug/cant-think.pug", {settings})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
route: "/privacy", methods: ["GET"], code: async ({req}) => {
|
|
|
|
const user = getUser(req)
|
|
|
|
const settings = user.getSettingsOrDefaults()
|
|
|
|
return render(200, "pug/privacy.pug", {settings})
|
2021-04-16 04:31:54 +00:00
|
|
|
}
|
2021-04-09 13:04:00 +00:00
|
|
|
}
|
|
|
|
]
|