'use strict';
const { TemplateHelper: th } = require('@squeep/html-template-helper');
+const { sessionNavLinks } = require('./helpers');
+
+/**
+ * @alias {object} Context
+ */
+
+/**
+ * @alias {object} HtmlOptions
+ */
+
+/**
+ * @typedef {import('../session-manager').AppTemplateCallback} AppTemplateCallback
+ */
/**
*
- * @returns {String}
+ * @returns {string[]} section
*/
function mainContent() {
return [
];
}
+
/**
* Render any errors from attempting IndieAuth.
- * @param {Object} ctx
- * @param {String[]} ctx.errors
- * @param {Object} options
- * @param {Object} options.manager
- * @param {String} options.manager.pageTitle
- * @param {Object} options.dingus
- * @param {String} options.dingus.selfBaseUrl
- * @returns {String}
+ * @param {Context} ctx context
+ * @param {object} options options
+ * @param {object} options.manager manager options
+ * @param {string} options.manager.pageTitle page title
+ * @param {object} options.dingus dingus options
+ * @param {string} options.dingus.selfBaseUrl base url
+ * @param {AppTemplateCallback} appCb function to mogrify htmlOptions
+ * @returns {string} page
*/
-module.exports = (ctx, options) => {
+module.exports = (ctx, options, appCb = () => {}) => {
+ const pagePathLevel = 1;
const htmlOptions = {
+ pageIdentifier: 'indieAuthError',
pageTitle: options.manager.pageTitle,
logoUrl: options.manager.logoUrl,
footerEntries: options.manager.footerEntries,
'<p>Problems were encountered while trying to authenticate your profile URL.</p>',
],
};
+ appCb(pagePathLevel, ctx, htmlOptions);
+ sessionNavLinks(pagePathLevel, ctx, htmlOptions);
+
// Ensure there is always an error to report, even if we do not have one, as we ended up here somehow.
if (!ctx?.errors?.length) {
ctx.errors = [
'Unknown Error — we are not sure what just happened',
];
}
- return th.htmlPage(2, ctx, htmlOptions, mainContent());
+ return th.htmlPage(pagePathLevel, ctx, htmlOptions, mainContent());
};
\ No newline at end of file