Created
March 7, 2020 16:29
-
-
Save dbauszus-glx/6cfebb71af24e1a7d5402fbcb976a5cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const auth = require('../mod/auth/handler')({ | |
public: true, | |
login: true | |
}) | |
const _templates = require('../mod/workspace/templates') | |
const templates = {} | |
module.exports = async (req, res) => { | |
await auth(req, res) | |
Object.assign(templates, await _templates(req, res)) | |
if (res.finished) return | |
const md = new Md(req.headers['user-agent']) | |
const template = templates[(md.mobile() === null || md.tablet() !== null) && '_desktop' || '_mobile']; | |
const html = template.render({ | |
dir: process.env.DIR || '', | |
title: process.env.TITLE || 'GEOLYTIX | XYZ', | |
token: req.query.token || req.params.token.signed || '""', | |
log: process.env.LOG_LEVEL || '""', | |
login: (process.env.PRIVATE || process.env.PUBLIC) && 'true' || '""', | |
}) | |
res.send(html) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment