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:
parent
2fb7fceb0c
commit
308e24c9fa
@ -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"}}
|
@ -229,7 +229,7 @@ async function getPosts(db, ids) {
|
|||||||
var posts = [];
|
var posts = [];
|
||||||
if (ids.length) {
|
if (ids.length) {
|
||||||
await ssb.sqlStream(
|
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,
|
ids,
|
||||||
row => posts.push(row));
|
row => posts.push(row));
|
||||||
}
|
}
|
||||||
|
17
core/ssb.js
17
core/ssb.js
@ -1,4 +1,5 @@
|
|||||||
var g_wants_requests = {};
|
var g_wants_requests = {};
|
||||||
|
var g_database = new Database('core');
|
||||||
|
|
||||||
async function following(db, id) {
|
async function following(db, id) {
|
||||||
var o = await db.get(id + ":following");
|
var o = await db.get(id + ":following");
|
||||||
@ -48,20 +49,6 @@ async function followingDeep(db, seed_ids, depth) {
|
|||||||
return x;
|
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) {
|
function get_latest_sequence_for_author(author) {
|
||||||
var sequence = 0;
|
var sequence = 0;
|
||||||
ssb.sqlStream(
|
ssb.sqlStream(
|
||||||
@ -78,7 +65,7 @@ function get_latest_sequence_for_author(author) {
|
|||||||
ssb.registerConnectionsChanged(function(change, connection) {
|
ssb.registerConnectionsChanged(function(change, connection) {
|
||||||
if (change == 'add') {
|
if (change == 'add') {
|
||||||
var sequence = get_latest_sequence_for_author(connection.id);
|
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);
|
ssb.storeMessage(message.message.value);
|
||||||
});
|
});
|
||||||
connection.send_json({'name': ['blobs', 'createWants'], 'type': 'source', 'args': []}, function(message) {
|
connection.send_json({'name': ['blobs', 'createWants'], 'type': 'source', 'args': []}, function(message) {
|
||||||
|
Loading…
Reference in New Issue
Block a user