diff --git a/apps/cory/index.json b/apps/cory/index.json index cd58d475..c3a6af8e 100644 --- a/apps/cory/index.json +++ b/apps/cory/index.json @@ -1 +1 @@ -{"type":"tildefriends-app","files":{"app.js":"&CuC9hpnUkbbSAgR4E30aVNWMXySrbHDhoIXI/pxU1g8=.sha256","index.html":"&mv6A+VsR0hIDWLtczTB1SlexmT1FTpU/IjfL46Je6Y4=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&t/QhZVt/e3LN3HgSoqe8C81pjq4ZS6uiWcqGOB4NX4Q=.sha256","tf-message.js":"&VNC8ptzGXWAVl9LBBZfrk3YmweA8PQ02d7/wZxWXoAA=.sha256","tf.js":"&swCMB9K4dkPCPC2tYS5aTUZSGUmaezlW6FNeLM9QNXI=.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"}} \ No newline at end of file +{"type":"tildefriends-app","files":{"app.js":"&LPDR4ZoE/qdPy9djmNFUfblXk7W1znMbwuAXp3/zWPI=.sha256","index.html":"&6UkH58DRXi8Y5bnfKWv9CgU5XJ2MWrJ7vzqL/uau5eg=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&t/QhZVt/e3LN3HgSoqe8C81pjq4ZS6uiWcqGOB4NX4Q=.sha256","tf-message.js":"&VNC8ptzGXWAVl9LBBZfrk3YmweA8PQ02d7/wZxWXoAA=.sha256","tf.js":"&Br2AswUPq0krVdr6JF/0r64qF/QLK7iOSC3bf1jqEDI=.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"}} \ No newline at end of file diff --git a/apps/cory/index/app.js b/apps/cory/index/app.js index 17619ecb..810c35cc 100644 --- a/apps/cory/index/app.js +++ b/apps/cory/index/app.js @@ -296,7 +296,11 @@ ssb.addEventListener('message', async function(id) { var db = await database("ssb"); var posts = await getPosts(db, [id]); for (let post of posts) { - await app.postMessage({message: post}); + if (post.author == await ssb.whoami()) { + await app.postMessage({message: post}); + } else { + await app.postMessage({unread: 1}); + } } }); diff --git a/apps/cory/index/index.html b/apps/cory/index/index.html index 82ecbfcf..fcc79d30 100644 --- a/apps/cory/index/index.html +++ b/apps/cory/index/index.html @@ -42,10 +42,11 @@ + + Refresh + {{unread}} unread item{{unread == 1 ? '' : 's'}} + - - cached - Welcome, . diff --git a/apps/cory/index/tf.js b/apps/cory/index/tf.js index 49ac5cef..3d46415f 100644 --- a/apps/cory/index/tf.js +++ b/apps/cory/index/tf.js @@ -12,6 +12,7 @@ var g_data = { votes: {}, apps: {}, share_app: null, + unread: 0, }; var g_data_initial = JSON.parse(JSON.stringify(g_data)); @@ -53,6 +54,8 @@ window.addEventListener('message', function(event) { Object.keys(g_data_initial).forEach(function(key) { Vue.set(g_data, key, JSON.parse(JSON.stringify(g_data_initial[key]))); }); + } else if (key == 'unread') { + g_data.unread += event.data.unread; } else { g_data[key] = event.data[key]; }