diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/app.js | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -289,7 +289,7 @@ App.prototype.publishMayRedirect = function (content, cb) { redirectBase: this.baseUrl + '/' }, onPublishGetUrl) } - this.sbot.private.publish(content, recps, cb) + this.privatePublish(content, recps, cb) } else { if (publishguard && publishguard.publishGetUrl) { return publishguard.publishGetUrl({ @@ -305,12 +305,22 @@ App.prototype.publishMayRedirect = function (content, cb) { } } +App.prototype.privatePublish = function (content, recps, cb) { + if (this.private && typeof this.private.publish === 'function') { + return this.sbot.private.publish(content, recps, cb) + } else { + try { content = ssbKeys.box(content, recps) } + catch(e) { return cb(e) } + return this.sbot.publish(content, cb) + } +} + App.prototype.publish = function (content, cb) { var self = this function tryPublish(triesLeft) { if (Array.isArray(content.recps)) { var recps = content.recps.map(u.linkDest) - self.sbot.private.publish(content, recps, next) + self.privatePublish(content, recps, next) } else { self.sbot.publish(content, next) } |