Redo sharing apps so that they can be mentioned from regular posts.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3723 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
fafc524c8c
commit
b980bb4946
@ -1 +1 @@
|
|||||||
{"type":"tildefriends-app","files":{"app.js":"&bbZBdFOrGh6o0X+ypAaRhfAls89Ir/IICcUN3xlO02w=.sha256","index.html":"&zwiRwroNQ1SnCsq97zB8dRiGwY4H+ii4ZtuKR385zdI=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&KmUw2D8yehJU95RQ+8DWP69w/5wK7yWR6fUc5/LIpio=.sha256","tf-message.js":"&KjVh7zASx0TZtZTsS6lJ7T70K9tyXcf+ink4vK7gSWI=.sha256","tf.js":"&u6n7Eqa1ryFuL9AhlYeJ/WzXYh6zxECKVfhG8/ecRM8=.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":"&Y/WR3FLnC1qV+3WGFKEaIZ4nrgKIa/flClu4wUI50R8=.sha256","index.html":"&mQ2fDeVm6D6+pwmF/6K04H1q5saq/Fl6Cq23UKlvJls=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&KmUw2D8yehJU95RQ+8DWP69w/5wK7yWR6fUc5/LIpio=.sha256","tf-message.js":"&c7NMlMBi2UZE7ChUXd3h4ih0q2myuHhp3PpNUfBRvHM=.sha256","tf.js":"&I45p0703bQNAWq/5wFHdVrwM3z+5FL4K8QmDTfSnBAU=.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"}}
|
@ -325,17 +325,8 @@ core.register('message', async function(m) {
|
|||||||
} else if (m.message) {
|
} else if (m.message) {
|
||||||
if (m.message.connect) {
|
if (m.message.connect) {
|
||||||
await ssb.connect(m.message.connect);
|
await ssb.connect(m.message.connect);
|
||||||
} else if (m.message.post) {
|
|
||||||
await ssb.post(m.message.post);
|
|
||||||
} else if (m.message.appendMessage) {
|
} else if (m.message.appendMessage) {
|
||||||
await ssb.appendMessage(m.message.appendMessage);
|
await ssb.appendMessage(m.message.appendMessage);
|
||||||
} else if (m.message.share_app) {
|
|
||||||
var app = await ssb.blobGet(m.message.share_app.app);
|
|
||||||
app = JSON.parse(utf8Decode(app));
|
|
||||||
app.type = 'tildefriends-app';
|
|
||||||
app.name = m.message.share_app.name;
|
|
||||||
app.text = m.message.share_app.text;
|
|
||||||
await ssb.appendMessage(app);
|
|
||||||
} else if (m.message.user) {
|
} else if (m.message.user) {
|
||||||
await sendUser(await database("ssb"), m.message.user);
|
await sendUser(await database("ssb"), m.message.user);
|
||||||
} else if (m.message.refresh) {
|
} else if (m.message.refresh) {
|
||||||
|
@ -53,8 +53,8 @@
|
|||||||
<div class="md-title">What's up?</div>
|
<div class="md-title">What's up?</div>
|
||||||
</md-card-header>
|
</md-card-header>
|
||||||
<md-card-content>
|
<md-card-content>
|
||||||
<md-chip v-if="share_app" md-deletable @md-delete="share_app = null">
|
<md-chip v-for="link in Object.keys(mentions)" v-bind:key="link" md-deletable @md-delete="remove_from_mentions(link)">
|
||||||
{{share_app}}: {{apps[share_app]}}
|
{{mentions[link].name}}: {{link}}
|
||||||
</md-chip>
|
</md-chip>
|
||||||
<md-field>
|
<md-field>
|
||||||
<label>Post a message</label>
|
<label>Post a message</label>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
<md-menu>
|
<md-menu>
|
||||||
<md-button md-menu-trigger>Share App</md-button>
|
<md-button md-menu-trigger>Share App</md-button>
|
||||||
<md-menu-content>
|
<md-menu-content>
|
||||||
<md-menu-item v-for="app in Object.keys(apps)" v-bind:key="app" @click="share_app = app">
|
<md-menu-item v-for="app in Object.keys(apps)" v-bind:key="app" @click="add_app_to_mentions(app)">
|
||||||
{{app}}
|
{{app}}
|
||||||
</md-menu-item>
|
</md-menu-item>
|
||||||
</md-menu-content>
|
</md-menu-content>
|
||||||
|
@ -39,7 +39,10 @@ Vue.component('tf-message', {
|
|||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if="content_json && content_json.type == 'post'">
|
<div v-if="content_json && content_json.type == 'post'">
|
||||||
<div v-html="this.markdown(content_json.text)"></div>
|
<div v-html="this.markdown(content_json.text)"></div>
|
||||||
<img v-for="mention in content_json.mentions" v-if="mention.link && typeof(mention.link) == 'string' && mention.link.startsWith('&')" :src="'/' + mention.link + '/view'"></img>
|
<div v-for="mention in content_json.mentions" v-if="mention.link && typeof(mention.link) == 'string' && mention.link.startsWith('&')">
|
||||||
|
<a v-if="mention.type == 'application/tildefriends'" :href="'/' + mention.link + '/'" target="_top">{{mention.name}}</a>
|
||||||
|
<img v-else :src="'/' + mention.link + '/view'"></img>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="content_json && content_json.type == 'tildefriends-app'">
|
<div v-else-if="content_json && content_json.type == 'tildefriends-app'">
|
||||||
<div v-html="this.markdown(content_json.text)"></div>
|
<div v-html="this.markdown(content_json.text)"></div>
|
||||||
|
@ -11,7 +11,7 @@ var g_data = {
|
|||||||
pubs: [],
|
pubs: [],
|
||||||
votes: {},
|
votes: {},
|
||||||
apps: {},
|
apps: {},
|
||||||
share_app: null,
|
mentions: {},
|
||||||
unread: 0,
|
unread: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,16 +117,16 @@ window.addEventListener('load', function() {
|
|||||||
data: g_data,
|
data: g_data,
|
||||||
methods: {
|
methods: {
|
||||||
post_message: function() {
|
post_message: function() {
|
||||||
if (g_data.share_app) {
|
var message = {
|
||||||
window.parent.postMessage({share_app: {
|
type: 'post',
|
||||||
app: g_data.apps[g_data.share_app],
|
|
||||||
name: g_data.share_app,
|
|
||||||
text: document.getElementById('post_text').value,
|
text: document.getElementById('post_text').value,
|
||||||
}}, '*');
|
};
|
||||||
} else {
|
if (Object.keys(g_data.mentions).length) {
|
||||||
window.parent.postMessage({post: document.getElementById('post_text').value}, '*');
|
message.mentions = Object.values(g_data.mentions);
|
||||||
}
|
}
|
||||||
|
window.parent.postMessage({appendMessage: message}, '*');
|
||||||
document.getElementById('post_text').value = '';
|
document.getElementById('post_text').value = '';
|
||||||
|
Vue.set(g_data, mentions, {});
|
||||||
},
|
},
|
||||||
ssb_connect: function(connection) {
|
ssb_connect: function(connection) {
|
||||||
window.parent.postMessage({connect: connection}, '*');
|
window.parent.postMessage({connect: connection}, '*');
|
||||||
@ -141,6 +141,16 @@ window.addEventListener('load', function() {
|
|||||||
refresh: function() {
|
refresh: function() {
|
||||||
window.parent.postMessage({refresh: true}, '*');
|
window.parent.postMessage({refresh: true}, '*');
|
||||||
},
|
},
|
||||||
|
add_app_to_mentions: function(app) {
|
||||||
|
Vue.set(g_data.mentions, g_data.apps[app], {
|
||||||
|
link: g_data.apps[app],
|
||||||
|
name: app,
|
||||||
|
type: 'application/tildefriends',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
remove_from_mentions: function(link) {
|
||||||
|
Vue.delete(g_data.mentions, link);
|
||||||
|
},
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
window.parent.postMessage('ready', '*');
|
window.parent.postMessage('ready', '*');
|
||||||
|
Loading…
Reference in New Issue
Block a user