Skip to content

Commit

Permalink
Code cleanup on view.js
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdrgn2k committed May 26, 2018
1 parent 143efc8 commit e62172c
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions backend/view.js
Original file line number Diff line number Diff line change
@@ -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();
})
)
})
})
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();
})
);
});
});

0 comments on commit e62172c

Please sign in to comment.