'use strict';
const th = require('./template-helper');
+const { sessionNavLinks } = require('@squeep/authentication-module');
+/**
+ *
+ * @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="${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.
+ Authenticated users may view details of any syndications related to their profile.
+ </p>
+ </section>`;
+}
+
+/**
+ * @returns {string} element
+ */
function aboutSection() {
return ` <section class="about">
<h2>What</h2>
</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>
</div>
<div>
<h3>Publishing Updates</h3>
- To notify the Hub that a topic's content has been updated and should be distributed to subscribers, send a <code>POST</code> request with Form Data (<code>application/x-www-form-urlencoded</code>):
+ To notify the Hub either of a new topic to syndicate, or that a topic's content has been updated and should be distributed to subscribers, send a <code>POST</code> request with Form Data (<code>application/x-www-form-urlencoded</code>):
<ul>
<li>
<code>hub.mode</code> set to <code>publish</code>
</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 = [];
- 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, options.manager.logoUrl),
];
- return th.htmlTemplate(1, pageTitle, headElements, navLinks, mainContent, footerEntries,
- );
+ return th.htmlPage(pagePathLevel, ctx, htmlOptions, content);
};
\ No newline at end of file