diff options
-rw-r--r-- | lib/serve.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/serve.js b/lib/serve.js index 7eefc9f..c583f90 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -210,7 +210,25 @@ Serve.prototype.publishVote = function (next) { } } +Serve.prototype.requestReplicate = function (id, replicateIt, next) { + var self = this + var replicate = self.app.sbot.replicate + var request = replicate && replicate.request + if (!request) return this.respond(500, 'Missing replicate.request method') + request(id, replicateIt, function (err) { + if (err) return pull( + pull.once(u.renderError(err, ext).outerHTML), + self.wrapPage('replicate request'), + self.respondSink(400) + ) + self.requestedReplicate = replicateIt + next() + }) +} + Serve.prototype.publishContact = function (next) { + if (this.data.replicate) return this.requestReplicate(this.data.contact, true, next) + if (this.data.unreplicate) return this.requestReplicate(this.data.contact, false, next) var content = { type: 'contact', contact: this.data.contact, @@ -1777,7 +1795,13 @@ Serve.prototype.followInfo = function (id, myId) { ph('input', {type: 'submit', name: isMuted ? 'unmute' : 'mute', value: isMuted ? 'unmute' : 'mute', - title: isMuted ? 'unmute (private unblock)' : 'mute (private block)'}) + title: isMuted ? 'unmute (private unblock)' : 'mute (private block)'}), ' ', + ph('input', {type: 'submit', + name: self.requestedReplicate ? 'unreplicate' : 'replicate', + value: self.requestedReplicate ? 'unreplicate' : 'replicate', + title: self.requestedReplicate + ? 'Temporarily cancel replicating this feed' + : 'Temporarily replicate this feed'}) ])) }) }) |