Ugg, need to get this talking SSB properly.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3677 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
62ad08985c
commit
256c47c33c
23
core/ssb.js
23
core/ssb.js
@ -65,7 +65,7 @@ test_following();
|
||||
ssb.registerConnectionsChanged(function(change, connection) {
|
||||
if (change == 'add') {
|
||||
connection.send_json({'name': ['createHistoryStream'], 'type': 'source', 'args': [{'id': connection.id, 'seq': 0}]}, function(message) {
|
||||
ssb.storeMessage(message.message);
|
||||
ssb.storeMessage(message.message.value);
|
||||
});
|
||||
connection.send_json({'name': ['blobs', 'createWants'], 'type': 'source', 'args': []}, function(message) {
|
||||
Object.keys(message.message).forEach(function(id) {
|
||||
@ -128,19 +128,22 @@ ssb.registerRpc(['createHistoryStream'], function(request) {
|
||||
var id = request.args[0].id;
|
||||
var seq = request.args[0].seq;
|
||||
ssb.sqlStream(
|
||||
'SELECT previous, sequence, timestamp, hash, content, signature FROM messages WHERE author = ?1 AND sequence >= ?2 ORDER BY sequence',
|
||||
'SELECT previous, id, sequence, timestamp, hash, content, signature FROM messages WHERE author = ?1 AND sequence >= ?2 ORDER BY sequence',
|
||||
[id, seq ?? 0],
|
||||
function(row) {
|
||||
var message = {
|
||||
'previous': row.previous,
|
||||
'author': id,
|
||||
'sequence': row.sequence,
|
||||
'timestamp': row.timestamp,
|
||||
'hash': row.hash,
|
||||
'content': JSON.parse(row.content),
|
||||
'signature': row.signature,
|
||||
key: row.id + '.' + row.hash,
|
||||
value: {
|
||||
previous: row.previous,
|
||||
author: id,
|
||||
sequence: row.sequence,
|
||||
timestamp: row.timestamp,
|
||||
hash: row.hash,
|
||||
content: JSON.parse(row.content),
|
||||
signature: row.signature,
|
||||
},
|
||||
timestamp: row.timestamp,
|
||||
};
|
||||
debug_print('sending1', JSON.stringify(message));
|
||||
request.send_json(message);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user