X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=src%2Ftemplate%2Froot-html.js;fp=src%2Ftemplate%2Froot-html.js;h=7baaa417b02938a08b000ff947b75fa24d414f23;hp=0000000000000000000000000000000000000000;hb=b0103b0d496262c438b40bc20304081dbfe41e73;hpb=8ed81748bce7cea7904cac7225b20a60cafdfc16 diff --git a/src/template/root-html.js b/src/template/root-html.js new file mode 100644 index 0000000..7baaa41 --- /dev/null +++ b/src/template/root-html.js @@ -0,0 +1,63 @@ +'use strict'; + +const th = require('./template-helper'); + +function aboutSection() { + return ` +
+

What

+

+ This is an IndieAuth service. +

+

+ It facilitates distributed authentication. +

+

+ If you are not an established user of this service, or some sort of web application, there is very little here for you. +

+
`; +} + +function contactSection(contactHTML) { + let section = ''; + if (contactHTML) { + section = `
+${contactHTML} +
`; + } + return section; +} + +/** + * + * @param {Object} ctx + * @param {Object} options + * @param {Object} options.manager + * @param {String} options.manager.pageTitle + * @param {String[]} options.manager.footerEntries + * @param {String} options.adminContactHTML + * @returns {String} + */ +module.exports = (ctx, options) => { + const contactHTML = options.adminContactHTML; + const htmlOptions = { + pageTitle: options.manager.pageTitle, + logoUrl: options.manager.logoUrl, + footerEntries: options.manager.footerEntries, + navLinks: [ + { + text: 'Admin', + href: 'admin/', + }, + { + text: 'Ticket', + href: 'admin/ticket', + }, + ], + }; + const content = [ + aboutSection(), + contactSection(contactHTML), + ]; + return th.htmlPage(1, ctx, htmlOptions, content); +}; \ No newline at end of file