diff --git a/apps/cory/index.json b/apps/cory/index.json index 18edb3db..9e3421c5 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&KQoBrrw9o/ngsLCeS+1yTNWBWzzjm1tPQTJZ+LQaL98=.sha256","index.html":"&UdGmQAbbLedvG7wpsDZRcpZl05jwUe61GDLACoHANYg=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&V9Ol799hM6i1PZDbAS91CMhgx7aENDTJnT+KrwK4Lh4=.sha256","tf-message.js":"&VNC8ptzGXWAVl9LBBZfrk3YmweA8PQ02d7/wZxWXoAA=.sha256","tf.js":"&Vcdlau6e9yBimrokJzoSPvRIS5BNWXcrVO+cO9TUKBg=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&R4Rss5VbuH1lalgy8o5NzzccIC5ofSpK+ywc/u3WTCs=.sha256","index.html":"&UdGmQAbbLedvG7wpsDZRcpZl05jwUe61GDLACoHANYg=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&V9Ol799hM6i1PZDbAS91CMhgx7aENDTJnT+KrwK4Lh4=.sha256","tf-message.js":"&VNC8ptzGXWAVl9LBBZfrk3YmweA8PQ02d7/wZxWXoAA=.sha256","tf.js":"&Vcdlau6e9yBimrokJzoSPvRIS5BNWXcrVO+cO9TUKBg=.sha256"}} \ No newline at end of file diff --git a/apps/cory/index/app.js b/apps/cory/index/app.js index a4c735b7..ec41b374 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -229,7 +229,7 @@ async function getPosts(db, ids) { var posts = []; if (ids.length) { await ssb.sqlStream( - "SELECT rowid, * FROM messages WHERE id IN (" + ids.map(x => "?").join(", ") + ")", + "SELECT rowid, * FROM messages WHERE id IN (" + ids.map(x => "?").join(", ") + ") ORDER BY timestamp DESC", ids, row => posts.push(row)); } diff --git a/core/ssb.js b/core/ssb.js index 79e60fc1..bbd2e7c9 100644 --- a/core/ssb.js +++ b/core/ssb.js @@ -1,4 +1,5 @@ var g_wants_requests = {}; +var g_database = new Database('core'); async function following(db, id) { var o = await db.get(id + ":following"); @@ -48,20 +49,6 @@ async function followingDeep(db, seed_ids, depth) { return x; } -var g_database = new Database('core'); - -async function test_following() { - try { - print("I AM", await ssb.whoami()); - var result = await followingDeep(g_database, [await ssb.whoami()], 1); - print("following ", JSON.stringify(result)); - } catch (e) { - print("DOH", e, e.stack); - } -} - -test_following(); - function get_latest_sequence_for_author(author) { var sequence = 0; ssb.sqlStream( @@ -78,7 +65,7 @@ function get_latest_sequence_for_author(author) { ssb.registerConnectionsChanged(function(change, connection) { if (change == 'add') { var sequence = get_latest_sequence_for_author(connection.id); - connection.send_json({'name': ['createHistoryStream'], 'type': 'source', 'args': [{'id': connection.id, 'seq': sequence}]}, function(message) { + connection.send_json({'name': ['createHistoryStream'], 'type': 'source', 'args': [{'id': connection.id, 'seq': sequence, 'live': true}]}, function(message) { ssb.storeMessage(message.message.value); }); connection.send_json({'name': ['blobs', 'createWants'], 'type': 'source', 'args': []}, function(message) {