UNPKG

@opengis/fastify-table

Version:

core-plugins

29 lines (28 loc) 1.05 kB
import path from "node:path"; import { readFile } from "node:fs/promises"; import { fileURLToPath } from "url"; import config from "../../../../../config.js"; import { handlebars } from "../../../../helpers/index.js"; import getTemplate from "../../../../plugins/table/funcs/getTemplate.js"; // relative default template filepath const filename = fileURLToPath(import.meta.url); const dirname = path.dirname(filename); const headers = { "Content-Type": "text/html; charset=UTF-8", "Cache-Control": "no-cache", "Accept-CH": "Viewport-Width, Width", }; export default async function loginTemplate(req, reply) { const body1 = await getTemplate("page", "loginEuSign"); const body = !body1 ? await readFile(path.join(dirname, "../../../../templates/page/loginEuSign.html"), "utf8") : body1; const html = await handlebars.compile(body)({ req, protocol: req.protocol, hostname: req.hostname, port: process.env.PORT, config, }); return reply.headers(headers).send(html); }