From 5ed9a77d38cd4048743a5ac60ced4de1bcd4d44b Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 10 Nov 2022 00:03:39 +0000 Subject: [PATCH] Make the id picker refresh when you create an identity. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4029 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/cory/docs.json | 2 +- apps/cory/docs/todo.md | 9 +++++++-- apps/cory/ssblit.json | 2 +- apps/cory/ssblit/tf-app.js | 12 +++++------- core/ssb.js | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/apps/cory/docs.json b/apps/cory/docs.json index b0726067..094c2a12 100644 --- a/apps/cory/docs.json +++ b/apps/cory/docs.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&rLwYqurncmnUyGeWY+FLEGS2EIJmqw2cutl1gyGiVSk=.sha256","index.md":"&082vPjenwI6mL2vXwQDVEFquyl2jW9t767sGuCFvVNA=.sha256","todo.md":"&57O9UxRhdpXSUAi0ktKQiHztAVXucxPQ6ahYEVByofs=.sha256","structure.md":"&T+CBfT9XP6ooKFvD1ZCI9hsutqsNIamfBxtAho0HtlU=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256","id_refactor.md":"&8yoYd14gX2Z3ppktVrPYf4qR78fuwAlvrtsWkSCkWUA=.sha256","ssb.md":"&WMvYIpp4CMZACwXJlX8HMDplJ+XeJB04BYf8zasrL4g=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&rLwYqurncmnUyGeWY+FLEGS2EIJmqw2cutl1gyGiVSk=.sha256","index.md":"&082vPjenwI6mL2vXwQDVEFquyl2jW9t767sGuCFvVNA=.sha256","todo.md":"&ehX+cfsiYWwe3Pjg2QW7Gqa5bsQTFBehJVxQnlxv+P4=.sha256","structure.md":"&T+CBfT9XP6ooKFvD1ZCI9hsutqsNIamfBxtAho0HtlU=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256","id_refactor.md":"&8yoYd14gX2Z3ppktVrPYf4qR78fuwAlvrtsWkSCkWUA=.sha256","ssb.md":"&WMvYIpp4CMZACwXJlX8HMDplJ+XeJB04BYf8zasrL4g=.sha256"}} \ No newline at end of file diff --git a/apps/cory/docs/todo.md b/apps/cory/docs/todo.md index 4e536490..8b627f8d 100644 --- a/apps/cory/docs/todo.md +++ b/apps/cory/docs/todo.md @@ -2,6 +2,11 @@ [Back to index](#index) ## MVP2 +- initial: better empty news screen +- initial: doesn't refresh when create identity +- initial: remembered wrong user across login/logout +- initial: can't switch to account when there is only one +- initial: bad experience when following nobody - make a cool independent app - indicate when workspace differs from installed - / => Something good. @@ -19,14 +24,14 @@ - no denial of service - package standalone executable - make a better connections API -- tf account timeout why - attribute blob wants to messages - editor without app iframe - sequence_before_author -> flags - apps name characters -- ssb don't overflow boxes ## Maybe Done +- tf account timeout why +- ssb don't overflow boxes - jwt for session tokens - linkify https://... - emoji reaction picker diff --git a/apps/cory/ssblit.json b/apps/cory/ssblit.json index 3d5bb957..19509daa 100644 --- a/apps/cory/ssblit.json +++ b/apps/cory/ssblit.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&jLRr14wP54BEkzBMIf1vCdeylqYExD8+jnHwgsqV9a4=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&4uvb7ESTRYeImX1lsIQOWRec6HmMBaYipGgYf0EFVPY=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&9BDffV4HY9FqhL7XI4it+UQJB4cYwbDNsY3S1cxy2vw=.sha256","tf-app.js":"&qqpOZHnkJQevhLGPUEJ7br2S/LNH+nQtC91vz3CrYrE=.sha256","tf-message.js":"&VuxfyhBr0YLYydk+7Ivpr99VCJdiU0KHcN6xus0AxwU=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&N2yKZwFnb2GbPeipgQtu6xFvezENNOgud9G7EhCQ/K0=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&ZGWHQZPTUl4QU5++WkGwGbyj+hxhQrTg9nLmZCrl/1g=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&Zw90HptAvGwX/vBnEhRVfNrYjMSssFnnKpp8bzwXQH0=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&SSHoFxBG2DiKUbfMNxiBjxqtAccQDSAEUTSN/IN/MlY=.sha256","tf-tab-connections.js":"&PjreVhTR/vxlGHVKQbY0P9BuD6udtPMHDUv9HPCHuKw=.sha256","tf-news.js":"&/Ij0SaBTohV2myuA1gQAPlgmyq/AmmvYIhSCm3wfmow=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&jLRr14wP54BEkzBMIf1vCdeylqYExD8+jnHwgsqV9a4=.sha256","lit-all.min.js":"&N4A12AsifdQgwdpII0SFtG513BfoLpmPjdJ9VTDftpg=.sha256","index.html":"&4uvb7ESTRYeImX1lsIQOWRec6HmMBaYipGgYf0EFVPY=.sha256","script.js":"&G8puK9Q4MngHy3D4ppcKyT49WKbHD2OCeUcAw2ghTDE=.sha256","lit-all.min.js.map":"&oFY9wO4MnujgfGNGv4VggHc5V5JwX4C8csqKZ6KJYbE=.sha256","tf-id-picker.js":"&9BDffV4HY9FqhL7XI4it+UQJB4cYwbDNsY3S1cxy2vw=.sha256","tf-app.js":"&kTec3rjXjYFrFb28/kWxMZ02t7PK2bTzreGRBO4J8uA=.sha256","tf-message.js":"&VuxfyhBr0YLYydk+7Ivpr99VCJdiU0KHcN6xus0AxwU=.sha256","tf-user.js":"&bXTedgBudTQLXEBPY9R8OLfQ/ZLpo8YRU9Oq/wuGG3Y=.sha256","tf-utils.js":"&N2yKZwFnb2GbPeipgQtu6xFvezENNOgud9G7EhCQ/K0=.sha256","commonmark.min.js":"&bfBaMLU19d1p/vPBF9hlARqDX002KXG/UOfxOahZhe4=.sha256","tf-compose.js":"&ZGWHQZPTUl4QU5++WkGwGbyj+hxhQrTg9nLmZCrl/1g=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&pqYLDE/13PyEt2ceeFqvnwZ8NqWfPfpDBt4vP8SeHbs=.sha256","tf-styles.js":"&Zw90HptAvGwX/vBnEhRVfNrYjMSssFnnKpp8bzwXQH0=.sha256","tf-profile.js":"&vRKjsnYvOiHCQahzEfznCvP5YDwUPtltlpWf+pxwZ1Y=.sha256","commonmark-linkify.js":"&X+hNNkmSRvKY86khyAun+cXksquXbMakZdINbGbx30g=.sha256","tf-tab-search.js":"&ESt2vMG19sH5j6ungKua/ZuvIGslyuWyb3juXdOCecg=.sha256","tf-tab-news.js":"&SSHoFxBG2DiKUbfMNxiBjxqtAccQDSAEUTSN/IN/MlY=.sha256","tf-tab-connections.js":"&PjreVhTR/vxlGHVKQbY0P9BuD6udtPMHDUv9HPCHuKw=.sha256","tf-news.js":"&/Ij0SaBTohV2myuA1gQAPlgmyq/AmmvYIhSCm3wfmow=.sha256","tribute.css":"&9FogMzZHKXCfGb7mlh7z+/wiNZzBsOB/tKoh6MfYJno=.sha256","tribute.esm.js":"&P1wKqCfYULpR/ahSB98JP8xaxfikuZwwtT6I/SAo7/Y=.sha256"}} \ No newline at end of file diff --git a/apps/cory/ssblit/tf-app.js b/apps/cory/ssblit/tf-app.js index 4fb55065..b21fdd22 100644 --- a/apps/cory/ssblit/tf-app.js +++ b/apps/cory/ssblit/tf-app.js @@ -15,6 +15,7 @@ class TfElement extends LitElement { loaded: {type: Boolean}, following: {type: Array}, users: {type: Object}, + ids: {type: Array}, }; } @@ -125,7 +126,6 @@ class TfElement extends LitElement { let result = await this.following_deep_internal(ids, depth, blocking, cache.last_row_id, cache.following, max_row_id); cache.last_row_id = max_row_id; await tfrpc.rpc.databaseSet('following', JSON.stringify(cache)); - console.log(cache); return [result, cache.following]; } @@ -222,14 +222,14 @@ class TfElement extends LitElement { async create_identity() { if (confirm("Are you sure you want to create a new identity?")) { await tfrpc.rpc.createIdentity(); - this.requestUpdate(); + this.ids = (await tfrpc.rpc.getIdentities()) || []; } } async render_id_picker() { - this._ids = this._ids || (await tfrpc.rpc.getIdentities()) || []; + this.ids = this.ids || (await tfrpc.rpc.getIdentities()) || []; return html` - + `; } @@ -285,18 +285,16 @@ class TfElement extends LitElement { let self = this; if (!this.loading && this.whoami && this.loaded !== this.whoami) { - console.log('loading', this.whoami); this.loading = true; this.following = []; this.users = {}; this.load().finally(function() { self.loading = false; - console.log('loaded'); }); } let id_picker = html` - ${guard([this.whoami], () => until(this.render_id_picker(), html`
Loading...
`))} + ${guard([this.whoami, this.ids], () => until(this.render_id_picker(), html`
Loading...
`))} `; let tabs = html`
diff --git a/core/ssb.js b/core/ssb.js index 71be774b..03092ba7 100644 --- a/core/ssb.js +++ b/core/ssb.js @@ -148,7 +148,7 @@ ssb.addEventListener('connections', function on_connections_changed(change, conn } } }); - if (Object.keys(connection.active_blob_wants).length < k_blobs_concurrent_target) { + if (g_wants_requests[connection.id] && Object.keys(connection.active_blob_wants).length < k_blobs_concurrent_target) { requestMoreBlobs(g_wants_requests[connection.id]); } }