diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-10-01 12:33:34 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-10-01 12:33:34 -1000 |
commit | 6ab9353333f70c428f652cebcd982885c42d3ab8 (patch) | |
tree | b5fd6e8e2d3d8103f56940b9db8ec494823b1884 /lib/render-msg.js | |
parent | ab3a0ab5900e05e5c2227eca74196d9460a5354d (diff) | |
download | patchfoo-6ab9353333f70c428f652cebcd982885c42d3ab8.tar.gz patchfoo-6ab9353333f70c428f652cebcd982885c42d3ab8.zip |
Render acme-challenges-http-01 messages compactly
Diffstat (limited to 'lib/render-msg.js')
-rw-r--r-- | lib/render-msg.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/render-msg.js b/lib/render-msg.js index 186bb9f..0359a1f 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -256,6 +256,7 @@ RenderMsg.prototype.message = function (cb) { case 'npm-publish': return this.npmPublish(cb) case 'npm-packages': return this.npmPackages(cb) case 'npm-prebuilds': return this.npmPrebuilds(cb) + case 'acme-challenges-http-01': return this.acmeChallengesHttp01(cb) default: return this.object(cb) } } @@ -873,9 +874,9 @@ RenderMsg.prototype.micro = function (cb) { this.wrapMini(el, cb) } -function hJoin(els, seperator) { +function hJoin(els, seperator, lastSeparator) { return els.map(function (el, i) { - return [i === 0 ? '' : separator, el] + return [i === 0 ? '' : i === els.length-1 ? lastSeparator : seperator, el] }) } @@ -1174,3 +1175,17 @@ RenderMsg.prototype.chessMove = function (cb) { ], cb) }) } + +RenderMsg.prototype.acmeChallengesHttp01 = function (cb) { + var self = this + self.wrapMini(h('span', + 'serves ', + hJoin(u.toArray(self.c.challenges).map(function (challenge) { + return h('a', { + href: 'http://' + challenge.domain + + '/.well-known/acme-challenge/' + challenge.token, + title: challenge.keyAuthorization, + }, challenge.domain) + }), ', ', ', and ') + ), cb) +} |