From: Justin Wind Date: Mon, 16 Aug 2021 22:37:50 +0000 (-0700) Subject: Merge branch 'v1.1-dev' as v1.1.4 X-Git-Tag: v1.1.4 X-Git-Url: http://git.squeep.com/?p=websub-hub;a=commitdiff_plain;h=ed6dc5a66ce0eaf2dd61f9fb7a5ec048944c68ee;hp=c4d2acfc78cc8b67649c2eaa60a8c6c34c3e6675 Merge branch 'v1.1-dev' as v1.1.4 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 0378b17..e7fb95b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ Releases and notable changes to this project are documented here. ## [Unreleased] +## [v1.1.4] - 2021-08-16 + +### Fixed + +- Prevent task processor from being re-invoked if it is already running. + +### Added + +- Allow more configuration of html page content. + ## [v1.1.3] - 2021-08-13 ### Fixed @@ -41,7 +51,8 @@ Releases and notable changes to this project are documented here. --- -[Unreleased]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=HEAD;hp=v1.1.3 +[Unreleased]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=HEAD;hp=v1.1.4 +[v1.1.4]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=v1.1.4;hp=v1.1.3 [v1.1.3]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=v1.1.3;hp=v1.1.2 [v1.1.2]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=v1.1.2;hp=v1.1.1 [v1.1.1]: https://git.squeep.com/?p=websub-hub;a=commitdiff;h=v1.1.1;hp=v1.1.0 diff --git a/config/default.js b/config/default.js index 1905315..70837b1 100644 --- a/config/default.js +++ b/config/default.js @@ -44,6 +44,10 @@ const defaultOptions = { manager: { pageTitle: packageName, // title on html pages + footerEntries: [ // common footers on all html pages + 'Development Repository / GitHub mirror', + '©', + ], strictSecrets: false, // If true, reject requests with secrets but not over https publicHub: true, // Accept publish requests as new topics. processImmediately: true, // If true, immediately attempt to process requests when accepted. diff --git a/package-lock.json b/package-lock.json index bf05746..40533b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "websub-hub", - "version": "1.1.3", + "version": "1.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1327,9 +1327,9 @@ } }, "eslint-plugin-sonarjs": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.9.1.tgz", - "integrity": "sha512-KKFofk1LPjGHWeAZijYWv32c/C4mz+OAeBNVxhxHu1hknrTOhu415MWC8qKdAdsmOlBPShs9evM4mI1o7MNMhw==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-sonarjs/-/eslint-plugin-sonarjs-0.10.0.tgz", + "integrity": "sha512-FBRIBmWQh2UAfuLSnuYEfmle33jIup9hfkR0X8pkfjeCKNpHUG8qyZI63ahs3aw8CJrv47QJ9ccdK3ZxKH016A==", "dev": true }, "eslint-scope": { diff --git a/package.json b/package.json index 2b0d195..1b3587f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "websub-hub", - "version": "1.1.3", + "version": "1.1.4", "description": "A WebSub Hub server implementation.", "main": "server.js", "scripts": { @@ -46,7 +46,7 @@ "eslint": "^7.32.0", "eslint-plugin-node": "^11.1.0", "eslint-plugin-security": "^1.4.0", - "eslint-plugin-sonarjs": "^0.9.1", + "eslint-plugin-sonarjs": "^0.10.0", "mocha": "^9.0.3", "mocha-steps": "^1.3.0", "nyc": "^15.1.0", diff --git a/src/db/base.js b/src/db/base.js index 21e2664..95c9010 100644 --- a/src/db/base.js +++ b/src/db/base.js @@ -96,7 +96,7 @@ class Database { const current = svh.schemaVersionObjectToNumber(currentSchema); const min = svh.schemaVersionObjectToNumber(this.schemaVersionsSupported.min); const max = svh.schemaVersionObjectToNumber(this.schemaVersionsSupported.max); - if (min >= current && max <= current) { + if (current >= min && current <= max) { this.logger.debug(_scope, 'schema supported', { currentSchema, schemaVersionsSupported: this.schemaVersionsSupported }); } else { this.logger.error(_scope, 'schema not supported', { currentSchema, schemaVersionsSupported: this.schemaVersionsSupported }); diff --git a/src/manager.js b/src/manager.js index d7a07f1..fddc8e4 100644 --- a/src/manager.js +++ b/src/manager.js @@ -666,7 +666,9 @@ class Manager { this.logger.debug(_scope, 'called', { ctx }); // N.B. no await on this - this.communication.worker.process(); + this.communication.worker.process().catch((e) => { + this.logger.error(_scope, 'failed', { error: e, ctx }); + }); res.end(); this.logger.info(_scope, 'invoked worker process', { ctx }); diff --git a/src/template/admin-overview-html.js b/src/template/admin-overview-html.js index b86f7af..3d4f62c 100644 --- a/src/template/admin-overview-html.js +++ b/src/template/admin-overview-html.js @@ -15,6 +15,7 @@ module.exports = (ctx, options) => { const pageTitle = `${options.manager.pageTitle} - Topics`; const headElements = []; const navLinks = []; + const footerEntries = options.manager.footerEntries; if (!ctx.topics) { ctx.topics = []; } @@ -30,5 +31,5 @@ module.exports = (ctx, options) => { ` `, - ]); + ], footerEntries); }; \ No newline at end of file diff --git a/src/template/admin-topic-details-html.js b/src/template/admin-topic-details-html.js index 448de09..df13f21 100644 --- a/src/template/admin-topic-details-html.js +++ b/src/template/admin-topic-details-html.js @@ -21,6 +21,7 @@ module.exports = (ctx, options) => { text: '↑ All Topics', }, ]; + const footerEntries = options.manager.footerEntries; if (!ctx.subscriptions) { ctx.subscriptions = []; } @@ -46,5 +47,5 @@ module.exports = (ctx, options) => { ` `, - ]); + ], footerEntries); }; \ No newline at end of file diff --git a/src/template/root-html.js b/src/template/root-html.js index d1939b8..c68d52a 100644 --- a/src/template/root-html.js +++ b/src/template/root-html.js @@ -120,12 +120,15 @@ module.exports = (ctx, options) => { const pageTitle = options.manager.pageTitle; const isPublicHub = options.manager.publicHub; const contactHTML = options.adminContactHTML; + const footerEntries = options.manager.footerEntries; const hubURL = options.dingus.selfBaseUrl || 'https://hub.example.com/'; const headElements = []; const navLinks = []; - return th.htmlTemplate(1, pageTitle, headElements, navLinks, [ + const mainContent = [ aboutSection(), usageSection(isPublicHub, hubURL), contactSection(contactHTML), - ]); + ]; + return th.htmlTemplate(1, pageTitle, headElements, navLinks, mainContent, footerEntries, + ); }; \ No newline at end of file diff --git a/src/template/template-helper.js b/src/template/template-helper.js index d3962f9..f36829d 100644 --- a/src/template/template-helper.js +++ b/src/template/template-helper.js @@ -221,22 +221,16 @@ function htmlHeader(pageTitle, navLinks = []) { /** * Close the main section and finish off with boilerplate. + * @param {String[]} footerEntries * @returns {String} */ -function htmlFooter() { +function htmlFooter(footerEntries = []) { return ` -