diff --git a/apps/ssb/tf-app.js b/apps/ssb/tf-app.js index a5871d01..444dbebe 100644 --- a/apps/ssb/tf-app.js +++ b/apps/ssb/tf-app.js @@ -272,7 +272,9 @@ class TfElement extends LitElement { async get_latest_private(following) { const k_version = 1; // { "version": 1, "range": [1234, 5678], messages: [ "%1.sha256", "%2.sha256", ... ], latest: rowid } - let cache = JSON.parse(await tfrpc.rpc.databaseGet(`private:${this.whoami}`) ?? '{}'); + let cache = JSON.parse( + (await tfrpc.rpc.databaseGet(`private:${this.whoami}`)) ?? '{}' + ); if (cache.version !== k_version) { cache = { version: k_version, @@ -290,7 +292,11 @@ class TfElement extends LitElement { ranges.push([i, Math.min(i + k_chunk_size, latest), true]); } for (let i = cache.range[0]; i >= 0; i -= k_chunk_size) { - ranges.push([Math.max(i - k_chunk_size, 0), Math.min(cache.range[0], i + k_chunk_size), false]); + ranges.push([ + Math.max(i - k_chunk_size, 0), + Math.min(cache.range[0], i + k_chunk_size), + false, + ]); } } else { for (let i = 0; i < latest; i += k_chunk_size) { @@ -309,23 +315,26 @@ class TfElement extends LitElement { json(messages.content) LIKE '"%' ORDER BY sequence DESC `, - [ - range[0], - range[1], - ] + [range[0], range[1]] ); messages = (await this.decrypt(messages)).filter((x) => x.decrypted); if (messages.length) { - cache.latest = Math.max(cache.latest ?? 0, ...messages.map((x) => x.rowid)); + cache.latest = Math.max( + cache.latest ?? 0, + ...messages.map((x) => x.rowid) + ); if (range[2]) { - cache.messages = [...cache.messages, ...messages.map(x => x.id)]; + cache.messages = [...cache.messages, ...messages.map((x) => x.id)]; } else { - cache.messages = [...messages.map(x => x.id), ...cache.messages]; + cache.messages = [...messages.map((x) => x.id), ...cache.messages]; } } cache.range[0] = Math.min(cache.range[0] ?? range[0], range[0]); cache.range[1] = Math.max(cache.range[1] ?? range[1], range[1]); - await tfrpc.rpc.databaseSet(`private:${this.whoami}`, JSON.stringify(cache)); + await tfrpc.rpc.databaseSet( + `private:${this.whoami}`, + JSON.stringify(cache) + ); } console.log(cache); return cache.latest; @@ -428,7 +437,9 @@ class TfElement extends LitElement { ); this.following = Object.keys(following); this.users = users; - console.log(`load finished ${whoami} => ${this.whoami} in ${(new Date() - start_time) / 1000}`); + console.log( + `load finished ${whoami} => ${this.whoami} in ${(new Date() - start_time) / 1000}` + ); this.whoami = whoami; this.loaded = whoami; } diff --git a/apps/ssb/tf-compose.js b/apps/ssb/tf-compose.js index a386ff9c..a4bab352 100644 --- a/apps/ssb/tf-compose.js +++ b/apps/ssb/tf-compose.js @@ -605,7 +605,11 @@ class TfComposeElement extends LitElement {