From 8a6147d51287654df6c8a8cf75a0ef3f6c17ea99 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sun, 6 Oct 2024 11:14:37 -0400 Subject: [PATCH] ssb: Beginnings of a "sync now" mode for mobile. --- apps/ssb.json | 2 +- apps/ssb/app.js | 3 ++ apps/ssb/tf-tab-connections.js | 10 +++++ src/ssb.c | 55 ++++++++++++++++++++--- src/ssb.connections.c | 82 +++++++++++++++++++++++++++++++++- src/ssb.connections.h | 6 +++ src/ssb.h | 36 +++++++++++++-- src/ssb.js.c | 38 +++++----------- src/ssb.rpc.c | 2 +- src/ssb.tests.c | 26 +++++------ 10 files changed, 207 insertions(+), 53 deletions(-) diff --git a/apps/ssb.json b/apps/ssb.json index cc9d61e4..efd3e8a9 100644 --- a/apps/ssb.json +++ b/apps/ssb.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "🐌", - "previous": "&PK+UixgYQEYFKKPJ3BVacSKaDRRjiNO6M/fmgzDJaRM=.sha256" + "previous": "&O7Rf3apWJhDC4Zfjo1a5ZRk6AMNeCmFuEIiczXwmSYE=.sha256" } diff --git a/apps/ssb/app.js b/apps/ssb/app.js index 3868b534..afa58858 100644 --- a/apps/ssb/app.js +++ b/apps/ssb/app.js @@ -103,6 +103,9 @@ tfrpc.register(async function encrypt(id, recipients, content) { tfrpc.register(async function getActiveIdentity() { return await ssb.getActiveIdentity(); }); +tfrpc.register(async function sync() { + return await ssb.sync(); +}); core.register('onBroadcastsChanged', async function () { await tfrpc.rpc.set('broadcasts', await ssb.getBroadcasts()); }); diff --git a/apps/ssb/tf-tab-connections.js b/apps/ssb/tf-tab-connections.js index da424002..a28d0ba7 100644 --- a/apps/ssb/tf-tab-connections.js +++ b/apps/ssb/tf-tab-connections.js @@ -158,10 +158,20 @@ class TfTabConnectionsElement extends LitElement { `; } + refresh() { + tfrpc.rpc.sync(); + } + render() { let self = this; return html`
+

New Connection