update depedencies, changes to support updated authentication-module
[squeep-indie-auther] / src / template / root-html.js
1 'use strict';
2
3 const th = require('./template-helper');
4 const { sessionNavLinks } = require('@squeep/authentication-module');
5
6 function aboutSection() {
7 return `
8 <section class="about">
9 <h2>What</h2>
10 <p>
11 This is an <a class="external" href="https://indieweb.org/IndieAuth">IndieAuth</a> service.
12 </p>
13 <p>
14 It facilitates distributed authentication.
15 </p>
16 <p>
17 If you are not an established user of this service, or some sort of web application, there is very little here for you.
18 </p>
19 </section>`;
20 }
21
22 function contactSection(contactHTML) {
23 let section = '';
24 if (contactHTML) {
25 section = ` <section>
26 ${contactHTML}
27 </section>`;
28 }
29 return section;
30 }
31
32 /**
33 *
34 * @param {Object} ctx
35 * @param {Object} options
36 * @param {Object} options.manager
37 * @param {String} options.manager.pageTitle
38 * @param {String[]} options.manager.footerEntries
39 * @param {String} options.adminContactHTML
40 * @returns {String}
41 */
42 module.exports = (ctx, options) => {
43 const pagePathLevel = 0;
44 const contactHTML = options.adminContactHTML;
45 const htmlOptions = {
46 pageIdentifier: 'root',
47 pageTitle: options.manager.pageTitle,
48 logoUrl: options.manager.logoUrl,
49 footerEntries: options.manager.footerEntries,
50 headElements: [
51 `<link rel="indieauth-metadata" href="${options.dingus.selfBaseUrl}${options.route.metadata}">`,
52 ],
53 };
54 th.navLinks(pagePathLevel, ctx, htmlOptions);
55 sessionNavLinks(pagePathLevel, ctx, htmlOptions);
56 const content = [
57 aboutSection(),
58 contactSection(contactHTML),
59 ];
60 return th.htmlPage(pagePathLevel, ctx, htmlOptions, content);
61 };