1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-03-02 02:31:35 +00:00

Autofocus search if user-agent not a mobile device

This commit is contained in:
Cadence Ember 2021-04-10 01:04:00 +12:00
parent 54ae21685f
commit 848651757a
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
3 changed files with 13 additions and 3 deletions

11
api/pages.js Normal file
View file

@ -0,0 +1,11 @@
const {render} = require("pinski/plugins")
module.exports = [
{
route: "/", methods: ["GET"], code: async ({req}) => {
const userAgent = req.headers["user-agent"] || ""
const mobile = userAgent.toLowerCase().includes("mobile")
return render(200, "pug/home.pug", {mobile})
}
}
]