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:
parent
dbfa9e5623
commit
c40a513876
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&g8ietss5dxwzLkFreH1YCDH1fLr53CgA0htu9+lr8Ok=.sha256","index.html":"&/CE4CuVKI56h5tfAHF0kzCXbLfhVjWzsM8aZAB9HpEM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&ZQuSBy1K3iASz/NVEa8ILA6aOefHZUmBa/Ddpcl7ZyI=.sha256","tf.js":"&oNOs6Ha7Rsd2fectO5NVhsWdwu/vkLBNIvr8l9Vj6ds=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}}
|
{"type":"tildefriends-app","files":{"app.js":"&GCb69GeodErTY6TJSmFwUomO1nBC8UIdkgJPbeA8tXs=.sha256","index.html":"&/CE4CuVKI56h5tfAHF0kzCXbLfhVjWzsM8aZAB9HpEM=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&DdJwZYEo7AqFyutYMvEjykoVXxdHVog0UXye6Sbo0TU=.sha256","tf-message.js":"&ZQuSBy1K3iASz/NVEa8ILA6aOefHZUmBa/Ddpcl7ZyI=.sha256","tf.js":"&0qrX+5OCWdXUJif4NY7Bc03k7gj/zAIbVqLovhv+akk=.sha256","commonmark.min.js":"&5x6ek3tFrKTZX6hXNNyFsjmhvrjmWpUkwuuaiyVV1Us=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256"}}
|
@ -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) {
|
core.register('message', async function(m) {
|
||||||
if (m.message == 'ready') {
|
if (m.message == 'ready') {
|
||||||
await ready();
|
await ready();
|
||||||
@ -380,6 +395,7 @@ core.register('message', async function(m) {
|
|||||||
if (m.message.connect) {
|
if (m.message.connect) {
|
||||||
await ssb.connect(m.message.connect);
|
await ssb.connect(m.message.connect);
|
||||||
} else if (m.message.appendMessage) {
|
} else if (m.message.appendMessage) {
|
||||||
|
await addAppSources(m.message.appendMessage);
|
||||||
await ssb.appendMessage(m.message.appendMessage);
|
await ssb.appendMessage(m.message.appendMessage);
|
||||||
} else if (m.message.refresh) {
|
} else if (m.message.refresh) {
|
||||||
await refresh(g_selected);
|
await refresh(g_selected);
|
||||||
|
@ -179,7 +179,7 @@ window.addEventListener('load', function() {
|
|||||||
}
|
}
|
||||||
window.parent.postMessage({appendMessage: message}, '*');
|
window.parent.postMessage({appendMessage: message}, '*');
|
||||||
document.getElementById('post_text').value = '';
|
document.getElementById('post_text').value = '';
|
||||||
Vue.set(g_data, mentions, {});
|
Vue.set(g_data, 'mentions', {});
|
||||||
g_data.reply_root = null;
|
g_data.reply_root = null;
|
||||||
g_data.reply_branch = null;
|
g_data.reply_branch = null;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user