diff --git a/apps/storage.json b/apps/storage.json index fda4f638..5a69f819 100644 --- a/apps/storage.json +++ b/apps/storage.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "💾", - "previous": "&vC6kbwiCRkFMMrapQEQ+SprSbItL/+Tm9AC4eigk48I=.sha256" + "previous": "&pAfoMT2ey5mk4X+ABcHQoliXPQaVaeolnTU6ri5P1UI=.sha256" } diff --git a/apps/storage/app.js b/apps/storage/app.js index f5b47c89..5e865471 100644 --- a/apps/storage/app.js +++ b/apps/storage/app.js @@ -13,6 +13,12 @@ async function get_biggest() { `); } +async function get_total() { + return (await query(` + select sum(length(content)) as size, count(distinct author) as count from messages; + `))[0]; +} + async function get_names(identities) { return query(` SELECT author, name FROM ( @@ -42,6 +48,7 @@ function nice_size(bytes) { async function main() { await app.setDocument('
Finding the top 10 largest feeds...
'); + let total = await get_total(); let identities = await ssb.getAllIdentities(); let following1 = await ssb.following(identities, 1); let following2 = await ssb.following(identities, 2); @@ -63,9 +70,13 @@ async function main() { html += `Total ${nice_size(total.size)} in ${total.count} accounts.
+ `; await app.setDocument(html); }