aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-28 20:44:46 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-01-29 00:19:06 -1000
commitf82b1f2775b7eafc92f8cf7db98c140742f78b4d (patch)
tree9b255163c636e80dfe8c9d1f76745ac7fa4cfda3 /lib
parent3b4e38cc4b02d5f47a531c3029520e67d98d6d10 (diff)
downloadpatchfoo-f82b1f2775b7eafc92f8cf7db98c140742f78b4d.tar.gz
patchfoo-f82b1f2775b7eafc92f8cf7db98c140742f78b4d.zip
Add replicate.request button
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js26
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'})
]))
})
})