diff --git a/apps/apps.json b/apps/apps.json index 762ca759..b00f0733 100644 --- a/apps/apps.json +++ b/apps/apps.json @@ -1,4 +1,5 @@ { "type": "tildefriends-app", - "emoji": "💻" + "emoji": "💻", + "previous": "&33ngNe0YrH3JScss6krlCwddZcXl8C5szonp7DYy4qA=.sha256" } \ No newline at end of file diff --git a/apps/apps/app.js b/apps/apps/app.js index d2a19c6e..04b8f9ea 100644 --- a/apps/apps/app.js +++ b/apps/apps/app.js @@ -8,9 +8,39 @@ async function fetch_info(apps) { return result; } +async function fetch_shared_apps() { + let messages = {}; + await ssb.sqlAsync(` + SELECT messages.* + FROM messages_fts('"application/tildefriends"') + JOIN messages ON messages.rowid = messages_fts.rowid + ORDER BY timestamp + `, + [], + function(row) { + let content = JSON.parse(row.content); + for (let mention of content.mentions) { + if (mention?.type === 'application/tildefriends') { + messages[JSON.stringify([row.author, mention.name])] = { + message: row, + blob: mention.link, + name: mention.name, + }; + } + } + }); + let result = {}; + for (let app of Object.values(messages).sort((x, y) => y.message.timestamp - x.message.timestamp)) { + result[app.name] = JSON.parse(utf8Decode(await ssb.blobGet(app.blob))); + result[app.name].blob_id = app.blob; + } + return result; +} + async function main() { var apps = await fetch_info(await core.apps()); var core_apps = await fetch_info(await core.apps('core')); + let shared_apps = await fetch_shared_apps(); var doc = `
@@ -40,6 +70,8 @@ async function main() {