From e62172c43480e1466e8f54b83f09cbce670809a0 Mon Sep 17 00:00:00 2001 From: darkdrgn2k Date: Sat, 26 May 2018 13:26:04 -0400 Subject: [PATCH] Code cleanup on view.js --- backend/view.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/backend/view.js b/backend/view.js index be4b1a2..6dcbd93 100644 --- a/backend/view.js +++ b/backend/view.js @@ -1,20 +1,21 @@ const l = process.argv[2]; +const pull = require('pull-stream'); const ssbClient = require('ssb-client'); const ssbKeys = require('ssb-keys'); const ssbFeed = require('ssb-feed'); -const pull = require('pull-stream'); -const keyz = ssbKeys.load('/var/www/backend/keys/' + l , function(err, k) { - ssbClient(keyz, - function (err, sbot) { - pull( - sbot.createHistoryStream({ id: k.id, live: false } ), - pull.filter(msg => typeof msg.value.content === 'object' && !msg.value.content.root), - pull.collect((err, msgs) => { - console.log(JSON.stringify(msgs)); - sbot.close(); - }) - ) - }) -}) \ No newline at end of file +const keyz = ssbKeys.load('/var/www/backend/keys/' + l, function(err, k) { + ssbClient(keyz, function(err, sbot) { + pull( + sbot.createHistoryStream({id: k.id}), + pull.filter( + msg => typeof msg.value.content === 'object' && !msg.value.content.root + ), + pull.collect((err, msgs) => { + console.log(JSON.stringify(msgs)); + sbot.close(); + }) + ); + }); +}); \ No newline at end of file