Maybe ordered better?

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3683 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2021-11-03 23:23:20 +00:00
parent 2fb7fceb0c
commit 308e24c9fa
3 changed files with 4 additions and 17 deletions

View File

@ -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"}}
{"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"}}

View File

@ -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));
}

View File

@ -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) {