'use strict';
const th = require('./template-helper');
+const { sessionNavLinks } = require('@squeep/authentication-module');
-function hAppSection(pageTitle) {
- return ` <section class="h-app hidden">
+/**
+ *
+ * @param {string} pageTitle page title
+ * @param {string} logoUrl logo url
+ * @returns {string} element
+ */
+function hAppSection(pageTitle, logoUrl) {
+ return ` <section hidden class="h-app">
<h2>h-app Information for IndieAuth Logins</h2>
- <img src="static/favicon.ico" class="u-logo">
+ <img src="${logoUrl}" class="u-logo">
<a href="" class="u-url p-name">${pageTitle}</a>
<p class="p-summary">
This is a WebSub Hub service, facilitating content distribution.
</section>`;
}
+/**
+ * @returns {string} element
+ */
function aboutSection() {
return ` <section class="about">
<h2>What</h2>
This is a <a class="external" href="https://www.w3.org/TR/websub/">WebSub</a> Hub service.
</p>
<p>
- It facilitates the timely distribution of new content from publishers to subscribers.
+ It facilitates the timely distribution of new content from publishers to subscribers.
</p>
<aside>
The typical use-case is where the content is a blog or news feed, but any type of content may be syndicated.
</section>`;
}
+/**
+ *
+ * @param {boolean} isPublicHub is public hub
+ * @param {string} hubURL hub url
+ * @returns {string} html
+ */
function usageSection(isPublicHub, hubURL) {
const usageContent = isPublicHub ? ` <h2>Public Hub</h2>
<p>
</code>
</figure>
</li>
- <ul>
+ </ul>
</div>
<div>
<h3>Publishing Updates</h3>
</section>`;
}
+/**
+ *
+ * @param {string} contactHTML html
+ * @returns {string} html
+ */
function contactSection(contactHTML) {
let section = '';
if (contactHTML) {
/**
*
- * @param {Object} ctx
- * @param {Object} options
- * @param {Object} options.manager
- * @param {String} options.adminContactHTML
- * @param {String} options.manager.pageTitle
- * @param {String} options.manager.publicHub
- * @param {Object} options.dingus
- * @param {String} options.dingus.selfBaseUrl
- * @returns {String}
+ * @param {object} ctx context
+ * @param {object} options options
+ * @param {object} options.manager manager options
+ * @param {string} options.adminContactHTML html
+ * @param {string} options.manager.pageTitle title
+ * @param {string} options.manager.publicHub is public
+ * @param {object} options.dingus dingus options
+ * @param {string} options.dingus.selfBaseUrl url
+ * @returns {string} html
*/
module.exports = (ctx, options) => {
+ const pagePathLevel = 0;
const pageTitle = options.manager.pageTitle;
const isPublicHub = options.manager.publicHub;
const contactHTML = options.adminContactHTML;
const footerEntries = options.manager.footerEntries;
const hubURL = options.dingus.selfBaseUrl || '<s>https://hub.example.com/</s>';
- const headElements = [];
- const navLinks = [{
- href: 'admin/',
- text: 'Admin',
- }];
- const mainContent = [
+ const htmlOptions = {
+ pageIdentifier: 'root',
+ pageTitle,
+ logoUrl: options.manager.logoUrl,
+ footerEntries,
+ navLinks: [],
+ };
+ th.navLinks(pagePathLevel, ctx, htmlOptions);
+ sessionNavLinks(pagePathLevel, ctx, htmlOptions);
+ const content = [
aboutSection(),
usageSection(isPublicHub, hubURL),
contactSection(contactHTML),
- hAppSection(pageTitle),
+ hAppSection(pageTitle, options.manager.logoUrl),
];
- return th.htmlTemplate(ctx, 0, pageTitle, headElements, navLinks, mainContent, footerEntries,
- );
+ return th.htmlPage(pagePathLevel, ctx, htmlOptions, content);
};
\ No newline at end of file