3 const { TemplateHelper: th
} = require('@squeep/html-template-helper');
4 const { sessionNavLinks
} = require('./helpers');
7 * @alias {object} Context
11 * @alias {object} HtmlOptions
15 * @typedef {import('../session-manager').AppTemplateCallback} AppTemplateCallback
20 * @returns {string[]} section
22 function mainContent() {
25 \t<a href="./login">Try Again?</a>
32 * Render any errors from attempting IndieAuth.
33 * @param {Context} ctx context
34 * @param {object} options options
35 * @param {object} options.manager manager options
36 * @param {string} options.manager.pageTitle page title
37 * @param {object} options.dingus dingus options
38 * @param {string} options.dingus.selfBaseUrl base url
39 * @param {AppTemplateCallback} appCb function to mogrify htmlOptions
40 * @returns {string} page
42 module
.exports
= (ctx
, options
, appCb
= () => {}) => {
43 const pagePathLevel
= 1;
45 pageIdentifier: 'indieAuthError',
46 pageTitle: options
.manager
.pageTitle
,
47 logoUrl: options
.manager
.logoUrl
,
48 footerEntries: options
.manager
.footerEntries
,
50 '<p>Problems were encountered while trying to authenticate your profile URL.</p>',
53 appCb(pagePathLevel
, ctx
, htmlOptions
);
54 sessionNavLinks(pagePathLevel
, ctx
, htmlOptions
);
56 // Ensure there is always an error to report, even if we do not have one, as we ended up here somehow.
57 if (!ctx
?.errors
?.length
) {
59 'Unknown Error — we are not sure what just happened',
62 return th
.htmlPage(pagePathLevel
, ctx
, htmlOptions
, mainContent());