diff --git a/apps/cory/index.json b/apps/cory/index.json
index 9d0c463a..18edb3db 100644
--- a/apps/cory/index.json
+++ b/apps/cory/index.json
@@ -1 +1 @@
-{"type":"tildefriends-app","files":{"app.js":"&qvp1qQcymJp9pWxnZXA9/VXFt6FRGj9JCAxNCt/afsU=.sha256","index.html":"&sXphZUl6JQm0Cd4UOVqPZu13PDhqQqFk/EOmKneaEhY=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&V9Ol799hM6i1PZDbAS91CMhgx7aENDTJnT+KrwK4Lh4=.sha256","tf-message.js":"&e811GqoyT6JhNrgXA1rCB/Y7ggtbOz2xcZP5+rQrrws=.sha256","tf.js":"&lYgDJTZaYTvss6Ykzmr3o6KBc6hPFiEzPn6DR3R5Peo=.sha256"}}
\ No newline at end of file
+{"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
diff --git a/apps/cory/index/app.js b/apps/cory/index/app.js
index 0aeb6c89..a4c735b7 100644
--- a/apps/cory/index/app.js
+++ b/apps/cory/index/app.js
@@ -1,7 +1,7 @@
"use strict";
const k_posts_max = 20;
-const k_votes_max = 100;
+const k_votes_max = 20;
async function following(db, id) {
var o = await db.get(id + ":following");
@@ -188,7 +188,7 @@ async function getRecentPostIds(db, id, ids, limit) {
async function getVotes(db, id) {
var o = await db.get(id + ":votes");
- const k_version = 3;
+ const k_version = 5;
var votes = [];
var f = o ? JSON.parse(o) : o;
if (!f || f.version != k_version) {
@@ -231,12 +231,7 @@ async function getPosts(db, ids) {
await ssb.sqlStream(
"SELECT rowid, * FROM messages WHERE id IN (" + ids.map(x => "?").join(", ") + ")",
ids,
- function(row) {
- try {
- posts.push(row);
- } catch {
- }
- });
+ row => posts.push(row));
}
return posts;
}
@@ -278,21 +273,19 @@ async function refresh() {
return root && posts.every(post => post.id != root);
});
return [].concat(posts, await getPosts(db, roots));
- }).then(async function(posts) {
- posts.forEach(async function(post) {
- await app.postMessage({message: post});
- });
+ }).then(function(posts) {
+ return Promise.all(posts.map(x => app.postMessage({message: x})));
});
- f.forEach(async function(id) {
- await Promise.all([
- getVotes(db, id).then(async function(votes) {
- return Promise.all(votes.map(vote => app.postMessage({vote: vote})));
+ Promise.all(f.map(function(id) {
+ return Promise.all([
+ getVotes(db, id).then(function(votes) {
+ return app.postMessage({votes: votes});
}),
- getAbout(db, id).then(async function(user) {
+ getAbout(db, id).then(function(user) {
return app.postMessage({user: {user: id, about: user}});
}),
]);
- });
+ }));
}),
sendUser(db, whoami),
]);
diff --git a/apps/cory/index/index.html b/apps/cory/index/index.html
index dd102e72..10a21c79 100644
--- a/apps/cory/index/index.html
+++ b/apps/cory/index/index.html
@@ -73,7 +73,13 @@