forked from cory/tildefriends
Mention all sources when sharing an app. I don't entirely know how blobs replicate, and this seems safest.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3761 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@@ -373,6 +373,21 @@ ssb.addEventListener('message', async function(id) {
|
||||
}
|
||||
});
|
||||
|
||||
async function addAppSources(message) {
|
||||
for (let mention of message.mentions) {
|
||||
if (mention.type == 'application/tildefriends') {
|
||||
var blob = await ssb.blobGet(mention.link);
|
||||
var json = JSON.parse(utf8Decode(blob));
|
||||
for (let file of Object.keys(json.files)) {
|
||||
message.mentions.push({
|
||||
name: file,
|
||||
link: json.files[file],
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
core.register('message', async function(m) {
|
||||
if (m.message == 'ready') {
|
||||
await ready();
|
||||
@@ -380,6 +395,7 @@ core.register('message', async function(m) {
|
||||
if (m.message.connect) {
|
||||
await ssb.connect(m.message.connect);
|
||||
} else if (m.message.appendMessage) {
|
||||
await addAppSources(m.message.appendMessage);
|
||||
await ssb.appendMessage(m.message.appendMessage);
|
||||
} else if (m.message.refresh) {
|
||||
await refresh(g_selected);
|
||||
|
Reference in New Issue
Block a user