ssb: Add some options to encourage getting connected to the connections sidebar section.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m46s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 32m46s
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
{
|
||||
"type": "tildefriends-app",
|
||||
"emoji": "🦀",
|
||||
"previous": "&XDrMZT7w656QanwG+zRSUFeaoY3Jl4elveY6GftcD5Y=.sha256"
|
||||
"previous": "&DZ1PgW4wWp4QeIiDhSpxSf5I/5WE7NjlMkqPnpSBhmc=.sha256"
|
||||
}
|
||||
|
@ -106,6 +106,12 @@ tfrpc.register(async function sync() {
|
||||
tfrpc.register(async function url() {
|
||||
return core.url;
|
||||
});
|
||||
tfrpc.register(async function globalSettingsGet(key) {
|
||||
return core.globalSettingsGet(key);
|
||||
});
|
||||
tfrpc.register(async function globalSettingsSet(key, value) {
|
||||
return core.globalSettingsSet(key, value);
|
||||
});
|
||||
|
||||
core.register('onBroadcastsChanged', async function () {
|
||||
await tfrpc.rpc.set('broadcasts', await ssb.getBroadcasts());
|
||||
|
@ -25,6 +25,7 @@ class TfTabNewsElement extends LitElement {
|
||||
connections: {type: Array},
|
||||
private_messages: {type: Array},
|
||||
recent_reactions: {type: Array},
|
||||
peer_exchange: {type: Boolean},
|
||||
};
|
||||
}
|
||||
|
||||
@ -48,6 +49,9 @@ class TfTabNewsElement extends LitElement {
|
||||
tfrpc.rpc.localStorageGet('drafts').then(function (d) {
|
||||
self.drafts = JSON.parse(d || '{}');
|
||||
});
|
||||
tfrpc.rpc.globalSettingsGet('peer_exchange').then(function (value) {
|
||||
self.peer_exchange = value;
|
||||
});
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
@ -164,6 +168,15 @@ class TfTabNewsElement extends LitElement {
|
||||
.map((x) => x[0]);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
tfrpc.rpc.sync();
|
||||
}
|
||||
|
||||
async enable_peer_exchange() {
|
||||
await tfrpc.rpc.globalSettingsSet('peer_exchange', true);
|
||||
this.peer_exchange = await tfrpc.rpc.globalSettingsGet('peer_exchange');
|
||||
}
|
||||
|
||||
render_sidebar() {
|
||||
return html`
|
||||
<div
|
||||
@ -240,6 +253,26 @@ class TfTabNewsElement extends LitElement {
|
||||
<a class="w3-bar-item w3-theme-d2 w3-button" href="#connections">
|
||||
<h4 style="margin: 0">Connections</h4>
|
||||
</a>
|
||||
${this.connections?.filter((x) => x.id)?.length == 0
|
||||
? html`
|
||||
<button
|
||||
class=${'w3-bar-item w3-button' +
|
||||
(this.connections?.some((x) => x.flags.one_shot)
|
||||
? ' w3-spin'
|
||||
: '')}
|
||||
@click=${this.refresh}
|
||||
>
|
||||
↻ Sync now
|
||||
</button>
|
||||
<button
|
||||
class=${'w3-bar-item w3-button' +
|
||||
(this.peer_exchange ? ' w3-hide' : '')}
|
||||
@click=${this.enable_peer_exchange}
|
||||
>
|
||||
Enable peer exchange
|
||||
</button>
|
||||
`
|
||||
: undefined}
|
||||
${this.connections
|
||||
.filter((x) => x.id)
|
||||
.map(
|
||||
|
@ -1552,8 +1552,8 @@ typedef struct _following_t following_t;
|
||||
typedef struct _following_t
|
||||
{
|
||||
char id[k_id_base64_len];
|
||||
int depth;
|
||||
bool populated;
|
||||
int depth;
|
||||
following_t** following;
|
||||
following_t** blocking;
|
||||
int following_count;
|
||||
|
Reference in New Issue
Block a user