Trying to make refresh more sensible.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3622 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
79022e1e1f
commit
22078fcd2c
@ -1 +1 @@
|
||||
{"type":"tildefriends-app","files":{"app.js":"&WCq6ssQedT5denXPXlz2BswPD6hmt++EmWIMIDUMurA=.sha256","index.md":"&Lr7IXs8osbmWz6SDsGTQCiybbxkbWSK2MrUcXMzgqTs=.sha256","todo.md":"&/vzp5PrF93TPAuS/97fbj6+mzyNOxYFjBGQJmZYe4As=.sha256","structure.md":"&xRhQ4Mpom1Idskum07osbBQYcYWroH0sELQBkQHrOMg=.sha256","purpose.md":"&c0/YqFhXC0X3DqiEo55NqzI5wq0VTw6cVZTf/gAWS3w=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256"}}
|
||||
{"type":"tildefriends-app","files":{"app.js":"&WCq6ssQedT5denXPXlz2BswPD6hmt++EmWIMIDUMurA=.sha256","index.md":"&Lr7IXs8osbmWz6SDsGTQCiybbxkbWSK2MrUcXMzgqTs=.sha256","todo.md":"&XrOJ3D5YMTN+j+0hJgLLy7Y61B6Z14ebv+60ee+N37I=.sha256","structure.md":"&xRhQ4Mpom1Idskum07osbBQYcYWroH0sELQBkQHrOMg=.sha256","purpose.md":"&c0/YqFhXC0X3DqiEo55NqzI5wq0VTw6cVZTf/gAWS3w=.sha256","guide.md":"&SgnGL0+rjetY2o9A2+lVRbNvHIkqKwMnZr9gXWneIlc=.sha256"}}
|
@ -10,7 +10,10 @@
|
||||
- audit + document API exposed to apps
|
||||
- ssb core
|
||||
- good refresh
|
||||
- disconnect all current connections and reset reconnect timers?
|
||||
- reload the page
|
||||
- live updates
|
||||
- createHistoryStream for every account followed from local accounts
|
||||
- apps
|
||||
- app messages
|
||||
- installable apps
|
||||
@ -42,3 +45,4 @@
|
||||
- tf account timeout why
|
||||
- make some demo apps
|
||||
- rock paper scissors, somehow
|
||||
- don't resave files that didn't change
|
@ -1 +1 @@
|
||||
{"type":"tildefriends-app","files":{"app.js":"&GOWmWDTHuNMz2XpxNxspAqsITn/RwvlB4Um6euxHFbU=.sha256","index.html":"&/noD6q/rH4VgszVb6W0D3mnK9t0GbDYYZtBGM/xs2kY=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}}
|
||||
{"type":"tildefriends-app","files":{"app.js":"&oCXEt7h7lEIL8BXyVDv3Skp44ApY+rExcNKx9//Dj80=.sha256","index.html":"&7/hwWTsmdkNkTLT3gUwaZ+B+Y5EjHGHyE2+zWkHnMac=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256"}}
|
@ -291,6 +291,20 @@ async function getPosts(db, ids) {
|
||||
}
|
||||
|
||||
async function ready() {
|
||||
return refresh();
|
||||
}
|
||||
|
||||
core.register('onBroadcastsChanged', async function() {
|
||||
await app.postMessage({broadcasts: await ssb.getBroadcasts()});
|
||||
});
|
||||
|
||||
core.register('onConnectionsChanged', async function() {
|
||||
var connections = await ssb.connections();
|
||||
await app.postMessage({connections: connections});
|
||||
});
|
||||
|
||||
async function refresh() {
|
||||
await app.postMessage({clear: true});
|
||||
var whoami = await ssb.whoami();
|
||||
var db = await database("ssb");
|
||||
await Promise.all([
|
||||
@ -299,6 +313,7 @@ async function ready() {
|
||||
app.postMessage({broadcasts: await ssb.getBroadcasts()}),
|
||||
app.postMessage({connections: await ssb.connections()}),
|
||||
followingDeep(db, [whoami], 2).then(function(f) {
|
||||
print(JSON.stringify(f));
|
||||
getRecentPostIds(db, whoami, [].concat([whoami], f), k_posts_max).then(async function(ids) {
|
||||
return getPosts(db, ids);
|
||||
}).then(async function(posts) {
|
||||
@ -333,24 +348,6 @@ async function ready() {
|
||||
]);
|
||||
}
|
||||
|
||||
core.register('onBroadcastsChanged', async function() {
|
||||
await app.postMessage({broadcasts: await ssb.getBroadcasts()});
|
||||
});
|
||||
|
||||
core.register('onConnectionsChanged', async function() {
|
||||
var connections = await ssb.connections();
|
||||
await app.postMessage({connections: connections});
|
||||
});
|
||||
|
||||
async function refresh() {
|
||||
var db = await database("ssb");
|
||||
var whoami = await ssb.whoami();
|
||||
var ids = await followingDeep(db, [whoami], 2);
|
||||
for (var id of ids) {
|
||||
await ssb.createHistoryStream(id);
|
||||
}
|
||||
}
|
||||
|
||||
core.register('message', async function(m) {
|
||||
if (m.message == 'ready') {
|
||||
await ready();
|
||||
|
@ -22,6 +22,7 @@
|
||||
pubs: [],
|
||||
votes: [],
|
||||
};
|
||||
var g_data_initial = JSON.parse(JSON.stringify(g_data));
|
||||
window.addEventListener('message', function(event) {
|
||||
var key = Object.keys(event.data)[0];
|
||||
if (key + 's' in g_data && Array.isArray(g_data[key + 's'])) {
|
||||
@ -42,6 +43,10 @@
|
||||
g_data.broadcasts = event.data.broadcasts;
|
||||
} else if (key == 'pubs') {
|
||||
g_data.pubs = event.data.pubs;
|
||||
} else if (key == 'clear') {
|
||||
Object.keys(g_data_initial).forEach(function(key) {
|
||||
Vue.set(g_data, key, JSON.parse(JSON.stringify(g_data_initial[key])));
|
||||
});
|
||||
} else {
|
||||
g_data[key] = event.data[key];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user