feat(pleroma): add post visibility

This commit is contained in:
vulet 2020-12-27 17:27:48 +08:00
parent 80dcff0440
commit a7e32b5a3f
3 changed files with 7 additions and 4 deletions

View file

@ -15,11 +15,11 @@ exports.runQuery = function (matrixClient, room, registrar) {
matrixClient.sendHtmlNotice(room.roomId,
'',
`<b><a href="${registrar.config.fediverse.domain}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
<blockquote><i>${events.data[0].content}<br>
<blockquote><i>${events.data[0].content}</i><br>
${events.data[0].media_attachments.map(media =>
`<a href="${media.remote_url}">`+`${media.description}`+'</a>'
).join('<br>')}
(id: ${events.data[0].id}</a>)
(id: ${events.data[0].id}) ${registrar.media.visibilityEmoji(events.data[0].visibility)}
</blockquote>`);
} else {
matrixClient.sendHtmlNotice(room.roomId,
@ -32,7 +32,7 @@ exports.runQuery = function (matrixClient, room, registrar) {
${events.data[0].media_attachments.map(media =>
`<a href="${media.remote_url}">`+`Proxied image, no description available.`+'</a>'
).join('<br>')}
<br>(id: ${events.data[0].id})
<br>(id: ${events.data[0].id}) ${registrar.media.visibilityEmoji(events.data[0].visibility)}
</blockquote>`);
}
}

View file

@ -2,6 +2,9 @@ const qs = require('qs');
const axios = require('axios');
const FormData = require('form-data');
const emojis = { public: 'ðŸŒ', unlisted: 'ðŸ“', private: '🔒ï¸', direct: '✉ï¸' };
exports.visibilityEmoji = v => emojis[v] || v;
const getFilename = header => {
if(typeof header !== 'string') return null;
try {

View file

@ -34,7 +34,7 @@ exports.runQuery = function (matrixClient, room, registrar) {
${notifications.data[0].account.acct}</a></b>
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">mentioned</a>
you:</b></font><br><blockquote><i><b>${notifications.data[0].status.content}
<br>(id: ${notifications.data[0].status.id})</i></b>
<br>(id: ${notifications.data[0].status.id}) ${registrar.media.visibilityEmoji(notifications.data[0].status.visibility)}</i></b>
</blockquote>`);
} else if (notifications.data[0].type === 'reblog') {
matrixClient.sendHtmlNotice(room.roomId,