diff --git a/README.md b/README.md index ea27f96a..c33b4d5e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ The `.tar.xz` source releases are all-inclusive. ## Building -Builds on Linux (x86_64 and aarch64), MacOS, OpenBSD, and Haiku. It's possible +Builds on Linux (x86_64 and aarch64), MacOS, OpenBSD, and Haiku. It's possible to build for Android, iOS, and Windows on Linux, if you have the right dependencies in the right places. @@ -47,7 +47,7 @@ On MacOS, Xcode's command-line tools are expected to be available. ### Build Commands -Run `make` with no arguments to see available build targets and options. `make +Run `make` with no arguments to see available build targets and options. `make debug` is a good place to start. To build in docker, `docker build .`. @@ -58,7 +58,7 @@ standard. ## Running By default, running the built `out/debug/tildefriends` executable will start a -web server at . It expects to be run with the +web server at . It expects to be run with the repository root as the current working directory. `tildefriends -h` lists further options. diff --git a/apps/ssb/tf-message.js b/apps/ssb/tf-message.js index 75775475..ceb64d30 100644 --- a/apps/ssb/tf-message.js +++ b/apps/ssb/tf-message.js @@ -408,9 +408,10 @@ ${JSON.stringify(mention, null, 2)} % ${new Date( - self.message.timestamp - ).toLocaleString()}% + ${new Date(self.message.timestamp).toLocaleString()} ${raw_button} ${self.format == 'raw' ? self.render_raw() : inner} ${self.render_votes()} @@ -449,7 +450,9 @@ ${JSON.stringify(mention, null, 2)} - ${this.message.id} + ${this.message.id} (placeholder)
${this.render_votes()}
${(this.message.child_messages || []).map( @@ -600,7 +603,11 @@ ${JSON.stringify(content, null, 2)} % + >% ${new Date(this.message.timestamp).toLocaleString()} ${raw_button} @@ -643,7 +650,11 @@ ${JSON.stringify(content, null, 2)} % + >% ${new Date(this.message.timestamp).toLocaleString()} ${raw_button} @@ -733,7 +744,11 @@ ${JSON.stringify(content, null, 2)} % + >% ${new Date(this.message.timestamp).toLocaleString()} ${raw_button} diff --git a/apps/storage/app.js b/apps/storage/app.js index dffc9d5f..7136f165 100644 --- a/apps/storage/app.js +++ b/apps/storage/app.js @@ -1,10 +1,9 @@ - async function query(sql, args) { let rows = []; - await ssb.sqlAsync(sql, args ?? [], function(row) { + await ssb.sqlAsync(sql, args ?? [], function (row) { rows.push(row); }); - return rows;; + return rows; } async function get_biggest() { @@ -14,13 +13,16 @@ async function get_biggest() { } async function get_total() { - return (await query(` + return ( + await query(` select sum(length(content)) as size, count(distinct author) as count from messages; - `))[0]; + `) + )[0]; } async function get_names(identities) { - return query(` + return query( + ` SELECT author, name FROM ( SELECT messages.author, @@ -32,7 +34,9 @@ async function get_names(identities) { json_extract(messages.content, '$.type') = 'about' AND content ->> 'about' = messages.author AND name IS NOT NULL) WHERE author_rank = 1 - `, [JSON.stringify(identities)]); + `, + [JSON.stringify(identities)] + ); } async function get_most_follows() { @@ -58,22 +62,32 @@ function nice_size(bytes) { } async function main() { - await app.setDocument('

Finding the top 10 largest feeds...

'); + await app.setDocument( + '

Finding the top 10 largest feeds...

' + ); let most_follows = await get_most_follows(); let total = await get_total(); let identities = await ssb.getAllIdentities(); let following1 = await ssb.following(identities, 1); let following2 = await ssb.following(identities, 2); let biggest = await get_biggest(); - let names = await get_names([].concat(biggest.map(x => x.author), most_follows.map(x => x.author))); - names = Object.fromEntries(names.map(x => [x.author, x.name])); + let names = await get_names( + [].concat( + biggest.map((x) => x.author), + most_follows.map((x) => x.author) + ) + ); + names = Object.fromEntries(names.map((x) => [x.author, x.name])); for (let item of biggest) { item.name = names[item.author]; item.following = - identities.indexOf(item.author) != -1 ? 0 : - following1[item.author] !== undefined ? 1 : - following2[item.author] !== undefined ? 2 : - undefined; + identities.indexOf(item.author) != -1 + ? 0 + : following1[item.author] !== undefined + ? 1 + : following2[item.author] !== undefined + ? 2 + : undefined; } for (let item of most_follows) { item.name = names[item.author]; @@ -108,4 +122,6 @@ async function main() { await app.setDocument(html); } -main().catch(function(e) { print(e); }); \ No newline at end of file +main().catch(function (e) { + print(e); +}); diff --git a/docs b/docs index f17105d4..a40758cc 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit f17105d473c0174a6608d713295add65c6a82b62 +Subproject commit a40758cc4bef5ded4d214c2acf1c95e554e20564