Been a while since I exported these apps.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3880 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-05-26 00:03:46 +00:00
parent 842633f6d1
commit 04ec425c9c
11 changed files with 79 additions and 33 deletions

View File

@@ -1,6 +1,6 @@
"use strict";
const k_posts_max = 20;
const k_posts_max = 40;
const k_votes_max = 20;
var g_ready = false;
@@ -260,6 +260,9 @@ async function getRecentPostIds(db, id, ids, limit) {
}
async function getRecentPostIds2(db, id, ids, start_time) {
if (ids.length == 1) {
return getRecentPostsSingleId(db, ids[0], 20);
}
const k_batch_max = 32;
var row_id_max = 0;
await ssb.sqlStream(
@@ -281,7 +284,7 @@ async function getRecentPostIds2(db, id, ids, start_time) {
" timestamp > ? AND "+
" rowid <= ? AND "+
" json_extract(content, '$.type') = 'post' "+
"ORDER BY timestamp",
"ORDER BY timestamp DESC",
[].concat(ids_batch, [start_time, row_id_max]),
function(row) {
if (row.id) {
@@ -500,6 +503,16 @@ async function refresh(selected) {
await app.postMessage({votes: votes});
}
timing.push({name: 'votes', time: new Date()});
if (selected && selected.length == 1 && selected[0].startsWith('@')) {
let size = 0;
await ssb.sqlStream(
'SELECT SUM(LENGTH(content)) AS length FROM messages WHERE author = ?1',
selected,
function(row) {
size = row.length;
});
await app.postMessage({user: {user: selected[0], about: {size: size}}});
}
await all_followed.map(
id => app.postMessage(
{